Revit.Dynamo.Python.CPython3 Schedules on sheets

 Python for placed schedules on sheets - returns 

  • Schedule Name
  • Sheet Name
  • Sheet Number
  • Schedule name for schedules not placed on sheets
#!python3 ##Code pre-directive untested! ##Apsis0215 R Allen 2022-09-28 CPy3 import clr clr.AddReference("RevitServices") from RevitServices.Persistence import DocumentManager doc = DocumentManager.Instance.CurrentDBDocument ##Current Document import Revit from Autodesk.Revit.DB import FilteredElementCollector,ScheduleSheetInstance,ViewSchedule PlacedSchedules = FilteredElementCollector(doc).OfClass(ScheduleSheetInstance).WhereElementIsNotElementType().ToElements() PlacedSchedulesName = [PSS.Name for PSS in PlacedSchedules] PlacedSchedulesID=[VID.ScheduleId for VID in PlacedSchedules] AllSchedules = FilteredElementCollector(doc).OfClass(ViewSchedule).WhereElementIsNotElementType().ToElements() AllSchedulesID =[VID.Id for VID in AllSchedules] ##https://stackoverflow.com/questions/33577790/exclude-items-from-list-of-lists-python SchedNotPlaced=[element for element in AllSchedulesID if element not in PlacedSchedulesID] SchedNotPlaced=[doc.GetElement(VSHID) for VSHID in SchedNotPlaced] SchedNotPlacedName=[NPS.Name for NPS in SchedNotPlaced] HostSheet = [doc.GetElement(VID.get_OwnerViewId()) for VID in PlacedSchedules] ##Get host sheet for each schedsheet HostSheetName=[HS.Name for HS in HostSheet] ##REturn host sheet name for HostSheetNumber=[] HostSheetNumber=[HS.get_SheetNumber() for HS in HostSheet] ##REturn host sheet name for OUT=PlacedSchedulesName,HostSheetName,HostSheetNumber,SchedNotPlacedName ##PlacedSchedulesIDs,AllSchedulesID

Comments

Popular posts from this blog

Revit area plans adding new types and references (Gross and rentable)

Powerpoint countdown and current time in slides VBA

Revit 2019 and up tab colorizer