Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

Incorrect face deletion on shape-plane cutting

Incorrect face deletion on shape-plane cutting
Jendrik Seiler 2013/04/18 12:22
we are currently trying to implement a cutting algorithm for our already discretised geometry. In this example, the geometry is a cigar-shaped solid made out of circumferential faces as shown in the first image. The second image shows the cutting plane as well which is scaled during the algorithm to overspread the full geometry. However, after the cut is done, the face the plane "enters" the geometry is missing completly afterwards. This does only happen on some occasions and I can't really figure out why.

Here is the code we use:

// temporary variables for cutting process
gp_Pnt ref;
TopoDS_Shape new_shape;
gp_Trsf aTrsf;

// calculate the planes' geometric center
double Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
Bnd_Box B;
BRepBndLib::Add(cut_plane->shape()->Shape(), B);
B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
gp_Pnt cog((Xmax+Xmin)/2, (Ymax+Ymin)/2, (Zmax+Zmin)/2);

// scale the cutting plane to always cut all of the geometry
aTrsf.SetScale(cog, 1.0e4);
BRepBuilderAPI_Transform trfa(cut_plane->shape()->Shape(), aTrsf);
TopoDS_Face face = TopoDS::Face(trfa.Shape());

// create half space of entire model with face of cut_plane
TopoDS_Shape halfspace = BRepPrimAPI_MakeHalfSpace(face, ref).Solid();

// create new shape from referenced part and halfspace
BRepAlgoAPI_Common test(old_shape,halfspace);
new_shape = test.Shape();

cout << test.ErrorStatus();
if(test.HasGenerated()) cout << "generated" ;
Jendrik Seiler 2013/04/18 12:27
Oh I forgot:
The error code always returns 0 but the generated output is not produced.

I hope there is someone who can support us with issue. Any help is greatly appreciated.
Alexander Luger 2013/04/19 14:48
Try to use ShapeFix_Solid on the cutting result.

Jendrik Seiler 2013/04/22 12:52
Thank you for your reply. Unfortunately, it was decided to implemend the cutting algorithm on another level and i can't test your idea at the moment. If I have a few minutes in the future i'll try it anyways and let you know whether it solves the problem.
Latest news
  • JT Assistant for Android
  • Open CASCADE JT Assistant Sources
  • JT Assistant Linux and CAD Assistant

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map