Inconsistent Intersection Results with BooleanOperationsUtils and Face.Intersect in Revit API

Inconsistent Intersection Results with BooleanOperationsUtils and Face.Intersect in Revit API

b0166408
Participant Participant
363 Views
3 Replies
Message 1 of 4

Inconsistent Intersection Results with BooleanOperationsUtils and Face.Intersect in Revit API

b0166408
Participant
Participant

 

I'm facing a challenge with the Revit API and would like to share it to see if anyone can offer guidance or a solution. I encountered an issue when trying to check the intersection between two elements using two different approaches, but both are returning inconsistent results.

  1. With BooleanOperationsUtils: When using the BooleanOperationsUtils.ExecuteBooleanOperation(solid1, solid2, BooleanOperationsType.Intersect) function, even when the two elements (solid1 and solid2) are physically distant from each other and clearly do not intersect, the function returns a volume greater than zero. This suggests that the elements are intersecting, which is incorrect given their current positions.

  2. With Face.Intersect: Alternatively, I tried using the Face.Intersect(face) method for the same verification. Surprisingly, this method also presents a false positive, indicating intersection between elements that do not even touch, being very distant from each other.

 
BooleanOperationsUtils.ExecuteBooleanOperation(solid1, solid2, BooleanOperationsType.Intersect);
 
And
 
 Face.Intersect(Face)
 

I am looking for insights on the following:

  1. Has anyone faced similar issues when working with the Revit API using these functions?
  2. Are there specifics in using BooleanOperationsUtils or Face.Intersect that I might be overlooking?
  3. Are there any alternative approaches to check for the intersection between two solids or faces that do not intersect?

I greatly appreciate any help or guidance the community can offer in advance!

b0166408_1-1711113528518.png

 

0 Likes
364 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

I rather doubt what you say. Are you sure that the objects really are in different distant locations? Maybe your intersection is not happening between the objects in the project space, e.g., family instances, but between associated objects in a family definition, e.g., between family symbol geometry?

  

If you are absolutely certain that the objects and the solids and faces that you are intersecting are totally disjunct, can you please provide a complete minimal reproducible case for the development team to analyse to determine what is going wrong?

  

  

Thank you.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

ricaun
Advisor
Advisor

Probably you are selecting the wrong Solid to compare, as @jeremy_tammik mentioned if you are selecting the family symbol Solid would explain the problem.

 

One thing you could do is convert the solid to a DirectyShape: https://gist.github.com/ricaun/d21f48896cd3e9061f359de07d8619fc

 

Document document;
Solid solid;
DirectShapeUtils.Create(document, solid);


This going to create a DirectShape with a solid and you can find in your model where the solid result is located.

 

The interesting part is that it is possible to create a DirectShape with an empty solid.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 4 of 4

TripleM-Dev.net
Advisor
Advisor

Hi @b0166408,

 

I have several functions that rely heavily on BooleanOperationsUtil, only issue I ran into, on occasion, with it is when the resulting solid has small parts (Revit limit of lines being <0.7mm, or in that order), which throws a error.

 

I suspect it lies in how you retrieve the solids to test on, inspect their coordinates or generate directshapes as @ricaun mentions.

0 Likes