I am looking to export .nwc for all project locations possible.
The code runs with no errors but the .nwc is not exported.
Please do share your view on this code.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
import math
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
# Get the current project location
project_location = doc.ActiveProjectLocation
# Get the new location list from input
new_location_list = UnwrapElement(IN[0])
# Initialize a list to store the exported file paths
exported_files = []
#coll = FilteredElementCollector(doc).OfClass(ProjectLocation)
output = []
path = IN[1]
name = IN[2]
view = UnwrapElement(IN[3])
ChooseCoordinates = IN[5]
Linksbool = IN[6]
i=0
# Start a transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for new_location in new_location_list:
name1 = name[i]
#Set the new project position
project_location.SetProjectPosition(XYZ.Zero, new_location_list[i])
location=new_location_list[i]
#path = Autodesk.Revit.DB.FilePath(pathName)
Options = Autodesk.Revit.DB.NavisworksExportOptions()
Options.ExportScope = NavisworksExportScope.View
Options.ViewId = view.Id
Options.ExportLinks = Linksbool
Options.Coordinates = ChooseCoordinates
Options.ExportParts = False
Options.ExportElementIds = True
Options.ConvertElementProperties = True
Options.ExportRoomAsAttribute = True
Options.ExportRoomGeometry = True
Options.ExportUrls = True
Options.DivideFileIntoLevels = False
Options.FindMissingMaterials = True
doc.Export(path, name1, Options)
i += 1
exported_files.append(name1)
#TransactionManager.Instance.EnsureInTransaction(doc)
TransactionManager.Instance.TransactionTaskDone()
doc.Regenerate()
# OUT = dir(Autodesk.Revit.DB.NavisworksExportOptions.ExportScope)
OUT = exported_files