Loft all wires not only the outer one #7251

This commit is contained in:
Thomas Krijnen
2025-10-21 13:09:10 +02:00
parent 28f5d6e91c
commit 80093f3777
+19 -6
View File
@@ -118,7 +118,8 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
auto jt = it + 1; auto jt = it + 1;
std::array<taxonomy::item::ptr, 2> fa = { *it, *jt }; std::array<taxonomy::item::ptr, 2> fa = { *it, *jt };
std::array<TopoDS_Shape, 2> shps; std::array<TopoDS_Shape, 2> shps;
std::array<TopoDS_Wire, 2> ws; std::vector<std::array<TopoDS_Wire, 2>> ws;
ws.emplace_back();
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
if (fa[i]->kind() == taxonomy::FACE) { if (fa[i]->kind() == taxonomy::FACE) {
if (!convert(std::static_pointer_cast<taxonomy::face>(fa[i]), shps[i])) { if (!convert(std::static_pointer_cast<taxonomy::face>(fa[i]), shps[i])) {
@@ -135,11 +136,20 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
if (shps[i].ShapeType() != TopAbs_FACE && shps[i].ShapeType() != TopAbs_WIRE) { if (shps[i].ShapeType() != TopAbs_FACE && shps[i].ShapeType() != TopAbs_WIRE) {
return false; return false;
} }
// @todo this is only outer wire
if (shps[i].ShapeType() == TopAbs_FACE) { if (shps[i].ShapeType() == TopAbs_FACE) {
ws[i] = BRepTools::OuterWire(TopoDS::Face(shps[i])); ws[0][i] = BRepTools::OuterWire(TopoDS::Face(shps[i]));
size_t j = 1;
for (TopExp_Explorer exp(shps[i], TopAbs_WIRE); exp.More(); exp.Next()) {
if (exp.Current() != ws[0][i]) {
while (ws.size() <= j) {
ws.emplace_back();
}
ws[j++][i] = TopoDS::Wire(exp.Current());
}
}
} else { } else {
ws[i] = TopoDS::Wire(shps[i]); ws[0][i] = TopoDS::Wire(shps[i]);
} }
} }
if (shps[0].ShapeType() == TopAbs_FACE) { if (shps[0].ShapeType() == TopAbs_FACE) {
@@ -154,8 +164,10 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
BB.Add(comp, shps[1]); BB.Add(comp, shps[1]);
} }
} }
BRepTools_WireExplorer a(ws[0]);
BRepTools_WireExplorer b(ws[1]); for (auto& wp : ws) {
BRepTools_WireExplorer a(wp[0]);
BRepTools_WireExplorer b(wp[1]);
for (; a.More() && b.More(); a.Next(), b.Next()) { for (; a.More() && b.More(); a.Next(), b.Next()) {
auto& e1 = a.Current(); auto& e1 = a.Current();
// auto e3 = TopoDS::Edge(b.Current().Reversed()); // auto e3 = TopoDS::Edge(b.Current().Reversed());
@@ -185,6 +197,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
BB.Add(comp, g); BB.Add(comp, g);
} }
} }
}
// create_solid_from_faces(faces, result, settings_.get<settings::Precision>().get()); // create_solid_from_faces(faces, result, settings_.get<settings::Precision>().get());
result = comp; result = comp;