add norm of gp_Vec

This commit is contained in:
Christopher Lackner 2022-06-13 10:35:26 +02:00
parent 36ac5e5bcc
commit 06f35594c6
2 changed files with 3 additions and 1 deletions

View File

@ -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() << ")";

View File

@ -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'")