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

Related pages

BRepAlgoAPI_Cut bug

Anton Shabalin's picture
Forums: 

Hello everyone!

I am stuck with a BRepAlgoAPI_Cut bug. Here is an example:

//makeBottle is a function that creates bottle from OCCT example

    Handle(AIS_Shape) aBottle = new AIS_Shape(makeBottle(50, 70, 30));

    Bnd_Box bb;
    bb.SetGap(0);

    BRepBndLib::Add(aBottle->Shape(), bb, false);

    gp_Pnt p0 = bb.CornerMin();
    gp_Pnt p1 = bb.CornerMax();
    gp_Pnt cp( (p0.X() + p1.X()) * 0.5,
               (p0.Y() + p1.Y()) * 0.5,
               (p0.Z() + p1.Z()) * 0.5 );
    
    gp_Vec v = gp_Vec(1.0, 1.0, 0.0).Normalized();
    TopoDS_Shape tool = BRepPrimAPI_MakeCylinder(gp_Ax2(cp, v), 100000, 100000).Shape();
    TopoDS_Shape cutObj = BRepAlgoAPI_Cut(aBottle->Shape(), tool).Shape();

    display(cutObj)

The result is shown on the attached pic. But if the v would be {1.0, 1.0, 1.0} the result will be fine. Same result you can achieve using a BRepPrimAPI_MakeHalfSpace.

P.S. I am using OCCT 7.1.0

P.P.S. I think the problem is in the "Threading" object. Because if I didn't add it to the result compound, the cut operation gives me the right result. 

Attachments: