from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
active_view = doc.ActiveView
active_level = doc.ActiveView.GenLevel
view_types = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()
view_types_plans = [vt for vt in view_types if vt.ViewFamily == ViewFamily.FloorPlan]
floor_plan_type = view_types_plans[0]
with Transaction(doc,'Create Floor Plan') as t:
t.Start()
view = ViewPlan.Create(doc, floor_plan_type.Id, active_level.Id)
t.Commit()
__author__ = '🙋♂️ Erik Frits'