For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

BRepAlgoAPI_Cut fails

Yaron's picture
Forums: 

hi,
I'm to subtract one shape from another and from some reason, for certain shapes the operation fails (exception occurs).
I enclosed the shapes here where the subtraction is applied by the following code:

CString filename = "C:\\Temp\\S1.brep";
TopoDS_Shape aShape1;
Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename;
BRep_Builder aBuilder;
BRepTools::Read(aShape1,aFileName,aBuilder);

filename = "C:\\Temp\\S2.brep";
TopoDS_Shape aShape2;
aFileName = (Standard_CString)(LPCTSTR)filename;
BRepTools::Read(aShape2,aFileName,aBuilder);

BRepAlgoAPI_Cut ba = BRepAlgoAPI_Cut(aShape1,aShape2);
TopoDS_Shape ShapeCut = ba.Shape();

Handle (AIS_Shape) ais3 = new AIS_Shape(ShapeCut);
myAISContext->SetDisplayMode(ais3,1,Standard_False);
myAISContext->SetColor(ais3,Quantity_NOC_RED,Standard_False);
myAISContext->SetMaterial(ais3,Graphic3d_NOM_PLASTIC,Standard_False);
myAISContext->Display(ais3,Standard_False);
myAISContext->SetCurrentObject(ais3,Standard_False);

Fit();

any ideas?
thanks