Problem with coverting Booleaned shape

Hi
When i am using Boolean cut operation the shape in viewer is coming perfectly. But when i am trying to retrive the shape as TopoDS_Shell or TopoDS_Solid i am getting runtime error. Following is the piece of code:

TopoDS_Solid base,prot; //Both are valid solids created earlier

BRepAlgoAPI_Cut CT(base,prot);

TopoDS_Shell SL = TopoDS::Shell(CT.Shape());

The third line gives me runtime error, (when i am trying to build it as shell). Please help me out in this regard how to do it.

If i dont convert into shell and kep it as shape it comes out nicely in the viewer, but i need them as shells and in turn solids

Rob Bachrach's picture

If the originals are solids, chances are the final shape is either a Solid, a CompSolid, or a Compound. If you need a shell, you might consider using a TopExp_Explorer to get the shell(s) from your resulting shape. If you are sure the shape being cut should create only a single solid, you only need to look at the first shell found.

Nagarajan's picture

Thank you very much...
That works just fine