Home / Developer Corner / Forum / How to cut a solid by a face into two sub solids using cut API only once
Forum
How to cut a solid by a face into two sub solids using cut API only once
Cauchy Ding
2010/03/10 02:01
Hi All,
Now, to cut a solid by a face into two sub solids, I have to use API BRepAlgoAPI_Cut twice. One uses positive half space , and another uses negative half space. So it's somewhat stupid and low performance. My method is as follows:
I just wonder know how can I get the two sub solids by one time CUT operation. Does any API support it or is there any similar API DirectLeft() or DirectRight() to get any part of the cutting result.
Thanks in advance. Any suggestion is welcome.
-Ding
Lodyzhensky Evgeny Nicolaich
2010/03/10 05:37
Dear Cauchy Ding .
1. If you prefer to use standard Boolean Operations you can increase the performance by the following trick.
The builders above are not so time consuming things as the DSFiller, so may be the way will be good for you.
2.If not. You can use the class GEOMAlgo_Splitter from Salome plarform.
The class allows to perform the things you want at once.
Furthermore you can use trimFaceTool directly as the argument of the operation.
Attached a python sample (pythonOCC actually wraps for both OCC and GEOM libraries), as well as 2 screenshots (input/output), that illustrates how to split a box with a plane face.
Regards,
Thomas
You have to be logged in to download the attached file
Thomas Paviot
2010/03/10 14:56
The first screenshot (the box and the plane face)
You have to be logged in to download the attached file
Thomas Paviot
2010/03/10 14:56
And the second one (resulting shape)
You have to be logged in to download the attached file
Cauchy Ding
2010/03/11 07:31
Dear Thomas Paviot,
Thank you very much for your reply. I am sorry that my app can't use Salome platform directly. But still thanks to your detailed explanations.
Thank you.
Regards.
-Ding
Cauchy Ding
2010/03/11 07:27
Dear Lodyzhensky Evgeny Nicolaich,
Thank you so much for your detailed explanation. Your method is so nice and works very well now. The new method is about double faster than old method.
I think there is a minor bug in your pseudocode.
S2=solidNeg;
BRepAlgoAPI_Cut aBCt(S1, S2, aDF);
Here S2 should also be the "solidPos" instead of "solidNeg".
Thank you very much.
-Ding
Lodyzhensky Evgeny Nicolaich
2010/03/15 05:16
Dear Cauchy Ding.
You are quite right.
...Here S2 should also be the "solidPos" instead of "solidNeg".
It is my misprint.