Is it hot enough for you?
It sure is for this guy:
Time for some rest and recuperation, meseems...
Before that, let me share another brilliant and super succinct solution provided by Fair59, answering
the Revit API discussion forum thread on how
to get cutting void instances in the floor using
the HostObject
FindInserts
method:
Question: I have a floor on which a family instance is inserted on the face of the floor (the instance host is also the floor).
I checked in the family the "Cut with Void When Loaded" parameter, so that the void is created in the floor.
Now, I want to retrieve all the instances that create voids in the floor.
I did some research, and found the discussion
of Boolean operations and InstanceVoidCutUtils
.
But when I use the InstanceVoidCutUtils
GetCuttingVoidInstances
method, it returns an empty list.
I also looked
at the ElementIntersectsSolidFilter
problem and solution and
tried ElementIntersectsElementFilter
and ElementIntersectsSolidFilter
.
Those filters do not return the expected result for me to deduce the voids in the floor either; in fact, they say that no elements intersect.
First case – area = 607.558m2 and Volume = 243.023m3:
Second case – area = 607.558m2 and Volume = 243.023m3:
Family
parameter "Cut with Voids When Loaded":
FamilyInstance
cutting host:
Here is the code I use:
Solid solid = floor.get_Geometry( new Options() ) .OfType<Solid>() .Where<Solid>( s => (null != s) && (!s.Edges.IsEmpty) ) .FirstOrDefault(); FilteredElementCollector intersectingInstances = new FilteredElementCollector( doc ) .OfClass( typeof( FamilyInstance ) ) .WherePasses( new ElementIntersectsSolidFilter( solid ) ); int n1 = intersectingInstances.Count<Element>(); intersectingInstances = new FilteredElementCollector( doc ) .OfClass( typeof( FamilyInstance ) ) .WherePasses( new ElementIntersectsElementFilter( floor ) ); int n = intersectingInstances.Count<Element>();
Here, both n
and n1
are equal to 0.
Answer: Try using
the HostObject
FindInserts
method instead:
HostObject floor; List<ElementId> intersectingInstanceIds = floor.FindInserts( false, false, false, true ) .ToList();
Response: I have done some tests and here are my results:
Situation:
Fl_1
is hosted by Level 3 and intersects the floor.Fl_2
is hosted by the floor and intersects it.Results:
InstanceVoidCutUtils.GetCuttingVoidInstances(floor)
returns void
floor.FindInserts(false,false,false,true)
returns Fl_2
InstanceVoidCutUtils.GetCuttingVoidInstances(floor)
returns Fl_1
floor.FindInserts(false,false,false,true)
returns both Fl_1
and Fl_2
In summary, FindInserts
returns FI_1
even if its host (Level 3) is not the floor.
It's good.
I think we can say that the problem is solved.
Thank you FAIR59 ;)