23
#include "PreCompiled.h"
25
# include <GC_MakeArcOfParabola.hxx>
26
# include <Geom_Parabola.hxx>
27
# include <Geom_TrimmedCurve.hxx>
30
#include "ArcOfParabolaPy.h"
31
#include "ArcOfParabolaPy.cpp"
32
#include "ParabolaPy.h"
38
extern const char* gce_ErrorStatusText(gce_ErrorType et);
41
std::string ArcOfParabolaPy::representation() const
43
Handle(Geom_TrimmedCurve) trim = Handle(Geom_TrimmedCurve)::DownCast
44
(getGeomArcOfParabolaPtr()->handle());
45
Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast(trim->BasisCurve());
47
gp_Ax1 axis = parabola->Axis();
48
gp_Dir dir = axis.Direction();
49
gp_Pnt loc = axis.Location();
50
Standard_Real fFocal = parabola->Focal();
51
Standard_Real u1 = trim->FirstParameter();
52
Standard_Real u2 = trim->LastParameter();
54
gp_Dir normal = parabola->Axis().Direction();
55
gp_Dir xdir = parabola->XAxis().Direction();
57
gp_Ax2 xdirref(loc, normal);
59
Standard_Real fAngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal);
62
std::stringstream str;
63
str << "ArcOfParabola (";
64
str << "Focal : " << fFocal << ", ";
65
str << "AngleXU : " << fAngleXU << ", ";
66
str << "Position : (" << loc.X() << ", "<< loc.Y() << ", "<< loc.Z() << "), ";
67
str << "Direction : (" << dir.X() << ", "<< dir.Y() << ", "<< dir.Z() << "), ";
68
str << "Parameter : (" << u1 << ", " << u2 << ")";
74
PyObject *ArcOfParabolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
77
return new ArcOfParabolaPy(new GeomArcOfParabola);
81
int ArcOfParabolaPy::PyInit(PyObject* args, PyObject* )
85
PyObject *sense=Py_True;
86
if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::ParabolaPy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) {
88
Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast
89
(static_cast<ParabolaPy*>(o)->getGeomParabolaPtr()->handle());
90
GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, Base::asBoolean(sense));
92
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
96
getGeomArcOfParabolaPtr()->setHandle(arc.Value());
99
catch (Standard_Failure& e) {
100
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
104
PyErr_SetString(PartExceptionOCCError, "creation of arc failed");
110
PyErr_SetString(PyExc_TypeError,
111
"ArcOfParabola constructor expects an parabola curve and a parameter range");
115
Py::Float ArcOfParabolaPy::getFocal() const
117
return Py::Float(getGeomArcOfParabolaPtr()->getFocal());
120
void ArcOfParabolaPy::setFocal(Py::Float arg)
122
getGeomArcOfParabolaPtr()->setFocal((double)arg);
125
Py::Object ArcOfParabolaPy::getParabola() const
127
Handle(Geom_TrimmedCurve) trim = Handle(Geom_TrimmedCurve)::DownCast
128
(getGeomArcOfParabolaPtr()->handle());
129
Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast(trim->BasisCurve());
130
return Py::Object(new ParabolaPy(new GeomParabola(parabola)), true);
133
PyObject *ArcOfParabolaPy::getCustomAttributes(const char* ) const
138
int ArcOfParabolaPy::setCustomAttributes(const char* , PyObject *)