Executing problem

I have this code to generate a cut opperation:
TopoDS_Solid S1 = BRepPrimAPI_MakeSphere(R);
TopoDS_Solid F2 = BRepPrimAPI_MakeCylinder(R,R);
BRepAlgoAPI_Cut cutting(S1,F2);
TopoDS_Shape Result = cutting.Shape();
return Result;

But when I execute the program, a segmentation fault appears, what am I doing wrong?

Thanks in advantage for your help.

Rob Bachrach's picture

I believe your problem may be that MakeCylinder does not create a solid. It creates a set of faces. Try putting a try/catch block around your code. I wouldn't be surprised if OpenCASCADE is throwing an exception. The nature and text of the exception should give you your answer.