Part: use of factory method of Vector2dPy

This commit is contained in:
wmayer
2021-11-14 18:19:34 +01:00
parent 53db547270
commit 69fd6d35ec
10 changed files with 39 additions and 296 deletions

View File

@@ -126,13 +126,7 @@ Py::Object Line2dPy::getLocation(void) const
Handle(Geom2d_Line) this_curve = Handle(Geom2d_Line)::DownCast
(this->getGeom2dLinePtr()->handle());
gp_Pnt2d pnt = this_curve->Location();
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(pnt.X()));
arg.setItem(1, Py::Float(pnt.Y()));
return method.apply(arg);
return Base::Vector2dPy::create(pnt.X(), pnt.Y());
}
void Line2dPy::setLocation(Py::Object arg)
@@ -180,13 +174,7 @@ Py::Object Line2dPy::getDirection(void) const
Handle(Geom2d_Line) this_curve = Handle(Geom2d_Line)::DownCast
(this->getGeom2dLinePtr()->handle());
gp_Dir2d dir = this_curve->Direction();
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(dir.X()));
arg.setItem(1, Py::Float(dir.Y()));
return method.apply(arg);
return Base::Vector2dPy::create(dir.X(), dir.Y());
}
void Line2dPy::setDirection(Py::Object arg)