Keynote types

 Determine types of user keynotes - essential in model checking as 'User keynotes' should be zero to a few on any given project.


Uses FEC (Filtered element collector) to gather all keynote tags and looks at the instance parameter to determine the type.
GPT Tweak to export as list counts:
# Load the required libraries import clr clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager clr.AddReference("RevitAPI") from Autodesk.Revit.DB import * # Access the current Revit document doc = DocumentManager.Instance.CurrentDBDocument # Define the categories for User, Element, and Material keynotes keynoteCategories = { "User": "User", "Element": "Element", "Material": "Material" } # Initialize counters for each category categoryCounts = {category: 0 for category in keynoteCategories} # Get all Keynote Tags keyNoteTags = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_KeynoteTags).WhereElementIsNotElementType().ToElements() # Loop through Keynote Tags and categorize them for tag in keyNoteTags: keySource = tag.LookupParameter("Key Source") if keySource is not None: keySourceValue = keySource.AsValueString() for category, keyword in keynoteCategories.items(): if keyword in keySourceValue: categoryCounts[category] += 1 # Output the counts for each category OUT = categoryCounts

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