Be a bit more careful in throwing NoSuchObject in case of triangulated face handling https://github.com/IfcOpenShell/wasm-preview/issues/1

This commit is contained in:
Thomas Krijnen
2022-11-09 20:32:53 +01:00
parent 21f8aca00f
commit c6cdf4ab77
+10 -3
View File
@@ -201,6 +201,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& result)
for (const auto& w : fd.wires()) {
TopTools_ListOfShape fl;
auto r = util::triangulate_wire({ w }, fl);
if (r == util::TRIANGULATE_WIRE_FAIL) {
continue;
}
face_list.Append(fl);
if (faceset_helper_ && r == util::TRIANGULATE_WIRE_NON_MANIFOLD) {
faceset_helper_->non_manifold() = true;
@@ -208,8 +211,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& result)
}
} else {
auto r = util::triangulate_wire(fd.wires(), face_list);
if (faceset_helper_ && r == util::TRIANGULATE_WIRE_NON_MANIFOLD) {
faceset_helper_->non_manifold() = true;
if (r != util::TRIANGULATE_WIRE_FAIL) {
if (faceset_helper_ && r == util::TRIANGULATE_WIRE_NON_MANIFOLD) {
faceset_helper_->non_manifold() = true;
}
}
}
} else if (!fd.all_outer()) {
@@ -313,7 +318,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& result)
}
}
if (face_list.Extent() > 1) {
if (face_list.Extent() == 0) {
return false;
} else if (face_list.Extent() > 1) {
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound(compound);