Skip to content

Commit 609e0df

Browse files
antonymarionerossignon
authored andcommitted
Update Solid.cc
1 parent 76dfe8c commit 609e0df

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

src/Solid.cc

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -450,35 +450,46 @@ v8::Local<v8::Object> Solid::createMesh(double factor, double angle, bool qualit
450450

451451
try {
452452

453-
if (angle == 0.0) {
454-
BRepMesh_IncrementalMesh m1(shape,factor,Standard_True);
455-
} else {
456-
BRepMesh_IncrementalMesh m2(shape,factor,Standard_True,angle, Standard_True);
457-
}
453+
if (angle == 0.0) {
454+
BRepMesh_IncrementalMesh m1(shape,factor,Standard_True);
455+
} else {
456+
BRepMesh_IncrementalMesh m2(shape,factor,Standard_True,angle, Standard_True);
457+
}
458+
458459

459-
if (shape.ShapeType() == TopAbs_COMPSOLID || shape.ShapeType() == TopAbs_COMPOUND) {
460-
TopExp_Explorer exSolid, exFace;
461-
for (exSolid.Init(shape, TopAbs_SOLID); exSolid.More(); exSolid.Next()) {
462-
const TopoDS_Solid& solid = TopoDS::Solid(exSolid.Current());
463-
for (exFace.Init(solid, TopAbs_FACE); exFace.More(); exFace.Next()) {
464-
const TopoDS_Face& face = TopoDS::Face(exFace.Current());
465-
if (face.IsNull()) continue;
466-
mesh->extractFaceMesh(face, qualityNormals);
460+
if (shape.ShapeType() == TopAbs_COMPSOLID || shape.ShapeType() == TopAbs_COMPOUND) {
461+
TopExp_Explorer exSolid, exFace;
462+
for (exSolid.Init(shape, TopAbs_SOLID); exSolid.More(); exSolid.Next()) {
463+
const TopoDS_Solid& solid = TopoDS::Solid(exSolid.Current());
464+
for (exFace.Init(solid, TopAbs_FACE); exFace.More(); exFace.Next()) {
465+
const TopoDS_Face& face = TopoDS::Face(exFace.Current());
466+
if (face.IsNull()) continue;
467+
mesh->extractFaceMesh(face, qualityNormals);
468+
}
469+
}
470+
} else {
471+
TopExp_Explorer exFace;
472+
for (exFace.Init(shape, TopAbs_FACE); exFace.More(); exFace.Next()) {
473+
474+
const TopoDS_Face& face = TopoDS::Face(exFace.Current());
475+
if (face.IsNull()) continue;
476+
try {
477+
mesh->extractFaceMesh(face, qualityNormals);
478+
} catch(Standard_Failure const& anException) {
479+
480+
}
481+
}
467482
}
468-
}
469-
} else {
470-
TopExp_Explorer exFace;
471-
for (exFace.Init(shape, TopAbs_FACE); exFace.More(); exFace.Next()) {
472-
const TopoDS_Face& face = TopoDS::Face(exFace.Current());
473-
if (face.IsNull()) continue;
474-
mesh->extractFaceMesh(face, qualityNormals);
475-
}
476-
}
477483

478-
mesh->optimize();
484+
mesh->optimize();
479485

480-
} CATCH_AND_RETHROW_NO_RETURN("Failed to mesh solid ");
481486

487+
} catch(Standard_Failure const& anException) {
488+
Standard_SStream aMsg;
489+
aMsg << "EXCEPTION in Solid::createMesh" << endl;
490+
aMsg << anException << endl;
491+
Nan::ThrowError(aMsg.str().c_str());
492+
}
482493

483494
return scope.Escape(theMesh);
484495
}

0 commit comments

Comments
 (0)