Part: use of factory method of Vector2dPy
This commit is contained in:
@@ -59,13 +59,7 @@ int ArcOfConic2dPy::PyInit(PyObject* /*args*/, PyObject* /*kwds*/)
|
||||
Py::Object ArcOfConic2dPy::getLocation(void) const
|
||||
{
|
||||
Base::Vector2d loc = getGeom2dArcOfConicPtr()->getLocation();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.x));
|
||||
arg.setItem(1, Py::Float(loc.y));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc);
|
||||
}
|
||||
|
||||
void ArcOfConic2dPy::setLocation(Py::Object arg)
|
||||
@@ -86,12 +80,7 @@ Py::Object ArcOfConic2dPy::getXAxis(void) const
|
||||
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
|
||||
gp_Dir2d xdir = conic->XAxis().Direction();
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(xdir.X()));
|
||||
arg.setItem(1, Py::Float(xdir.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(xdir.X(), xdir.Y());
|
||||
}
|
||||
|
||||
void ArcOfConic2dPy::setXAxis(Py::Object arg)
|
||||
@@ -109,12 +98,7 @@ Py::Object ArcOfConic2dPy::getYAxis(void) const
|
||||
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
|
||||
gp_Dir2d ydir = conic->YAxis().Direction();
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(ydir.X()));
|
||||
arg.setItem(1, Py::Float(ydir.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(ydir.X(), ydir.Y());
|
||||
}
|
||||
|
||||
void ArcOfConic2dPy::setYAxis(Py::Object arg)
|
||||
|
||||
@@ -117,7 +117,6 @@ PyObject* BSplineCurve2dPy::increaseDegree(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -144,7 +143,6 @@ PyObject* BSplineCurve2dPy::increaseMultiplicity(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -162,7 +160,6 @@ PyObject* BSplineCurve2dPy::incrementMultiplicity(PyObject * args)
|
||||
curve->IncrementMultiplicity(start, end, mult);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -183,7 +180,6 @@ PyObject* BSplineCurve2dPy::insertKnot(PyObject * args)
|
||||
curve->InsertKnot(U,M,tol);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -224,7 +220,6 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -246,7 +241,6 @@ PyObject* BSplineCurve2dPy::removeKnot(PyObject * args)
|
||||
return PyBool_FromLong(ok ? 1 : 0);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -264,7 +258,6 @@ PyObject* BSplineCurve2dPy::segment(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -322,7 +315,6 @@ PyObject* BSplineCurve2dPy::setKnots(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -344,7 +336,6 @@ PyObject* BSplineCurve2dPy::getKnots(PyObject * args)
|
||||
return Py::new_reference_to(knots);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -369,7 +360,6 @@ PyObject* BSplineCurve2dPy::setPole(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -386,16 +376,9 @@ PyObject* BSplineCurve2dPy::getPole(PyObject * args)
|
||||
Standard_OutOfRange_Raise_if
|
||||
(index < 1 || index > curve->NbPoles(), "Pole index out of range");
|
||||
gp_Pnt2d pnt = curve->Pole(index);
|
||||
|
||||
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 Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(pnt.X(), pnt.Y()));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -412,20 +395,13 @@ PyObject* BSplineCurve2dPy::getPoles(PyObject * args)
|
||||
curve->Poles(p);
|
||||
|
||||
Py::List poles;
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) {
|
||||
gp_Pnt2d pnt = p(i);
|
||||
|
||||
arg.setItem(0, Py::Float(pnt.X()));
|
||||
arg.setItem(1, Py::Float(pnt.Y()));
|
||||
poles.append(method.apply(arg));
|
||||
poles.append(Base::Vector2dPy::create(pnt.X(), pnt.Y()));
|
||||
}
|
||||
return Py::new_reference_to(poles);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -456,7 +432,6 @@ PyObject* BSplineCurve2dPy::getPolesAndWeights(PyObject * args)
|
||||
return Py::new_reference_to(poles);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -475,7 +450,6 @@ PyObject* BSplineCurve2dPy::setWeight(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -495,7 +469,6 @@ PyObject* BSplineCurve2dPy::getWeight(PyObject * args)
|
||||
return Py_BuildValue("d", weight);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -517,7 +490,6 @@ PyObject* BSplineCurve2dPy::getWeights(PyObject * args)
|
||||
return Py::new_reference_to(weights);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -536,7 +508,6 @@ PyObject* BSplineCurve2dPy::getResolution(PyObject * args)
|
||||
return Py_BuildValue("d",utol);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -558,7 +529,6 @@ PyObject* BSplineCurve2dPy::movePoint(PyObject * args)
|
||||
return Py_BuildValue("(ii)",first, last);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -575,7 +545,6 @@ PyObject* BSplineCurve2dPy::setNotPeriodic(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -592,7 +561,6 @@ PyObject* BSplineCurve2dPy::setPeriodic(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -610,7 +578,6 @@ PyObject* BSplineCurve2dPy::setOrigin(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -650,7 +617,6 @@ PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args)
|
||||
return Py::new_reference_to(mults);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -689,13 +655,7 @@ Py::Object BSplineCurve2dPy::getStartPoint(void) const
|
||||
Handle(Geom2d_BSplineCurve) c = Handle(Geom2d_BSplineCurve)::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
gp_Pnt2d pnt = c->StartPoint();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
Py::Object BSplineCurve2dPy::getEndPoint(void) const
|
||||
@@ -703,13 +663,7 @@ Py::Object BSplineCurve2dPy::getEndPoint(void) const
|
||||
Handle(Geom2d_BSplineCurve) c = Handle(Geom2d_BSplineCurve)::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
gp_Pnt2d pnt = c->EndPoint();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
Py::Object BSplineCurve2dPy::getFirstUKnotIndex(void) const
|
||||
@@ -769,7 +723,6 @@ PyObject* BSplineCurve2dPy::toBiArcs(PyObject * args)
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -890,7 +843,6 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -917,13 +869,8 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject *
|
||||
bspline->getCardinalSplineTangents(interpPoints, parameter, tangents);
|
||||
|
||||
Py::List vec;
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (gp_Vec2d it : tangents) {
|
||||
arg.setItem(0, Py::Float(it.X()));
|
||||
arg.setItem(1, Py::Float(it.Y()));
|
||||
vec.append(method.apply(arg));
|
||||
vec.append(Base::Vector2dPy::create(it.X(), it.Y()));
|
||||
}
|
||||
return Py::new_reference_to(vec);
|
||||
}
|
||||
@@ -952,18 +899,13 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject *
|
||||
bspline->getCardinalSplineTangents(interpPoints, parameters, tangents);
|
||||
|
||||
Py::List vec;
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (gp_Vec2d it : tangents) {
|
||||
arg.setItem(0, Py::Float(it.X()));
|
||||
arg.setItem(1, Py::Float(it.Y()));
|
||||
vec.append(method.apply(arg));
|
||||
vec.append(Base::Vector2dPy::create(it.X(), it.Y()));
|
||||
}
|
||||
return Py::new_reference_to(vec);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
@@ -1057,7 +999,6 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
std::string err = e.GetMessageString();
|
||||
if (err.empty()) err = e.DynamicType()->Name();
|
||||
PyErr_SetString(PartExceptionOCCError, err.c_str());
|
||||
@@ -1137,7 +1078,6 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ PyObject* BezierCurve2dPy::insertPoleAfter(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -135,7 +134,6 @@ PyObject* BezierCurve2dPy::insertPoleBefore(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -153,7 +151,6 @@ PyObject* BezierCurve2dPy::removePole(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -171,7 +168,6 @@ PyObject* BezierCurve2dPy::segment(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -196,7 +192,6 @@ PyObject* BezierCurve2dPy::setPole(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -213,16 +208,9 @@ PyObject* BezierCurve2dPy::getPole(PyObject * args)
|
||||
Standard_OutOfRange_Raise_if
|
||||
(index < 1 || index > curve->NbPoles(), "Pole index out of range");
|
||||
gp_Pnt2d pnt = curve->Pole(index);
|
||||
|
||||
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 Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(pnt.X(), pnt.Y()));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -239,20 +227,13 @@ PyObject* BezierCurve2dPy::getPoles(PyObject * args)
|
||||
curve->Poles(p);
|
||||
Py::List poles;
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) {
|
||||
gp_Pnt2d pnt = p(i);
|
||||
|
||||
arg.setItem(0, Py::Float(pnt.X()));
|
||||
arg.setItem(1, Py::Float(pnt.Y()));
|
||||
poles.append(method.apply(arg));
|
||||
poles.append(Base::Vector2dPy::create(pnt.X(), pnt.Y()));
|
||||
}
|
||||
return Py::new_reference_to(poles);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -277,7 +258,6 @@ PyObject* BezierCurve2dPy::setPoles(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -296,7 +276,6 @@ PyObject* BezierCurve2dPy::setWeight(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -316,7 +295,6 @@ PyObject* BezierCurve2dPy::getWeight(PyObject * args)
|
||||
return Py_BuildValue("d", weight);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -338,7 +316,6 @@ PyObject* BezierCurve2dPy::getWeights(PyObject * args)
|
||||
return Py::new_reference_to(weights);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -357,7 +334,6 @@ PyObject* BezierCurve2dPy::getResolution(PyObject* args)
|
||||
return Py_BuildValue("d",utol);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -388,13 +364,7 @@ Py::Object BezierCurve2dPy::getStartPoint(void) const
|
||||
Handle(Geom2d_BezierCurve) c = Handle(Geom2d_BezierCurve)::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
gp_Pnt2d pnt = c->StartPoint();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
Py::Object BezierCurve2dPy::getEndPoint(void) const
|
||||
@@ -402,13 +372,7 @@ Py::Object BezierCurve2dPy::getEndPoint(void) const
|
||||
Handle(Geom2d_BezierCurve) c = Handle(Geom2d_BezierCurve)::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
gp_Pnt2d pnt = c->EndPoint();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
PyObject *BezierCurve2dPy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
||||
@@ -57,13 +57,7 @@ int Conic2dPy::PyInit(PyObject* /*args*/, PyObject* /*kwds*/)
|
||||
Py::Object Conic2dPy::getLocation(void) const
|
||||
{
|
||||
Base::Vector2d loc = getGeom2dConicPtr()->getLocation();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.x));
|
||||
arg.setItem(1, Py::Float(loc.y));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc);
|
||||
}
|
||||
|
||||
void Conic2dPy::setLocation(Py::Object arg)
|
||||
@@ -82,12 +76,7 @@ Py::Object Conic2dPy::getXAxis(void) const
|
||||
{
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(getGeom2dConicPtr()->handle());
|
||||
gp_Dir2d xdir = conic->XAxis().Direction();
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(xdir.X()));
|
||||
arg.setItem(1, Py::Float(xdir.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(xdir.X(), xdir.Y());
|
||||
}
|
||||
|
||||
void Conic2dPy::setXAxis(Py::Object arg)
|
||||
@@ -103,12 +92,7 @@ Py::Object Conic2dPy::getYAxis(void) const
|
||||
{
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(getGeom2dConicPtr()->handle());
|
||||
gp_Dir2d ydir = conic->YAxis().Direction();
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(ydir.X()));
|
||||
arg.setItem(1, Py::Float(ydir.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(ydir.X(), ydir.Y());
|
||||
}
|
||||
|
||||
void Conic2dPy::setYAxis(Py::Object arg)
|
||||
|
||||
@@ -107,7 +107,6 @@ PyObject* Curve2dPy::reverse(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -187,7 +186,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
|
||||
return Py::new_reference_to(shape2pyshape(edge));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -204,7 +202,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
|
||||
return Py::new_reference_to(shape2pyshape(edge));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -225,7 +222,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
|
||||
return Py::new_reference_to(shape2pyshape(edge));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -265,7 +261,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
|
||||
return Py::new_reference_to(shape2pyshape(edge));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -285,7 +280,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
|
||||
return Py::new_reference_to(shape2pyshape(edge));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -321,14 +315,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -351,14 +340,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -379,14 +363,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt p = discretizer.Value (i);
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -409,14 +388,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt p = discretizer.Value (i);
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -437,14 +411,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -464,15 +433,9 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
|
||||
if (discretizer.NbPoints () > 0) {
|
||||
Py::List points;
|
||||
int nbPoints = discretizer.NbPoints ();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
for (int i=1; i<=nbPoints; i++) {
|
||||
gp_Pnt p = discretizer.Value (i);
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
@@ -509,7 +472,6 @@ PyObject* Curve2dPy::length(PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -535,7 +497,6 @@ PyObject* Curve2dPy::parameterAtDistance(PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -554,17 +515,10 @@ PyObject* Curve2dPy::value(PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "d", &u))
|
||||
return 0;
|
||||
gp_Pnt2d p = c->Value(u);
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(p.X()));
|
||||
arg.setItem(1, Py::Float(p.Y()));
|
||||
return Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(p.X(), p.Y()));
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -588,16 +542,10 @@ PyObject* Curve2dPy::tangent(PyObject *args)
|
||||
prop.Tangent(dir);
|
||||
}
|
||||
|
||||
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 Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(dir.X(), dir.Y()));
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -619,16 +567,10 @@ PyObject* Curve2dPy::normal(PyObject *args)
|
||||
Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion());
|
||||
prop.Normal(dir);
|
||||
|
||||
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 Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(dir.X(), dir.Y()));
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -652,7 +594,6 @@ PyObject* Curve2dPy::curvature(PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -674,16 +615,10 @@ PyObject* Curve2dPy::centerOfCurvature(PyObject *args)
|
||||
gp_Pnt2d pnt ;
|
||||
prop.CentreOfCurvature(pnt);
|
||||
|
||||
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 Py::new_reference_to(method.apply(arg));
|
||||
return Py::new_reference_to(Base::Vector2dPy::create(pnt.X(), pnt.Y()));
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -737,7 +672,6 @@ PyObject* Curve2dPy::toBSpline(PyObject * args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -791,7 +725,6 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
@@ -874,11 +807,9 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
|
||||
double prec = Precision::Confusion();
|
||||
if (!PyArg_ParseTuple(args, "O!|d", &(Part::Curve2dPy::Type), &p, &prec))
|
||||
return 0;
|
||||
|
||||
Handle(Geom2d_Curve) curve2 = Handle(Geom2d_Curve)::DownCast(static_cast<Geometry2dPy*>(p)->getGeometry2dPtr()->handle());
|
||||
Py::List points;
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
Geom2dAPI_InterCurveCurve intersector(curve1, curve2, prec);
|
||||
if ((intersector.NbPoints() == 0) && (intersector.NbSegments() == 0)) {
|
||||
// No intersection
|
||||
@@ -888,9 +819,7 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
|
||||
// Cross intersections
|
||||
for (int i = 1; i <= intersector.NbPoints(); i++) {
|
||||
gp_Pnt2d p1 = intersector.Point(i);
|
||||
arg.setItem(0, Py::Float(p1.X()));
|
||||
arg.setItem(1, Py::Float(p1.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p1.X(), p1.Y()));
|
||||
}
|
||||
}
|
||||
if (intersector.NbSegments() > 0) {
|
||||
@@ -905,17 +834,13 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
|
||||
continue;
|
||||
gp_Pnt2d p1, p2;
|
||||
intersector2.Points(i, p1, p2);
|
||||
|
||||
arg.setItem(0, Py::Float(p1.X()));
|
||||
arg.setItem(1, Py::Float(p1.Y()));
|
||||
points.append(method.apply(arg));
|
||||
points.append(Base::Vector2dPy::create(p1.X(), p1.Y()));
|
||||
}
|
||||
}
|
||||
return Py::new_reference_to(points);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -160,26 +160,14 @@ Py::Object Ellipse2dPy::getFocus1(void) const
|
||||
{
|
||||
Handle(Geom2d_Ellipse) ellipse = Handle(Geom2d_Ellipse)::DownCast(getGeom2dEllipsePtr()->handle());
|
||||
gp_Pnt2d loc = ellipse->Focus1();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.X()));
|
||||
arg.setItem(1, Py::Float(loc.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc.X(), loc.Y());
|
||||
}
|
||||
|
||||
Py::Object Ellipse2dPy::getFocus2(void) const
|
||||
{
|
||||
Handle(Geom2d_Ellipse) ellipse = Handle(Geom2d_Ellipse)::DownCast(getGeom2dEllipsePtr()->handle());
|
||||
gp_Pnt2d loc = ellipse->Focus2();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.X()));
|
||||
arg.setItem(1, Py::Float(loc.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc.X(), loc.Y());
|
||||
}
|
||||
|
||||
PyObject *Ellipse2dPy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
||||
@@ -160,26 +160,14 @@ Py::Object Hyperbola2dPy::getFocus1(void) const
|
||||
{
|
||||
Handle(Geom2d_Hyperbola) hyperbola = Handle(Geom2d_Hyperbola)::DownCast(getGeom2dHyperbolaPtr()->handle());
|
||||
gp_Pnt2d loc = hyperbola->Focus1();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.X()));
|
||||
arg.setItem(1, Py::Float(loc.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc.X(), loc.Y());
|
||||
}
|
||||
|
||||
Py::Object Hyperbola2dPy::getFocus2(void) const
|
||||
{
|
||||
Handle(Geom2d_Hyperbola) hyperbola = Handle(Geom2d_Hyperbola)::DownCast(getGeom2dHyperbolaPtr()->handle());
|
||||
gp_Pnt2d loc = hyperbola->Focus2();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.X()));
|
||||
arg.setItem(1, Py::Float(loc.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc.X(), loc.Y());
|
||||
}
|
||||
|
||||
PyObject *Hyperbola2dPy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -201,13 +201,7 @@ Py::Object Line2dSegmentPy::getStartPoint(void) const
|
||||
Handle(Geom2d_TrimmedCurve) this_curve = Handle(Geom2d_TrimmedCurve)::DownCast
|
||||
(this->getGeom2dLineSegmentPtr()->handle());
|
||||
gp_Pnt2d pnt = this_curve->StartPoint();
|
||||
|
||||
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 Line2dSegmentPy::setStartPoint(Py::Object arg)
|
||||
@@ -261,13 +255,7 @@ Py::Object Line2dSegmentPy::getEndPoint(void) const
|
||||
Handle(Geom2d_TrimmedCurve) this_curve = Handle(Geom2d_TrimmedCurve)::DownCast
|
||||
(this->getGeom2dLineSegmentPtr()->handle());
|
||||
gp_Pnt2d pnt = this_curve->EndPoint();
|
||||
|
||||
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 Line2dSegmentPy::setEndPoint(Py::Object arg)
|
||||
|
||||
@@ -76,13 +76,7 @@ Py::Object Parabola2dPy::getFocus(void) const
|
||||
{
|
||||
Handle(Geom2d_Parabola) curve = Handle(Geom2d_Parabola)::DownCast(getGeometry2dPtr()->handle());
|
||||
gp_Pnt2d loc = curve->Focus();
|
||||
|
||||
Py::Module module("__FreeCADBase__");
|
||||
Py::Callable method(module.getAttr("Vector2d"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(loc.X()));
|
||||
arg.setItem(1, Py::Float(loc.Y()));
|
||||
return method.apply(arg);
|
||||
return Base::Vector2dPy::create(loc.X(), loc.Y());
|
||||
}
|
||||
|
||||
Py::Float Parabola2dPy::getParameter(void) const
|
||||
|
||||
Reference in New Issue
Block a user