Last active
July 15, 2024 17:54
-
-
Save johnpierson/e4cc0e730a08b72b517f329f887701ef to your computer and use it in GitHub Desktop.
This is a python script for Dynamo that allows you to collect all model elements in a Revit model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#license https://choosealicense.com/licenses/bsd-3-clause/ | |
import clr | |
# Import DocumentManager and TransactionManager | |
clr.AddReference("RevitServices") | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
# Import RevitAPI | |
clr.AddReference("RevitAPI") | |
import Autodesk | |
from Autodesk.Revit.DB import FilteredElementCollector | |
# our current document and model elements | |
doc = DocumentManager.Instance.CurrentDBDocument | |
allElements = FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements() | |
# lists to use for results, faillist is if we ever need it | |
modelElements = [] | |
failList = [] | |
# iterate through the elements and see if it has model characteristics | |
for i in allElements: | |
try: | |
if i.Category.HasMaterialQuantities: | |
modelElements.append(i) | |
except: | |
failList.append(i) | |
# output the model elements | |
OUT = modelElements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment