23
#include "PreCompiled.h"
25
# include <Geom2d_Conic.hxx>
26
# include <Geom2d_TrimmedCurve.hxx>
29
#include <Base/GeometryPyCXX.h>
31
#include "Geom2d/ArcOfConic2dPy.h"
32
#include "Geom2d/ArcOfConic2dPy.cpp"
39
std::string ArcOfConic2dPy::representation() const
41
return "<Arc of conic2d object>";
44
PyObject *ArcOfConic2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
47
PyErr_SetString(PyExc_RuntimeError,
48
"You cannot create an instance of the abstract class 'ArcOfConic2d'.");
53
int ArcOfConic2dPy::PyInit(PyObject* , PyObject* )
58
Py::Object ArcOfConic2dPy::getLocation() const
60
Base::Vector2d loc = getGeom2dArcOfConicPtr()->getLocation();
61
return Base::Vector2dPy::create(loc);
64
void ArcOfConic2dPy::setLocation(Py::Object arg)
66
Base::Vector2d loc = Py::toVector2d(arg.ptr());
67
getGeom2dArcOfConicPtr()->setLocation(loc);
70
Py::Float ArcOfConic2dPy::getEccentricity() const
72
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
73
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
74
return Py::Float(conic->Eccentricity());
77
Py::Object ArcOfConic2dPy::getXAxis() const
79
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
80
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
81
gp_Dir2d xdir = conic->XAxis().Direction();
82
return Base::Vector2dPy::create(xdir.X(), xdir.Y());
85
void ArcOfConic2dPy::setXAxis(Py::Object arg)
87
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
88
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
89
Base::Vector2d dir = Py::toVector2d(arg.ptr());
90
gp_Ax2d xaxis = conic->XAxis();
91
xaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
92
conic->SetXAxis(xaxis);
95
Py::Object ArcOfConic2dPy::getYAxis() const
97
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
98
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
99
gp_Dir2d ydir = conic->YAxis().Direction();
100
return Base::Vector2dPy::create(ydir.X(), ydir.Y());
103
void ArcOfConic2dPy::setYAxis(Py::Object arg)
105
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
106
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
107
Base::Vector2d dir = Py::toVector2d(arg.ptr());
108
gp_Ax2d yaxis = conic->YAxis();
109
yaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
110
conic->SetYAxis(yaxis);
113
PyObject *ArcOfConic2dPy::getCustomAttributes(const char* ) const
118
int ArcOfConic2dPy::setCustomAttributes(const char* , PyObject *)