From 6c956bb80ffe1ab0b3397f552b4f268caa20c692 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 7 Nov 2020 13:47:15 +0100 Subject: [PATCH] Sketcher: support vertexes in sketch used e.g. for hole features --- src/Mod/Part/App/TopoShape.cpp | 2 +- src/Mod/Sketcher/App/Sketch.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 32d817cd82..2668da66c2 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -4132,7 +4132,7 @@ TopoShape &TopoShape::makEFace(const std::vector &shapes, const char for(auto &s : shapes) { if (s.getShape().ShapeType() == TopAbs_COMPOUND) mkFace->useCompound(TopoDS::Compound(s.getShape())); - else + else if (s.getShape().ShapeType() != TopAbs_VERTEX) mkFace->addShape(s.getShape()); } mkFace->Build(); diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 1d8be7388a..a1e886b809 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -3915,13 +3915,18 @@ TopoShape Sketch::toShape(void) const return result; #else std::list edge_list; + std::list vertex_list; std::list wires; // collecting all (non constructive and non external) edges out of the sketch for (;it!=Geoms.end();++it) { auto gf = GeometryFacade::getFacade(it->geo); - if (!it->external && !gf->getConstruction() && (it->type != Point)) { - edge_list.push_back(TopoDS::Edge(it->geo->toShape())); + if (!it->external && !gf->getConstruction()) { + + if (it->type != Point) + edge_list.push_back(TopoDS::Edge(it->geo->toShape())); + else + vertex_list.push_back(TopoDS::Vertex(it->geo->toShape())); } } @@ -3963,9 +3968,10 @@ TopoShape Sketch::toShape(void) const wires.push_back(aFix.Wire()); } - if (wires.size() == 1) + if (wires.size() == 1 && vertex_list.empty()) { result = *wires.begin(); - else if (wires.size() > 1) { + } + else if (wires.size() > 1 || !vertex_list.empty()) { // FIXME: The right way here would be to determine the outer and inner wires and // generate a face with holes (inner wires have to be tagged REVERSE or INNER). // that's the only way to transport a somewhat more complex sketch... @@ -3980,6 +3986,8 @@ TopoShape Sketch::toShape(void) const builder.MakeCompound(comp); for (std::list::iterator wt = wires.begin(); wt != wires.end(); ++wt) builder.Add(comp, *wt); + for (std::list::iterator wt = vertex_list.begin(); wt != vertex_list.end(); ++wt) + builder.Add(comp, *wt); result.setShape(comp); } #endif