Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions NavisPythonShell/NavisPythonShell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>Full</DebugType>
</PropertyGroup>
Expand Down Expand Up @@ -88,40 +88,40 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autodesk.Navisworks.Api, Version=19.0.1374.1, Culture=neutral, PublicKeyToken=d85e58fa5af9b484">
<HintPath>C:\Program Files\Autodesk\Navisworks Manage 2022\Autodesk.Navisworks.Api.dll</HintPath>
<Private>False</Private>
<Reference Include="Autodesk.Navisworks.Api, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d85e58fa5af9b484, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Sim2025\Autodesk.Navisworks.Api.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<Reference Include="ICSharpCode.AvalonEdit">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\ICSharpCode.AvalonEdit.dll</HintPath>
</Reference>
<Reference Include="IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="IronPython">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\IronPython.dll</HintPath>
</Reference>
<Reference Include="IronPython.Modules, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="IronPython.Modules">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\IronPython.Modules.dll</HintPath>
</Reference>
<Reference Include="IronPython.SQLite, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="IronPython.SQLite">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\IronPython.SQLite.dll</HintPath>
</Reference>
<Reference Include="IronPython.Wpf, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="IronPython.Wpf">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\IronPython.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Dynamic, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="Microsoft.Dynamic">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Microsoft.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="Microsoft.Scripting">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Microsoft.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Metadata, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<Reference Include="Microsoft.Scripting.Metadata">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Microsoft.Scripting.Metadata.dll</HintPath>
</Reference>
Expand All @@ -132,7 +132,7 @@
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Controls.WpfPropertyGrid, Version=2010.11.10.0, Culture=neutral, PublicKeyToken=be4b71144cd8a3e5, processorArchitecture=MSIL">
<Reference Include="System.Windows.Controls.WpfPropertyGrid">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\System.Windows.Controls.WpfPropertyGrid.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -277,8 +277,9 @@
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>xcopy $(TargetDir)*.* "C:\Program Files\Autodesk\Navisworks Manage 2022\Plugins\NavisPythonShell\" /Y /I /E /EXCLUDE:$(SolutionDir)exclude.txt
xcopy $(TargetDir)*.* "C:\Program Files\Autodesk\Navisworks Manage 2022\Dependencies\" /Y /I /E /EXCLUDE:$(SolutionDir)noexclude.txt</PostBuildEvent>
<PostBuildEvent>xcopy $(TargetDir)*.* "C:\Program Files\Autodesk\Navisworks Simulate 2025\Plugins\NavisPythonShell\" /Y /I /E /EXCLUDE:$(SolutionDir)exclude.txt
xcopy $(TargetDir)*.* "C:\Program Files\Autodesk\Navisworks Simulate 2025\Dependencies\" /Y /I /E /EXCLUDE:$(SolutionDir)noexclude.txt
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion NavisPythonShell/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions NpsRuntime/NpsRuntime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DebugType>Full</DebugType>
Expand Down Expand Up @@ -65,11 +65,17 @@
<Prefer32Bit />
</PropertyGroup>
<ItemGroup>
<Reference Include="Autodesk.Navisworks.Api, Version=19.0.1374.1, Culture=neutral, PublicKeyToken=d85e58fa5af9b484">
<HintPath>C:\Program Files\Autodesk\Navisworks Manage 2022\Autodesk.Navisworks.Api.dll</HintPath>
<Reference Include="Autodesk.Navisworks.Api, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d85e58fa5af9b484, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Sim2025\Autodesk.Navisworks.Api.dll</HintPath>
</Reference>
<Reference Include="Autodesk.Navisworks.Clash, Version=19.0.1374.1, Culture=neutral, PublicKeyToken=d85e58fa5af9b484">
<HintPath>C:\Program Files\Autodesk\Navisworks Manage 2022\Autodesk.Navisworks.Clash.dll</HintPath>
<Reference Include="Autodesk.Navisworks.Clash, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d85e58fa5af9b484, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Sim2025\Autodesk.Navisworks.Clash.dll</HintPath>
</Reference>
<Reference Include="Autodesk.Navisworks.Timeliner, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d85e58fa5af9b484, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RefrencedAssemblies\Sim2025\Autodesk.Navisworks.Timeliner.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 2 additions & 0 deletions NpsRuntime/ScriptExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Clash;
using Autodesk.Navisworks.Api.Timeliner;
namespace NavisPythonShell.NpsRuntime
{
/// <summary>
Expand Down Expand Up @@ -144,6 +145,7 @@ public void SetupEnvironment(ScriptEngine engine, ScriptScope scope)
// reference Navisworks Api Document and Application
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Document).Assembly);
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Clash.ClashTest).Assembly);
engine.Runtime.LoadAssembly(typeof(Autodesk.Navisworks.Api.Timeliner.DocumentTimeliner).Assembly);
// also, allow access to the RPS internals
engine.Runtime.LoadAssembly(typeof(NavisPythonShell.NpsRuntime.ScriptExecutor).Assembly);
}
Expand Down
2 changes: 1 addition & 1 deletion PythonConsoleControl/PythonConsoleControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<OutputPath>bin\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<DebugType>Full</DebugType>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
Expand Down
Binary file added RefrencedAssemblies/Microsoft.CSharp.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added RefrencedAssemblies/Sim2023/lcclash.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added RefrencedAssemblies/Sim2024/lcclash.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added RefrencedAssemblies/Sim2025/lcclash.dll
Binary file not shown.
Binary file added RequiredLibraries/old/ICSharpCode.AvalonEdit.dll
Binary file not shown.
Binary file added RequiredLibraries/old/IronPython.Modules.dll
Binary file not shown.
Binary file added RequiredLibraries/old/IronPython.SQLite.dll
Binary file not shown.
Binary file added RequiredLibraries/old/IronPython.Wpf.dll
Binary file not shown.
Binary file added RequiredLibraries/old/IronPython.dll
Binary file not shown.
Binary file added RequiredLibraries/old/Microsoft.CSharp.dll
Binary file not shown.
Binary file added RequiredLibraries/old/Microsoft.Dynamic.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added RequiredLibraries/old/Microsoft.Scripting.dll
Binary file not shown.
Binary file not shown.
Binary file added RequiredLibraries/old/WPG.dll
Binary file not shown.
54 changes: 54 additions & 0 deletions Script Examples/CreateSearchSets_Timeliner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import datetime
# build period names from start to end
# set the periods from the beginning of the job to the end of the job
SearchFolderName = 'OPD_TimeLiner'
yr_beg = 2023
wk_beg = 51
yr_end = 2025
wk_end = 9
listof = []
for y in range(yr_beg, yr_end + 1):
if yr_beg == yr_end:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(wk_beg, wk_end + 1)]
elif y == yr_end:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(1, wk_end + 1)]
elif y == yr_beg:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(wk_beg, 53 + 1)]
else:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(1, 53 + 1)]
listof.append(wlist)

