from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
active_view = doc.ActiveView
active_level = doc.ActiveView.GenLevel
all_title_blocks = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory.OST_TitleBlocks)\
.WhereElementIsElementType().ToElements()
if not all_title_blocks:
import sys
print('There are no TitleBlocks in the Project! \nPlease Try Again')
sys.exit()
selected_title_block = all_title_blocks[0]
with Transaction(doc,'Create Drafting') as t:
t.Start()
new_sheet = ViewSheet.Create(doc, selected_title_block.Id)
t.Commit()
__author__ = '🙋♂️ Erik Frits'