Closed Shape constructed from a list of connected Faces

Could some provide some suggestions on the following pls?
I have several faces and they should bound a closed shape. But, when I constructed the aShape from these faces, the resulted shape is not connected. How to fix it?

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);

ShapeFix_Shell FixShell;
FixShell.Init(aShell);
FixShell.Perform();
aShell = FixShell.Shell();

TopoDS_Solid aSolid = BRepBuilderAPI_MakeSolid(aShell);
std::cout std::cout std::cout

The outputs are all zero.

Many thanks.

Ming

Fabio Napodano's picture

probably SewedShape() did not return a TopAbs_SHELL object.

It can also return TopAbs_FACE or TopAbs_COMPOUND, depending on the situation.

Check SewedShape.ShapeType()

Ming_39674's picture

Hi, Fabio
Thanks a lot for your suggestions. There arised some problems in the faces construction previously. Now the shape is closed. However, when doing boolean operation for the resulted shape aSubpart with another shape aShape, there still arise some errors. Here is the code:

BRepAlgoAPI_Fuse aFuse(aShape,aSubpart);
if(aFuse.IsDone())
{
TopoDS_Shape aUShape=aFuse.Shape();
TopTools_IndexedMapOfShape aMap;
TopExp::MapShapes(aUShape,TopAbs_FACE,aMap);
std::cout<<"faces number in the updated model:"
<< aMap.Extent()<

Francois Lauzon's picture

Fabio is right, you shape is probably something different than a close shell. You could look at using the AIS_Shape, and you could look at the connection between the different faces, they are connected when the edges are yellow, and they are gaps when the color is different.

Good Luck,
Francois.