View Issue Details

IDProjectCategoryView StatusLast Update
0033135CommunityOCCT:Modeling Algorithmspublic2022-09-06 09:56
ReporterOliver R Assigned Tomsv 
PrioritynormalSeverityminor 
Status newResolutionopen 
Product Version7.6.3 
Summary0033135: Cut of sphere and Prism does not work
DescriptionIn certain positions the cut a of a sphere and a prism (or vice versa) does not produce the correct result.
Steps To Reproduce#include <gp_Pnt.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <StlAPI_Writer.hxx>
#include <iostream>
                                                                                
int main()
{
                                                                                
    Standard_Real r = 1;
    Standard_Real d = 2*r;
                                                                                
    gp_Pnt origin = gp_Pnt( r,0,0);
                                                                                
    TopoDS_Shape s1 = BRepPrimAPI_MakeSphere(origin, r).Shape();
                                                                                
    gp_Pnt p1 = gp_Pnt( r,0,r);
    gp_Pnt p2 = gp_Pnt( 0,0,0);
    gp_Pnt p3 = gp_Pnt( 2*r,0,0);
                                                                                
    TopoDS_Wire wire = BRepBuilderAPI_MakePolygon(p1, p2, p3, Standard_True).Wire();
    TopoDS_Face base = BRepBuilderAPI_MakeFace(wire, Standard_True);
                                                                                
    gp_Pnt b1 = gp_Pnt( r,0,r/3);
    gp_Pnt b2 = gp_Pnt( r,d,r/3);
                                                                                
    gp_Vec vec = gp_Vec(b1, b2);
                                                                                
    TopoDS_Shape s2 = BRepPrimAPI_MakePrism(base, vec, Standard_True, Standard_True).Shape();
                                                                                
    BRepAlgoAPI_Cut aCut(s2, s1);
                                                                                
    if (!aCut.IsDone())
        return 0;
                                                                                
    if (aCut.HasErrors())
        return 0;
                                                                                
    TopoDS_Shape shape = aCut.Shape();
                                                                                
    if (shape.IsNull())

                                                                                
    BRepMesh_IncrementalMesh Mesh( shape, 0.01 );
    Mesh.Perform();
                                                                                
    StlAPI_Writer stl_writer;
    stl_writer.Write(shape, "object.stl");
                                                                                
    return 0;
}


g++ -I ~/builds/build/include/opencascade -L ~/builds/build/lin64/gcc/lib demo_simple_14.cpp -lTKBin -lTKBinL -lTKBinTObj -lTKBinXCAF -lTKBO -lTKBool -lTKBRep -lTKCAF -lTKCDF -lTKDCAF -lTKDraw -lTKernel -lTKFeat -lTKFillet -lTKG2d -lTKG3d -lTKGeomAlgo -lTKGeomBase -lTKHLR -lTKIGES -lTKLCAF -lTKMath -lTKMesh -lTKMeshVS -lTKOffset -lTKOpenGl -lTKPrim -lTKQADraw -lTKRWMesh -lTKService -lTKShHealing -lTKStd -lTKStdL -lTKSTEP209 -lTKSTEP -lTKSTEPAttr -lTKSTEPBase -lTKSTL -lTKTObj -lTKTObjDRAW -lTKTopAlgo -lTKTopTest -lTKV3d -lTKVCAF -lTKViewerTest -lTKVRML -lTKXCAF -lTKXDEDRAW -lTKXDEIGES -lTKXDESTEP -lTKXMesh -lTKXml -lTKXmlL -lTKXmlTObj -lTKXmlXCAF -lTKXSBase -lTKXSDRAW
Additional information
and documentation updates
The cut

BRepAlgoAPI_Cut aCut(s1, s2);

also does not work.
TagsNo tags attached.
Test case number

Attached Files

  • CutPrismBall.jpeg (11,950 bytes)

Activities

Oliver R

2022-09-06 09:56

reporter  

CutPrismBall.jpeg (11,950 bytes)

Issue History

Date Modified Username Field Change
2022-09-06 09:56 Oliver R New Issue
2022-09-06 09:56 Oliver R Assigned To => msv
2022-09-06 09:56 Oliver R File Added: CutPrismBall.jpeg