Part Module New Feature: Parabola & ArcOfParabola

- Completed Parabola c++ implementation and python wrapper implementation
- Created ArOfParabola c++ and python wrapper implementation
This commit is contained in:
Abdullah Tahiri
2014-10-16 15:06:23 +02:00
committed by Sebastian Hoogen
parent 2b01506c65
commit 6997cc9991
8 changed files with 743 additions and 9 deletions

View File

@@ -26,16 +26,21 @@
# include <gp_Circ.hxx>
# include <Geom_Circle.hxx>
# include <gp_Elips.hxx>
# include <gp_Parab.hxx>
# include <Geom_Ellipse.hxx>
# include <Geom_Parabola.hxx>
# include <Geom_TrimmedCurve.hxx>
# include <GC_MakeArcOfCircle.hxx>
# include <GC_MakeArcOfEllipse.hxx>
# include <GC_MakeArcOfParabola.hxx>
#endif
#include "ArcPy.h"
#include "ArcPy.cpp"
#include "CirclePy.h"
#include "EllipsePy.h"
#include "ParabolaPy.h"
#include "OCCError.h"
#include <Base/VectorPy.h>
@@ -133,6 +138,32 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
}
PyErr_Clear();
if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::ParabolaPy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) {
try {
Handle_Geom_Parabola parabola = Handle_Geom_Parabola::DownCast
(static_cast<ParabolaPy*>(o)->getGeomParabolaPtr()->handle());
GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False);
if (!arc.IsDone()) {
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}
getGeomTrimmedCurvePtr()->setHandle(arc.Value());
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
catch (...) {
PyErr_SetString(PartExceptionOCCError, "creation of arc failed");
return -1;
}
}
// All checks failed
PyErr_SetString(PyExc_TypeError, "Arc constructor expects a conic curve and a parameter range");
return -1;