Hi,
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
There is.
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[0], list):
bblist = ProcessList(ToRevit, IN[0])
else:
bblist = [ToRevit(IN[0])]
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.
Hey John,
I like to use the Polygon Containment method
How to see what elements are in which scope box
Whatever Konrad says!
Maybe you could use the bounding box to define the 3D extents?
Thanks for your awesome work!
Mark
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,
Mark
@john_pierson @Mark.Ackerley Cant really find a way how to get this to work…
The green outline is my scopebox and the blue outline is the solid i manage to create with Dynamo.
Here is my graph so far, any help would be greatly appriciated
Try this…
Just to get you going I’ve set it to run in an active (3D) view…
InsideScopeBox.dyn (30.5 KB)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.
Hello,
If I search for all the rooms in a scope box, I get an empty list.
How can I fix it?
Thanks!
Thanks for sharing this.
I am having issue with elements which are in multiple scope box.
I.E. element which is 70% in the scope box 1 and 30% in the scope box 2. I want to assign that element to scope box 1 (by majority of %).
please help me.
Could you please help me to apply same thing for element in multiple scope boxes.
Element goes to whichever scope box has majority of element.
thanks,