Hello all,
With Dynamo & python I want to collect all walls which crossing a line. This line will be created by two points by user input. Just two clicks on the screen. I don’t want to use the Element.Geometry because that action is very slow with a large number of walls.
Can someone help me out? Thanx in advance.
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import TaskDialog
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
TransactionManager.Instance.EnsureInTransaction(doc)
TaskDialog.Show("DynamoScripts", "Select two Points.")
userpoint1 = uidoc.Selection.PickPoint()
userpoint2 = uidoc.Selection.PickPoint()
line = Line.CreateBound(userpoint1, userpoint2)
coll = FilteredElementCollector(doc, doc.ActiveView.Id)
filt = ElementCategoryFilter(BuiltInCategory.OST_Walls)
walls = coll.WherePasses(filt).ToElements()
OUT = line, walls