#confirm SearchFolderName doesn't already exist, rename _old
for ss in doc.SelectionSets.RootItem.Children:
if ss.DisplayName == SearchFolderName and ss.IsGroup:
doc.SelectionSets.EditDisplayName(ss, SearchFolderName + "_old")
# perhaps the old one should just be deleted

#create new "timeliner" folder at the end of the existing search sets
nextIndex = doc.SelectionSets.RootItem.Children.Count
savedFolder = FolderItem()
savedFolder.DisplayName = SearchFolderName

for y in listof:
yr = y[0]
yearFolder = FolderItem()
yearFolder.DisplayName = str(yr)
for wk in y[1:]:
# create another folder group for each year
s = Search()
# sc = SearchCondition.HasPropertyByDisplayName('OPD_LineList','SCHEDULED INSTALL')
# ABOVE IS CORRECT, BELOW IS FOR TESTING AND PROOF OF CONCEPT
sc = SearchCondition.HasPropertyByDisplayName('OPD_Schedule','SCHEDULED INSTALL')
oData = VariantData.FromDisplayString(wk)
sc = sc.EqualValue(oData)
s.SearchConditions.Add(sc)
s.Selection.SelectAll()
s.Locations = SearchLocations.DescendantsAndSelf
savedSet = SelectionSet(s)
savedSet.DisplayName = wk
yearFolder.Children.Add(savedSet)
savedFolder.Children.Add(yearFolder)

doc.SelectionSets.InsertCopy(nextIndex, savedFolder)


33 changes: 33 additions & 0 deletions Script Examples/CreateTimeLiner_Timeliner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from datetime import datetime
from datetime import timedelta

# build period names from start to end
# set the periods from the beginning of the job to the end of the job
yr_beg = 2023
wk_beg = 51
yr_end = 2025
wk_end = 9
listof = []
for y in range(yr_beg, yr_end + 1):
if yr_beg == yr_end:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(wk_beg, wk_end + 1)]
elif y == yr_end:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(1, wk_end + 1)]
elif y == yr_beg:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(wk_beg, 53 + 1)]
else:
wlist = [str(y)] + [str(y) + '.' + element.__str__() for element in range(1, 53 + 1)]
listof.append(wlist)


