Boolean Operation Fail

Boolean Operation Fail

marcelo_quevedo
Contributor Contributor
24,197 Views
62 Replies
Message 1 of 63

Boolean Operation Fail

marcelo_quevedo
Contributor
Contributor

Hello,

The core of our application works with solid operations between solids, and we constantly faced Boolean operation issues by using the ExecuteBooleanOperation() API method. It throws the next exception that doesn’t allow to do the Boolean operation.

 

“Failed to perform the Boolean operation for the two solids. This may be due to geometric inaccuracies in the solids, such as slightly misaligned faces or edges. If so, eliminating the inaccuracies by making sure the solids are accurately aligned may solve the problem. This also may be due to one or both solids having complexities such as more than two faces geometrically meeting along a single edge, or two coincident edges, etc. Eliminating such conditions, or performing a sequence of Boolean operations in an order that avoids such conditions, may solve the problem.”

 

I created a simple C# sample with a command that allows to do a Boolean operation between two solids. Also, I have attached two Revit files. Each file contains two intersected directShape objects. Using the C# sample and those files you could reproduce the issue by trying to do a Boolean operation between the two objects.

 

We will be very grateful if you could help us with some directions to solve the issue, and it would be great if you take into consideration this API issue for the future Revit APIs.

 

Thanks a lot, in advance!

Marcelo

 

24,198 Views
62 Replies
Replies (62)
Message 21 of 63

tommy.stromhaug
Contributor
Contributor

Hi Jeremy,

 

No, it is not possible to solve this with clipper.

I use clipper whenever i can 🙂

 

Tommy

Symetri Norway

0 Likes
Message 22 of 63

Anonymous
Not applicable

Hi,

 

Excuse me, where does the variable "trans" come from

0 Likes
Message 23 of 63

Anonymous
Not applicable
Excuse me, where does the variable "trans" come from
0 Likes
Message 24 of 63

jeremy_tammik
Alumni
Alumni

It seems to come from:

 

  using (Transaction trans = new Transaction(document))
  ...

 

See above...

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 25 of 63

chinhung77
Participant
Participant

Is there any progress on this question now? Or is it possible to introduce 3D Boolean operation libraries similar to Clipper.

Message 26 of 63

tommy.stromhaug
Contributor
Contributor

Hi,

 

Here is one possibility, https://dev.opencascade.org/. It is written in c++, but there exist a wrapper for c#.

Boolean operations is not easy, but i think this algorithm is more robust than the one implemented in Revit.

I see that problems in Revit is not a problem in Dynamo for instance.

Now, i have to "translate" my solid to OpenCascade solids and do the boolean operations. This i have tested.

Then, my plan is to rebuild the solids in Revit with one of the ShapeBuilders. I have not had time to test the last step yet.

Message 27 of 63

jeremy_tammik
Alumni
Alumni

That's a very exciting project. Thank you for sharing. I would love to see the final result. Good luck implementing this!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 28 of 63

tommy.stromhaug
Contributor
Contributor

Hi

 

I Will update and share code as soon as possible. 

Message 29 of 63

antonio_hipolito
Enthusiast
Enthusiast

Hi there,

 

That's true, I'm dealing with a solid intersection that REVIT API cannot perform while Dynamo performs well.

 

While we don't have any other option, do you know how to use DirectShape.SetShape() method within dynamo? Is there any existing node or some python code that I can reuse?

 

0 Likes
Message 30 of 63

jshial
Advocate
Advocate

Hi Antonio,

 

I don't work with DirectShape very often, perhaps this link will help? (see code snippet at the bottom from nicholas.rawitscher)

 

DirectShape Question - Packages - Dynamo (dynamobim.com)

0 Likes
Message 31 of 63

ameer.mansourWAK8Y
Advocate
Advocate

any updates regarding this issue?

0 Likes
Message 32 of 63

antonio_hipolito
Enthusiast
Enthusiast

No news from my side

0 Likes
Message 33 of 63

nghia_pt
Contributor
Contributor

Hi,

When I try to find intersection between 2 rebar solids, I met this issue.

nghia_pt_0-1672307389307.png

 

0 Likes
Message 34 of 63

tommy.stromhaug
Contributor
Contributor

When it comes to boolean operations Revit API is not good. In my work at Symeri AS i have to use boolean operations in many cases. My solution was to convert my solids into Open Cascade objects. Do the boolean operations and convert it back into Revit solids. There exist a c# wrapper for many of the Open Cascade operations. I just have to ask the producer if it is ok that i publish this wrapper. 

Message 35 of 63

jeremy_tammik
Alumni
Alumni

Sounds like a brilliant workaround to me. Yes, please do. Thank you! Happy New Year, Tommy!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 36 of 63

chinhung77
Participant
Participant

This sounds like a great idea! Hope you can share how to do this, sincere thanks for providing a workable solution.

Message 37 of 63

634914927
Participant
Participant
I have the same problem about the Revit API: BooleanOperation Utils, too.
0 Likes
Message 38 of 63

634914927
Participant
Participant

the problem of BooleanOperationUtils exist in Revit until now, especially Union, not Intersect or Difference

0 Likes
Message 39 of 63

ankofl
Advocate
Advocate

Dear Jeremy!
Apparently, in the SIX years since the creation of this forum branch, absolutely no work has been done on Boolean operations with solids.
In this example, I am trying to connect all the solid bodies of the rooms together, and in each case, when such an operation causes an exception, I create two directshapes of the combined Solids as well as a ModelLine between their centroids. As can be seen from the screenshots, almost all Solid involved in this operation caused exceptions.
In my opinion, this indicates an extremely low level of quality of the Revit core, which performs the most basic operations for 3D engines.

gdasgds.jpg

afsfas.jpg

0 Likes
Message 40 of 63

a_chandrasekarFUFRK
Explorer
Explorer

Capture.PNG

It looks I do get the same error in my add-in, do someone have any solution to this issue?

0 Likes