Create View Sheet

# -*- coding: utf-8 -*-
#⬇ IMPORTS
from Autodesk.Revit.DB import *

#📦 VARIABLES
doc          = __revit__.ActiveUIDocument.Document
active_view  = doc.ActiveView
active_level = doc.ActiveView.GenLevel

#🎴 ALL TITLE BLOCKS
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]


#🎯 Create Drafting View
with Transaction(doc,'Create Drafting') as t:
    t.Start()

    new_sheet = ViewSheet.Create(doc, selected_title_block.Id)
    t.Commit()

__author__ = '🙋‍♂️ Erik Frits'

⌨️ Happy Coding!
Erik Frits