#create time timeler entries to match up with search sets and link
#need to identify week beginning and ending dates for planned start/end
# dtStart = datetime.datetime.strptime("")
for y in listof:
yr = y[0]
for wk in y[1:]:
d = wk
# d = "2024.1"
dtStart = datetime.strptime(d + '-1', "%Y.%W-%w") + timedelta(days=-1)
dtEnd = dtStart + timedelta(days=6)
print(dtEnd)
43 changes: 43 additions & 0 deletions Script Examples/CreateViewPoint_per_Area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Search
# first build a collection of objects that have an area.
# in order to get a list of all the areas available
# search doesn't work for custom categories, must iterate
areas = dict()
allItems = doc.Models.RootItemDescendantsAndSelf
for item in allItems:
prop = item.PropertyCategories.FindPropertyByDisplayName('OPD_LineList','Area')
if prop:
areaName = prop.Value.ToDisplayString()
if areaName not in areas.keys():
mic = ModelItemCollection()
mic.Add(item)
areas[areaName] = mic
else:
mic = areas[areaName]
mic.Add(item)
areas[areaName] = mic

for area, mic in areas.items():
# remove existing viewpoint if exists
vps = doc.SavedViewpoints.RootItem.Children
for svp in vps:
vpName = svp.DisplayName.ToString()
if (vpName == area):
doc.SavedViewpoints.Remove(svp)
# set all of model transparency
# might be worth seeing if the viewpoint can just be edited for items visibility instead of editing the model
doc.Models.OverrideTemporaryTransparency(doc.Models.RootItemDescendants,50)
# set for current area to no transparency
doc.Models.OverrideTemporaryTransparency(mic,0)
bbc = mic.BoundingBox().Center
nvp = Viewpoint()
nvp.Position = bbc
vt = Vector3D(0,1,0)
nvp.AlignDirection(vt)
nvp.RenderStyle.Shaded
nvp.HeightField = 0.872657
svp = SavedViewpoint(nvp)
svp.DisplayName = area
print svp.DisplayName
doc.SavedViewpoints.AddCopy(svp)

39 changes: 39 additions & 0 deletions Script Examples/CreateViewPoint_per_NWC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Search
s = Search()
s.Selection.SelectAll()
# variant needed for equals Value
# oData = VariantData.FromDisplayString('Rooms')
sc1 = SearchCondition.HasPropertyByDisplayName("Item","Name")
# oSearchCondition = oSearchCondition.EqualValue(oData)
sc1 = sc1.DisplayStringContains('.nwc')
s.SearchConditions.Add(sc1)
a = s.FindAll(doc,False)

# Create Collection and fill it with the items found
modelItems = ModelItemCollection()
a.CopyTo(modelItems)

# Loop through collection of found items
for item in modelItems:
# Get some properties to build the view name later
# This would change for OPD use case
#number = item.PropertyCategories.FindPropertyByDisplayName('Element', 'Number')
#strnumb = number.Value.ToDisplayString()
name = item.PropertyCategories.FindPropertyByDisplayName ('Item', 'Name')
strname = name.Value.ToDisplayString()
# This next pert is locating the camera, so if we're focusing on an item,
# then OPD will again need to tweak this section to put the camera
# in the correct location and orientation
bbc = item.BoundingBox().Center
nvp = Viewpoint()
nvp.Position = bbc
vt = Vector3D(0,1,0)
nvp.AlignDirection(vt)
nvp.RenderStyle.Shaded
nvp.HeightField = 0.872657
# Save the settings to a view
svp = SavedViewpoint(nvp)
#svp.DisplayName = strnumb + " " + strname
svp.DisplayName = strname
print svp.DisplayName
doc.SavedViewpoints.AddCopy(svp)
2 changes: 2 additions & 0 deletions Script Examples/PrintBaseFiles(from NWD).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for model in doc.Models.First.RootItem.Children:
print(model.DisplayName)
2 changes: 2 additions & 0 deletions Script Examples/PrintBaseFiles(from NWF).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for model in doc.Models:
print(model.FileName)
5 changes: 5 additions & 0 deletions Script Examples/PrintBaseSourceFileName(from NWD).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
for model in doc.Models.First.RootItem.Children:
prop = model.PropertyCategories.FindPropertyByDisplayName("Item","Source File Name")
sourcefile_long = prop.Value.ToString()
sourceFileName = sourcefile_long.Replace("DisplayString:", "")
print(sourceFileName)