Is there any way to select all elements of an scope box?
I need it to select those elements and set a parameter by zone
Im not the author of the Python script… i ll link as soon as i found the original post.
import clr clr.AddReference('RevitAPI') clr.AddReference('System') clr.AddReference('RevitNodes') clr.AddReference('RevitServices') import Revit import RevitServices from Autodesk.Revit.DB import * from System.Collections.Generic import List from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) doc = DocumentManager.Instance.CurrentDBDocument #Functions for list handling def ProcessList(_func, _list): return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list ) #Preparing input from dynamo to revit def ToRevit(item): return item.ToRevitType(True) if isinstance(IN, list): bblist = ProcessList(ToRevit, IN) else: bblist = [ToRevit(IN)] def collectElementsInBB(bb): outline = Outline(bb.Min, bb.Max) filter = BoundingBoxIntersectsFilter(outline) collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter) return [e.ToDSType(True) for e in collector] OUT = ProcessList(collectElementsInBB, bblist)
I wanted to point out that using that method results in an “axis aligned bounding box”. Which is what Revit always gives you. This is worth consideration if your scope box or whatever element is not orthogonal.
So an angled element results in the following bounding box:
Which then yields the following result:
Just thought I would share because I have struggled through that many times. As for how to make this work as expected on scope boxes; that I am not sure of.
Good to point out! I didnt even know.
I like to use the Polygon Containment method
Whatever Konrad says!
Maybe you could use the bounding box to define the 3D extents?
Thanks for your awesome work!
Woah! Classic john’s answer from 2016 coming back at me! lol
So if i understand:
Polygon for outline and Height from scopebox?
I’m not at a PC right now, so I can’t be certain it works, but it sounds worth a quick try…
That should get you going! I would say to poke at it and report back with your progress.
Bedtime right now… Will get back with a graph tomorrow
Use the bb min to create a plane, pull the curves to that, extrude curve as solid by the bb max and see what’s inside it…
I had a go here but with areas… Get elements inside an area
The complexity was things like walls which are partly inside (and have a line for a location) so it depends if you want those or not.
Hope that helps,
Here is my graph so far, any help would be greatly appriciated
Just to get you going I’ve set it to run in an active (3D) view…InsideScopeBox.dyn (30.5 KB)
Geometry within a boundary & Geometry outside another geometry
Im glad it worked for you. But like @john_pierson said in post 3: be carefull with not orthogonal elements / scopeboxes.
see the picture i posted in post 12. this will explain the difference between the area of elements that will be selected and the actual scopebox. (scopebox = green line, area of selected elements = blue line.)
Basicly my solution only works for non rotated scopeboxes
Don´t worry I have only ortogonal scope boxes.