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

Issue with the Boolean cut operation

Janath Francisco's picture
Forums: 

When I am going to cut my cylinder ( TopoDS_Shell shellcyl) by 2 faces(TopoDS_Face firstface,TopoDS_Face targetface), that has exploded by TopExp_Explorer. So my problem is when im cutting my cylinder with past cuts, its not giving my expected result. But when im giving my original shape to cut with that previous particular location, boolean operation will be happened.

Any help would be highly appriciated. Thank you!

Following is my code,

 result.Nullify();

  Standard_Boolean bRunParallel;

  Standard_Integer iErr;

  Standard_Real aFuzzyValue;

  bRunParallel=Standard_True;

  aFuzzyValue=2.1e-5;

  TopTools_ListOfShape hfd;

  hfd.Append(PntInfoFirstface2);   //firstface coming from a TopTools_ListOfShape

  hfd.Append(PntInfoLastface2);   //for this cut works fine

 if(!mergedFace2.IsEmpty()) {

  TRACE(_T("notEmpty !!!  %f\n"));

  hfd.Append(mergedFace2);    // not happening the cut (target face,) coming from TopTools_ListOfShape

  }

  bBuilder.SetArguments(cylinder2);

  bBuilder.SetTools(hfd);

  bBuilder.SetRunParallel(bRunParallel);

  bBuilder.Build();

  iErr=bBuilder.ErrorStatus();

  if (!iErr)

  {

      result = bBuilder.Shape();

 BRepTools::Write(result,"C:/Users/Dell/Desktop/Blade/resultcyl.brep");

 TopoDS_Face blnfaceCyl;

 Standard_Real  UMin,UMax,VMin,VMax;

 Standard_Real au, av;

 gp_Pnt srfPntCyl;

 double minDistance = 100000000;

 GProp_GProps system;

 TopoDS_Shell shellcyl =TopoDS::Shell(cylinder2.First());

 BRepGProp::SurfaceProperties(shellcyl, system);

 gp_Pnt centrpntcyl =system.CentreOfMass();  

 int i = 0;

 for (TopExp_Explorer explr(result,TopAbs_FACE);explr.More();explr.Next())

 {

   blnfaceCyl = TopoDS::Face(explr.Current());

 BRepTools::Write(blnfaceCyl,"C:/Users/Dell/Desktop/Blade/blnfaceCyl.brep");

     GProp_GProps system2;

 BRepGProp::SurfaceProperties(blnfaceCyl, system2);  

 gp_Pnt centrpntParts =system2.CentreOfMass();

 Standard_Real distance = centrpntcyl.Distance(centrpntParts);

 if( distance < minDistance)

 {

 minDistance = distance;

 mid =  blnfaceCyl;

 BRepTools::Write(mid,"C:/Users/Dell/Desktop/Blade/mi7d.brep");

 }

 }

    return true;  

  }

   return false;

Attachments: