From 06f35594c636f048b297008f5f6db5cd408d65ec Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 13 Jun 2022 10:35:26 +0200 Subject: [PATCH] add norm of gp_Vec --- libsrc/occ/python_occ_basic.cpp | 2 ++ libsrc/occ/python_occ_shapes.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/python_occ_basic.cpp b/libsrc/occ/python_occ_basic.cpp index 05fdb1ee..9768a22d 100644 --- a/libsrc/occ/python_occ_basic.cpp +++ b/libsrc/occ/python_occ_basic.cpp @@ -76,6 +76,8 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) .def_property("x", [](gp_Vec&p) { return p.X(); }, [](gp_Vec&p,double x) { p.SetX(x); }) .def_property("y", [](gp_Vec&p) { return p.Y(); }, [](gp_Vec&p,double y) { p.SetY(y); }) .def_property("z", [](gp_Vec&p) { return p.Z(); }, [](gp_Vec&p,double z) { p.SetZ(z); }) + .def("Norm", [](const gp_Vec& v) + { return v.Magnitude(); }) .def("__str__", [] (const gp_Vec & p) { stringstream str; str << "(" << p.X() << ", " << p.Y() << ", " << p.Z() << ")"; diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index b4f380ef..9ee9d6ab 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -769,7 +769,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) trafo.SetTranslation(v); BRepBuilderAPI_Transform builder(shape, trafo, true); PropagateProperties(builder, shape, occ2ng(trafo)); - return builder.Shape(); + return CastShape(builder.Shape()); // version 2: change location // ... }, py::arg("v"), "copy shape, and translate copy by vector 'v'")