cutting results in 3 or more shapes

Hi there,

I'm having a problem when cutting shapes. I'm trying to cut a TopoDS_Shape at a certain edge using a cutting plane that includes said edge. But the cut could result in more than just 2 new TopoDS_Shapes that are not connected with each other.
Is it possible to use

BRepAlgoAPI_Cut aCut(objectShape, cutPlane1);
TopoDS_Shape aResult1 = aCut.Shape();

if the cut shape 'aResult1' includes 2 not connected shapes? and is there a function to find out which parts of the result make a connected shape?

Or is there another Cutting function that allows cutting into 3 or more new shapes?
I've looked for one but couldn't find any. Maybe I was looking at the wrong places, but I'm a bit lost right now. I'd appreciate any help that any of you could give me.


Dave Cowden's picture

Hi, Christian, did you ever get an answer to this one? I have the same issue.

Svetlozar Kostadinov's picture

I suppose if the result includes 2 or more shapes, Shape() method returns shape of type TopAbs_COMPOUND or TopAbs_COMPSOLID. This compound shape includes all sub shapes that you need. Just explore the result shape with TopExp_Explorer.

Dave Cowden's picture

Sweet, thanks! I'll give that a try. So obvious!

P G's picture

Is it possible to get the "topds_shape's" from the compound or compsolid ? I only able to get the
sub-shapes - faces/edges/vertices and not the 'shape' from the compound.
For example I have a box,cylinder,cone,sphere and I make a compound out of it. How to get
the 4 top level sub-shapes from this compound.

Paul Jimenez's picture

Use TopAbs_SOLID for the explorer, or TopAbs_COMPOUND if you're storing compounds into a compound object. In other words: check first what the box, cylinder, cone and sphere are before adding them to the compound (they're probably solids or shells), then use a explorer with the corresponding TopAbs_* when exploring the compound.

Bearloga's picture

Or use TopoDS_Iterator. It will iterate on the direct subshapes of the given shape.

Svetlozar Kostadinov's picture

According to a comment in a Salome source file the boolean operations always return compound shape.