Hi,
I’d be appreciated if anyone could help/advise on why am I getting the “expected an indented block” error. Code below.
Thanks in advance.
Import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
FilesToIssue = IN[0]
if not isinstance(FilesToIssue,list):
FilesToIssue = [FilesToIssue]
DestinationFolder = IN[1]
options = OpenOptions()
options.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
worksharingOptions = WorksharingSaveAsOptions()
worksharingOptions.SaveAsCentral = True
SaveOptions = SaveAsOptions()
SaveOptions.SetWorksharingOptions(worksharingOptions)
tOptions = TransactWithCentralOptions()
rOptions = RelinquishOptions(False)
rOptions.StandardWorksets = True
rOptions.ViewWorksets = True
rOptions.FamilyWorksets = True
rOptions.UserWorksets = True
rOptions.CheckedOutElements = True
sOptions = SynchronizeWithCentralOptions()
sOptions.SetRelinquishOptions(rOptions)
sOptions.Compact = True
sOptions.SaveLocalBefore = True
sOptions.SaveLocalAfter = True
RestOfSheets = []
splashscreen = []
for file in FilesToIssue:
modelpath = FilePath(file)
FileName = file.split("\\")[-1]
newdoc = app.OpenDocumentFile(FilePath(file),options)
newdoc.SaveAs(DestinationFolder+"\\"+FileName,SaveOptions)
viewscollector = FilteredElementCollector(newdoc)
views = viewscollector.OfCategory(BuiltInCategory.OST_Views).ToElementIds()
sheetscollector = FilteredElementCollector(newdoc)
sheets = sheetscollector.OfCategory(BuiltInCategory.OST_Sheets).ToElementIds()
for sheet in sheets:
if sheet.Name =! "Splash Screen":
RestOfSheets.append(sheet)
TransactionManager.Instance.EnsureInTransaction(newdoc)
newdoc.Delete(views)
newdoc.Delete(RestOfSheets)
TransactionManager.Instance.ForceCloseTransaction()
newdoc.SynchronizeWithCentral(tOptions,sOptions)
newdoc.Close(False)
OUT = views, sheets, list