From 2d7a556dd5c24f1ba2d7ab0beb58078ebfbf5669 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 24 Feb 2026 11:26:18 +0100 Subject: [PATCH] Fix sectioned solid cap #7674 --- src/ifcgeom/kernels/opencascade/loft.cpp | 31 +++++++++--------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/ifcgeom/kernels/opencascade/loft.cpp b/src/ifcgeom/kernels/opencascade/loft.cpp index 74c9c187df..b055b7743b 100644 --- a/src/ifcgeom/kernels/opencascade/loft.cpp +++ b/src/ifcgeom/kernels/opencascade/loft.cpp @@ -165,13 +165,6 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re std::vector shps(loft->children.size()); std::vector>> all_tags; - - std::ostringstream oss; - loft->children[0]->print(oss); - loft->children[1]->print(oss); - auto s = oss.str(); - std::wcout << s.c_str() << std::endl; - // First convert all taxonomy items to TopoDS_Wire/Face for (auto it = loft->children.begin(); it < loft->children.end(); ++it) { auto i = std::distance(loft->children.begin(), it); @@ -267,6 +260,18 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re return true; */ + if (shps.size() < 2) { + Logger::Error("Not enough sections to loft"); + return false; + } + + if (shps[0].ShapeType() == TopAbs_FACE) { + // When processing a sectioned *surface* there are no + // begin and end caps that need to be added. + BB.Add(comp, shps.front().Reversed()); + BB.Add(comp, shps.back()); + } + // @todo this approach is // potentially incorrect as there is no guarantee that the wires for // subsequently placed profiles are traversed from an equivalent start vertex. @@ -292,18 +297,6 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re ws[0][i] = TopoDS::Wire(*fa[i]); } } - if (it->ShapeType() == TopAbs_FACE) { - // When processing a sectioned *surface* there are no - // begin and end caps that need to be added. - if (it == shps.begin()) { - // faces.Append(shps[0]); - BB.Add(comp, shps[0]); - } - if (jt == shps.end() - 1) { - // faces.Append(shps[1]); - BB.Add(comp, shps[1]); - } - } if (!all_tags.empty()) { // only open profiles have tags for now, so there is only one wire, no inner wires