Skip to content

Instantly share code, notes, and snippets.

@alvpickmans
Created April 23, 2018 10:47
Show Gist options
  • Save alvpickmans/aab2e25275423d57e69dc5677dee9d11 to your computer and use it in GitHub Desktop.
Save alvpickmans/aab2e25275423d57e69dc5677dee9d11 to your computer and use it in GitHub Desktop.
Dynamo Script to retrieve all elements by category and view from Revit.
# To be pasted in a Dynamo Python Script node.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
import System
doc = DocumentManager.Instance.CurrentDBDocument
category = UnwrapElement(IN[0])
bic = System.Enum.ToObject(BuiltInCategory, category.Id.IntegerValue)
view = UnwrapElement(IN[1])
OUT = FilteredElementCollector(doc, view.Id).OfCategory(bic).ToElements()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment