BRepBuilderAPI_Sewing and Standard_TypeMismatch

I need to sew thousand of TopoDS_Face all together into one body. I believe these faces are OK as I tested and checked them on other bodies and everything was fine. Below is my code, I store the faces in a vector and then sew them to finally get a "Standard_TypeMismatch" with a 'core dumped". I asked the class BRepBuilderAPI_Sewing to dump statistics which I displayed at the end of the message. Do you know what's going on with this "Standard_TypeMismatch" and what it really means?

Handle_BRepBuilderAPI_Sewing aSewing = new BRepBuilderAPI_Sewing();
std::vector< TopoDS_Face > allFaces;

[...]

for (unsigned int k=0; k<allFaces.size(); ++k)
DetailedShapes->Append(allFaces[k]);
for (Standard_Integer l=1; l<=DetailedShapes->Length(); ++l) {
//cout << "k = " << k << endl;
aBuilder.Add(aCompoundResult, DetailedShapes->Value(l));
aSewing->Add(DetailedShapes->Value(l));
}

//cout << "Step 1" << endl;
aSewing->Perform();
aSewing->Dump();

//cout << "Step 2" << endl;
BRepBuilderAPI_MakeSolid mkSolid;
mkSolid.Add(TopoDS::Shell(aSewing->SewedShape()));

=> the Standard_TypeMismatch takes place here.

finalBody = mkSolid.Solid();

Informations
===========================================================

Number of input shapes : 64453
Number of actual shapes : 64453
Number of Bounds : 325586
Number of Sections : 325586
Number of Edges : 162793
Number of Vertices : 325586
Number of Nodes : 97411
Number of Free Edges : 0
Number of Contigous Edges : 162793
Number of Multiple Edges : 0
Number of Degenerated Edges : 0
===========================================================

terminate called after throwing an instance of 'Standard_TypeMismatch'

Artem Zhidkov's picture

I suppose, the result of sewing operation is not a shell in your case, that's why use observe type mismatch on TopoDS::Shell() conversion.

I would say more if you could attach the shapes here. Or you may report an issue to OCCT bug tracker and developers will try to solve the problem.

Regards,

Artem