Hi All ,
So what I need to do is change the project location and export to Navisworks for 150 files.
I am taking this in two steps ,
- create a scrip that changes the Project location and exports the file to NWC.
- automate the script to run on 150 files in a folder.
Step 1
I have two scripts , One changes the Project location the other exports the model to NWC, both scripts work fine when run Separately, but when I combine the scripts (as seen in the image below) to change the project location and export to NWC it doesn’t export to NWC.
I’m not sure what I am doing wrong, any help is much appreciated.
The python Code in the Change Location is :
import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import*
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
pls = FilteredElementCollector(doc).OfClass(ProjectLocation).ToElements()
TransactionManager.Instance.EnsureInTransaction(doc)
for pl in pls:
if pl.Name == IN[0]:
doc.ActiveProjectLocation = pl
break
else:
continue
TransactionManager.Instance.TransactionTaskDone()
OUT = doc.ActiveProjectLocation
the python code to export is :
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import*
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import*
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
import System
from System.Collections.Generic import *
doc = DocumentManager.Instance.CurrentDBDocument
folder = IN[0]
collector = FilteredElementCollector(doc).OfClass(View)
options = NavisworksExportOptions()
options.ExportScope = NavisworksExportScope.View
for view in collector:
if (view.ViewType == ViewType.ThreeD and view.Name.Contains("Navisworks")):
options.ViewId = view.Id
doc.Export(folder, "Export-" + view.Name + ".nwc", options)
OUT = "Success"