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

Shape constructed from a list of faces and boolean operations ! HELP PLS!

Mark Quinn's picture
Forums: 

Hi, All

I have been bothered by the problem for so long time. Would you give me some hints after some illustration for it? The problem consists of the following steps:

1. Construct a TopoDS_Shape aSubpart from a list of faces. The faces together will surely bound a closed volume. Here, aSubpart.Closed() returns 0, aSubpart.Infinite() returns 0 also. The function to do this operation named MakeShape() is attached below. Then, how to set aSubpart as a valid shape?

2. Check whether aSubpart is a positive or negative subpart related to another TopoDS_Shape aShape. Here, aShape.Closed() returns 0.

To do so, it is needed to set the normal direction of each faces in aSubpart to point outside of aSubpart. Do you know how?

3. Do boolean operations, cut or fuse, for aSubpart with aShape. The function is listed below and the aFuse.ErrorStatus() returns 110. Then how to do it well?

-----------------------------------------------------------------
//do boolean operations for aShape and aSubpart

...
aSubpart=MakeShape(aMap);
BRepAlgoAPI_Fuse aFuse(aShape,aSubpart);
if(aFuse.IsDone())
{
aUShape=aFuse.Shape();
TopTools_IndexedMapOfShape aMap;
TopExp::MapShapes(m_UShape,TopAbs_FACE,aMap);
std::cout //if BRepAlgo_Fuse aFuse is used, aMap.Extent returns 0.
}
else
{
std::cout //BRepAlgoAPI_Fuse aFuse is used, the erros status is 110.
}
------------------------------------------------------------------
//make a closed shape from a set of faces

TopoDS_Shape MakeShape(const TopTools_IndexedMapOfShape& aMap)
{
BRepOffsetAPI_Sewing Sew;
for(int i=1;i {
TopoDS_Shape aShape=aMap(i);
if(aShape.ShapeType()==TopAbs_FACE)
{
TopoDS_Face F=TopoDS::Face(aShape);
Sew.Add(F);
}
}
Sew.Perform();
TopoDS_Shape aShape = Sew.SewedShape();
TopoDS_Shell aShell = TopoDS::Shell(aShape);

//try to fix aShell
ShapeFix_Shell FixShell;
FixShell.Init(aShell);
FixShell.Perform();
aShell = FixShell.Shell();
TopoDS_Solid aSolid = BRepBuilderAPI_MakeSolid(aShell);
aSolid.Reverse();

std::cout std::cout std::cout

return aShell;
}