Create SheetSet from Sheet grouping

Here’s a quick python node that lets you create sheet sets.

SheetSet

 

 

 

 

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

sheets = IN[0]
sheetSetName = IN[1]

viewSet = ViewSet()

msg = “Failed to create sheet set.”

try to add all of the sheets to the set

try:
for vs in sheets:
view = UnwrapElement(vs)
viewSet.Insert(view)

If there’s one item in the set, just add the one

except:
view = UnwrapElement(sheets)
viewSet.Insert(view)

Get the printmanager to add the view set to.

printManager = doc.PrintManager
printManager.PrintRange = PrintRange.Select

create the ViewSheetSetting to append the viewset.

viewSheetSetting = printManager.ViewSheetSetting
viewSheetSetting.CurrentViewSheetSet.Views = viewSet

Create the Sheet Set

trans = Transaction(doc, “Create View/Sheet Set”)
trans.Start()
try:
viewSheetSetting.SaveAs(sheetSetName)
msg = “Sheet set '” + sheetSetName + “’ created.”
except:
msg = “Failed to create sheet set”
trans.Commit()

#Assign your output to the OUT variable
OUT = msg

1 Like