pyRevit

Code

Library

Create View: ViewDrafting

# -*- coding: utf-8 -*-
#โฌ‡ IMPORTS
from Autodesk.Revit.DB import *

#๐Ÿ“ฆ VARIABLES
doc          = __revit__.ActiveUIDocument.Document
active_view  = doc.ActiveView
active_level = doc.ActiveView.GenLevel

#๐ŸŽด ALL VIEW TYPES
view_types = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()

#๐Ÿ”Ž FILTER VIEW TYPES
view_types_drafting = [vt for vt in view_types if vt.ViewFamily == ViewFamily.Drafting]
view_type_drafting  = view_types_drafting[0]

#๐ŸŽฏ Create Drafting View
with Transaction(doc,'Create Drafting') as t:
    t.Start()

    view =  ViewDrafting.Create(doc, view_type_drafting.Id)
    t.Commit()

__author__ = '๐Ÿ™‹โ€โ™‚๏ธ Erik Frits'

โŒจ๏ธ Happy Coding!
Erik Frits