create view 3d dynamo revit
if isinstance(IN[0], list):
files = IN[0]
else:
files = [IN[0]]
NewName = "_detached"
options = OpenOptions()
options.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
worksharingOptions = WorksharingSaveAsOptions()
worksharingOptions.SaveAsCentral = True
SaveOptions = SaveAsOptions()
SaveOptions.SetWorksharingOptions(worksharingOptions)
for file in files:
modelpath = FilePath(file)
newdoc = app.OpenDocumentFile(modelpath,options)
collector = FilteredElementCollector(newdoc)
viewTypeColl = collector.OfClass(ViewFamilyType)
for i in viewTypeColl:
if i.ViewFamily == ViewFamily.ThreeDimensional:
viewType = i
else:
continue
newfile = file[:-4] + NewName + ".rvt"
TransactionManager.Instance.EnsureInTransaction(newdoc)
view = View3D.CreateIsometric(newdoc, viewType.Id)
#view.Name = viewName
TransactionManager.Instance.ForceCloseTransaction()
newdoc.SaveAs(newfile,SaveOptions)
newdoc.Close(True)
OUT = 0