From 10e3494de44fffc09d540c35a10b55dc9840fad4 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 4 Nov 2021 20:43:33 +0100 Subject: [PATCH] [occ] connect edges to wires --- libsrc/occ/python_occ_shapes.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 8553619a..f99bd6e0 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -64,6 +64,8 @@ #include #include #include +#include + #include @@ -2032,7 +2034,20 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) }, py::arg("wires"), py::arg("solid")=true, "Building a loft. This is a shell or solid passing through a set of sections (wires). " "First and last sections may be vertices. See https://dev.opencascade.org/doc/refman/html/class_b_rep_offset_a_p_i___thru_sections.html#details"); - + + m.def("ConnectEdgesToWires", [](const vector& edges, + double tol, bool shared) + { + Handle(TopTools_HSequenceOfShape) sedges = new TopTools_HSequenceOfShape; + Handle(TopTools_HSequenceOfShape) swires = new TopTools_HSequenceOfShape; + for(auto& e : edges) + sedges->Append(e); + ShapeAnalysis_FreeBounds::ConnectEdgesToWires(sedges, tol, shared, swires); + vector wires; + for(auto& w : *swires) + wires.push_back(TopoDS::Wire(w)); + return std::move(wires); + }, py::arg("edges"), py::arg("tol")=1e-8, py::arg("shared")=true); py::class_> (m, "WorkPlane") .def(py::init(), py::arg("axes")=gp_Ax3(), py::arg("pos")=gp_Ax2d())