Skip to content

Commit 3ab2ba8

Browse files
committed
support get clash from document
1 parent 9fbfa34 commit 3ab2ba8

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

NavisPythonShell/init.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# these commands get executed in the current scope
22
# of each new shell (but not for canned commands)
33
from Autodesk.Navisworks.Api import *
4+
from Autodesk.Navisworks.Api.Clash import *
45
app = Application
56
doc = app.ActiveDocument
67
selection = doc.CurrentSelection.SelectedItems
7-
8+
docclash = DocumentExtensions.GetClash(doc)
89
def quit():
910
__window__.Close()
1011
exit = quit

NpsRuntime/NpsRuntime.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<WarningLevel>4</WarningLevel>
2222
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
2323
<OutputPath>bin\$(Configuration)\</OutputPath>
24+
<LangVersion>latest</LangVersion>
2425
</PropertyGroup>
2526
<PropertyGroup>
2627
<!-- see: http://thebuildingcoder.typepad.com/blog/2013/06/processor-architecture-mismatch-warning.html -->
@@ -67,6 +68,9 @@
6768
<Reference Include="Autodesk.Navisworks.Api, Version=19.0.1374.1, Culture=neutral, PublicKeyToken=d85e58fa5af9b484">
6869
<HintPath>C:\Program Files\Autodesk\Navisworks Manage 2022\Autodesk.Navisworks.Api.dll</HintPath>
6970
</Reference>
71+
<Reference Include="Autodesk.Navisworks.Clash, Version=19.0.1374.1, Culture=neutral, PublicKeyToken=d85e58fa5af9b484">
72+
<HintPath>C:\Program Files\Autodesk\Navisworks Manage 2022\Autodesk.Navisworks.Clash.dll</HintPath>
73+
</Reference>
7074
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
7175
<SpecificVersion>False</SpecificVersion>
7276
<HintPath>..\RefrencedAssemblies\ICSharpCode.AvalonEdit.dll</HintPath>

NpsRuntime/ScriptExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Microsoft.Scripting.Hosting;
77
using System.Collections.Generic;
88
using Autodesk.Navisworks.Api;
9-
9+
using Autodesk.Navisworks.Api.Clash;
1010
namespace NavisPythonShell.NpsRuntime
1111
{
1212
/// <summary>
@@ -143,7 +143,7 @@ public void SetupEnvironment(ScriptEngine engine, ScriptScope scope)
143143

144144
// reference Navisworks Api Document and Application
145145
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Document).Assembly);
146-
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Application).Assembly);
146+
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Clash.ClashTest).Assembly);
147147
// also, allow access to the RPS internals
148148
engine.Runtime.LoadAssembly(typeof(NavisPythonShell.NpsRuntime.ScriptExecutor).Assembly);
149149
}

Script Examples/GetClashTest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
testdata = docclash.TestsData
2+
tests = testdata.Tests
3+
for test in tests:
4+
print(test.DisplayName)

0 commit comments

Comments
 (0)