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

Missing Faces in BRepAlgoAPI_Fuse

Mark Helou's picture
Forums: 

Hello,

I'm having an issue with the usage of BRepAlgoAPI_Fuse, as well as BRepAlgoAPI_BooleanOperation in BOPAlgo_FUSE mode.

I'm importing points and lines from an STL file, which are passed in fine. I am then generating cylinders based on said points and lines, as such:

TopTools_ListOfShape cellShapes = TopTools_ListOfShape();

TopTools_ListOfShape initShape = TopTools_ListOfShape();

for (int i = 0; i < lineConnections->size(); i += 2) {

gp_Pnt cylPoint1 = coordinatePoints->at(lineConnections->at(i)); // point 1

gp_Pnt cylPoint2 = coordinatePoints->at(lineConnections->at(i + 1)); // point 2

gp_Vec vectorLine = gp_Vec(cylPoint1, cylPoint2);

if (vectorLine.Magnitude() != 0) {

gp_Dir directionLine = gp_Dir(vectorLine);

gp_Ax2 axisCyl = gp_Ax2(cylPoint1, directionLine);

Standard_Real cyl_Height = vectorLine.Magnitude();

TopoDS_Shape createdCylinder = BRepPrimAPI_MakeCylinder(axisCyl, cyl_Rad, cyl_Height).Shape();

if (i == 0) {

initShape.Append(createdCylinder);

} else {

cellShapes.Append(createdCylinder);

}

}

}

double modelling_precision = 1e-10;

BRepAlgoAPI_BooleanOperation* cellFused = new BRepAlgoAPI_Fuse();

cellFused->SetArguments(initShape);

cellFused->SetTools(cellShapes);

cellFused->SetOperation(BOPAlgo_FUSE);

cellFused->SetRunParallel(true);

cellFused->SetFuzzyValue(modelling_precision);

cellFused->Build();

The resulting cellFused shape either throws a construction error when built, or only shows a small segment of what should be there. If I try to draw the cylinders by themselves, everything is there, hence the issue only arises when fusing. I have tried running the shapes through ShapeFix_Shape, but that doesn't work at all. Can anyone let me know how to fix this issue? Essentially I just want to be able to import an stl, and draw cylinders wherever a line is. I've attached an STL file of a shape that always fails, cubeWithHoleSimplified.stl, as well as a shape that always works, cylinderSimplified.stl.