mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Check for null shapes among layer set slicing results
This commit is contained in:
@@ -2101,6 +2101,7 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
apply_tolerance(solid, getValue(GV_PRECISION));
|
||||
|
||||
BOPCol_ListOfShape shapes;
|
||||
shapes.Append(input);
|
||||
@@ -2111,8 +2112,14 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo
|
||||
front = BRepAlgoAPI_Cut(input, solid, filler);
|
||||
back = BRepAlgoAPI_Common(input, solid, filler);
|
||||
|
||||
bool is_null[2];
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
TopoDS_Shape& shape = i == 0 ? front : back;
|
||||
const bool result_is_null = is_null[i] = shape.IsNull();
|
||||
if (result_is_null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
ShapeFix_Shape fix(shape);
|
||||
if (fix.Perform()) {
|
||||
@@ -2126,6 +2133,13 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null[0] || is_null[1]) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Null result obtained from layerset slicing");
|
||||
if (is_null[0] && is_null[1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const double ab = shape_volume(input);
|
||||
const double a = shape_volume(front);
|
||||
const double b = shape_volume(back);
|
||||
|
||||
Reference in New Issue
Block a user