FindInserts Determines Void Instances Cutting Floor

Is it hot enough for you?

It sure is for this guy:

Melted candle

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:

Void instances cutting floor

Second case – area = 607.558m2 and Volume = 243.023m3:

Void instances cutting floor

Family parameter "Cut with Voids When Loaded":

Void instances cutting floor

FamilyInstance cutting host:

Void instances cutting floor

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( typeofFamilyInstance ) )
      .WherePasses( new ElementIntersectsSolidFilter( 
        solid ) );

  int n1 = intersectingInstances.Count<Element>();

  intersectingInstances 
    = new FilteredElementCollector( doc )
      .OfClass( typeofFamilyInstance ) )
      .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( falsefalsefalsetrue )
      .ToList();

Response: I have done some tests and here are my results:

Void instances cutting floor

Situation:

Results:

  1. Do not cut geometry:
  2. Cut geometry:

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 ;)