Greetings,
Im having a problem with the BoundingBoxIntersectsFilter returning elements of which do not appear to intersect with the BoundingBox. Using a BoundingBoxIntersectsFilter from BoundingBox created from endpoints 0 and 1 from conduit A below, always returns intersecting with conduit B shown below.
In this case, I am using conduit.Location.Curve.GetEndpoint() to get point 0 and 1 from conduit A. Then I create an Outline from each of those points like so, Outline(point0, point0), and Outline(point1, point1)
After running the FilteredElementCollector i receive the expected elements in addition to the unexpected conduit B.
I resorted to looping through all of the elements returned and using conduitPoint0or1.DistanceTo(returned elements point) and then removing any from the list that are more than x distance and this conduit B always comes up as intersecting. No matter how low i make the distance, the FilteredElementCollector will return nothing, except this one conduit B.
Any help would be stellar. I will attach my code if that helps some with context.
Thanks so much.
import System
from System import Array
from System.Collections.Generic import *
view = doc.ActiveView
#get all conduit and electrical fixtures in given view
cat_list = [BuiltInCategory.OST_Conduit,BuiltInCategory.OST_ElectricalFixtures,BuiltInCategory.OST_ElectricalEquipment,BuiltInCategory.OST_ConduitFitting]
typed_list = List[BuiltInCategory](cat_list)
filter = ElementMulticategoryFilter(typed_list)
assemblyel = FilteredElementCollector(doc,view.Id).WherePasses(filter).ToElements()
assemblyids = FilteredElementCollector(doc,view.Id).ToElementIds()
cpointlist = []
try:
for i in assemblyel:
if i.Category.Name == 'Conduits':
cpointlist.append(i.Location.Curve.GetEndPoint(0))
cpointlist.append(i.Location.Curve.GetEndPoint(1))
else:
continue
except:
print('error error error')
def gcinter(points):
ac = []
for p in points:
ol = Outline(p,p)
bbfilter = BoundingBoxIntersectsFilter(ol)
bbfilter.Tolerance = 0.125
collector = FilteredElementCollector(doc).WherePasses(filter)
ids = [doc.ActiveView.Id]
ids.extend(assemblyids)
id = List[ElementId](ids)
intersects = collector.Excluding(id).WherePasses(bbfilter).ToElements()
intersects = [doc.GetElement(x.AssemblyInstanceId).Name for x in intersects]
if len(intersects) != 0: ac.append([p,intersects])
return ac
Solved! Go to Solution.
Greetings,
Im having a problem with the BoundingBoxIntersectsFilter returning elements of which do not appear to intersect with the BoundingBox. Using a BoundingBoxIntersectsFilter from BoundingBox created from endpoints 0 and 1 from conduit A below, always returns intersecting with conduit B shown below.
In this case, I am using conduit.Location.Curve.GetEndpoint() to get point 0 and 1 from conduit A. Then I create an Outline from each of those points like so, Outline(point0, point0), and Outline(point1, point1)
After running the FilteredElementCollector i receive the expected elements in addition to the unexpected conduit B.
I resorted to looping through all of the elements returned and using conduitPoint0or1.DistanceTo(returned elements point) and then removing any from the list that are more than x distance and this conduit B always comes up as intersecting. No matter how low i make the distance, the FilteredElementCollector will return nothing, except this one conduit B.
Any help would be stellar. I will attach my code if that helps some with context.
Thanks so much.
import System
from System import Array
from System.Collections.Generic import *
view = doc.ActiveView
#get all conduit and electrical fixtures in given view
cat_list = [BuiltInCategory.OST_Conduit,BuiltInCategory.OST_ElectricalFixtures,BuiltInCategory.OST_ElectricalEquipment,BuiltInCategory.OST_ConduitFitting]
typed_list = List[BuiltInCategory](cat_list)
filter = ElementMulticategoryFilter(typed_list)
assemblyel = FilteredElementCollector(doc,view.Id).WherePasses(filter).ToElements()
assemblyids = FilteredElementCollector(doc,view.Id).ToElementIds()
cpointlist = []
try:
for i in assemblyel:
if i.Category.Name == 'Conduits':
cpointlist.append(i.Location.Curve.GetEndPoint(0))
cpointlist.append(i.Location.Curve.GetEndPoint(1))
else:
continue
except:
print('error error error')
def gcinter(points):
ac = []
for p in points:
ol = Outline(p,p)
bbfilter = BoundingBoxIntersectsFilter(ol)
bbfilter.Tolerance = 0.125
collector = FilteredElementCollector(doc).WherePasses(filter)
ids = [doc.ActiveView.Id]
ids.extend(assemblyids)
id = List[ElementId](ids)
intersects = collector.Excluding(id).WherePasses(bbfilter).ToElements()
intersects = [doc.GetElement(x.AssemblyInstanceId).Name for x in intersects]
if len(intersects) != 0: ac.append([p,intersects])
return ac
Solved! Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
Solved by 1240904365. Go to Solution.
There is one caveat to the use of BoundingBoxIntersectsFilter:
in this case you will filter the unwanted elements
There is one caveat to the use of BoundingBoxIntersectsFilter:
in this case you will filter the unwanted elements
Yes as @1240904365 noted the outline is parallel to model coordinate system and not the conduit.
In your case although the outline you have constructed is in effect a vertical line this is being checked again the bounding box of B as noted below:
After roughly checking for intersections with this quick filter you can then use other means such as ElementIntersectsElementFilter or ElementIntersectsSolidFilter (slow filters).
This limits the amount of elements you have to compare using a slow filter.
Yes as @1240904365 noted the outline is parallel to model coordinate system and not the conduit.
In your case although the outline you have constructed is in effect a vertical line this is being checked again the bounding box of B as noted below:
After roughly checking for intersections with this quick filter you can then use other means such as ElementIntersectsElementFilter or ElementIntersectsSolidFilter (slow filters).
This limits the amount of elements you have to compare using a slow filter.
Thanks for the answer, and extended explanation. Just to clarify, the BoundingBoxIntersectsFilter filters for intersection of a specified Outline with other elements BoundingBox or element geometry?
Thanks for the answer, and extended explanation. Just to clarify, the BoundingBoxIntersectsFilter filters for intersection of a specified Outline with other elements BoundingBox or element geometry?
Can't find what you're looking for? Ask the community or share your knowledge.