mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Some defensiveness against null shapes (should look into this better)
This commit is contained in:
@@ -280,6 +280,10 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const IfcUtil::IfcBaseEntity*
|
||||
std::list<TopoDS_Shape> parts;
|
||||
|
||||
auto it3_shape = std::static_pointer_cast<OpenCascadeShape>(it3->Shape())->shape();
|
||||
if (it3_shape.IsNull()) {
|
||||
Logger::Error("Null operand");
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_multiple = it3_shape.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(it3_shape).More() && util::is_nested_compound_of_solid(it3_shape);
|
||||
|
||||
|
||||
@@ -123,6 +123,10 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
|
||||
|
||||
for (auto& r : cr) {
|
||||
auto S = std::static_pointer_cast<OpenCascadeShape>(r.Shape())->shape();
|
||||
if (S.IsNull()) {
|
||||
Logger::Error("Null operand");
|
||||
continue;
|
||||
}
|
||||
gp_GTrsf trsf;
|
||||
convert(r.Placement(), trsf);
|
||||
// @todo it really confuses me why I cannot use Moved() here instead
|
||||
@@ -155,7 +159,7 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
|
||||
|
||||
TopoDS_Shape r;
|
||||
|
||||
if (a.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(a).More() && util::is_nested_compound_of_solid(a)) {
|
||||
if (br->operation == taxonomy::boolean_result::SUBTRACTION && !a.IsNull() && a.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(a).More() && util::is_nested_compound_of_solid(a)) {
|
||||
TopoDS_Compound C;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(C);
|
||||
|
||||
@@ -981,7 +981,9 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
|
||||
if (Logger::LOG_NOTICE >= Logger::Verbosity()) {
|
||||
PERF("preliminary manifoldness check");
|
||||
|
||||
Logger::Notice("Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold");
|
||||
if (!a.IsNull()) {
|
||||
Logger::Notice("Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold");
|
||||
}
|
||||
|
||||
TopTools_ListIteratorOfListOfShape it(b);
|
||||
for (int i = 0; it.More(); it.Next(), ++i) {
|
||||
|
||||
Reference in New Issue
Block a user