From 94c009d1792d2fa00c7711b2f2b58ed4dd1beef7 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 20 Sep 2021 09:27:56 +0200 Subject: [PATCH] #1227 layer slicing --- src/ifcgeom/IfcGeomFunctions.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 79c76a1503..336894ed05 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -2984,7 +2984,9 @@ namespace { auto result_shape = split.Shape(); std::list subs; subshapes(result_shape, subs); - if (subs.size() == 1 && operands.Size() - 2 > (int)subs.size() && (subs.front().ShapeType() == TopAbs_COMPSOLID || subs.front().ShapeType() == TopAbs_COMPOUND)) { + + // Sometimes there is more nesting of compounds, so when we find a single compound we again try to explode it into a list. + if (subs.size() == 1 && (subs.front().ShapeType() == TopAbs_COMPSOLID || subs.front().ShapeType() == TopAbs_COMPOUND)) { auto s = subs.front(); subs.clear(); subshapes(s, subs); @@ -3256,6 +3258,13 @@ bool IfcGeom::Kernel::apply_layerset(const IfcRepresentationShapeItems& items, c operands.Append(face); } + /* + // enable this is you want to see how IfcOpenShell has placed the layer surfaces + for (auto& x : operands) { + result.push_back(IfcRepresentationShapeItem(it->ItemId(), it->Placement(), x, nullptr)); + } + */ + std::vector slices; if (split(*this, it->Shape(), operands, getValue(GV_PRECISION), slices) && slices.size() == styles.size()) { for (size_t i = 0; i < slices.size(); ++i) {