Part Module New Feature: Hyperbola & ArcOfHyperbola
- Completed Hyperbola c++ implementation and python wrapper - Created ArOfHyperbola c++ and python wrapper implementation
This commit is contained in:
committed by
Sebastian Hoogen
parent
3d87ef6b4f
commit
a551765bbe
@@ -33,6 +33,11 @@
|
||||
# include <GC_MakeArcOfCircle.hxx>
|
||||
# include <GC_MakeArcOfEllipse.hxx>
|
||||
# include <GC_MakeArcOfParabola.hxx>
|
||||
# include <gp_Hypr.hxx>
|
||||
# include <Geom_Hyperbola.hxx>
|
||||
# include <Geom_TrimmedCurve.hxx>
|
||||
# include <GC_MakeArcOfCircle.hxx>
|
||||
# include <GC_MakeArcOfHyperbola.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -41,6 +46,7 @@
|
||||
#include "CirclePy.h"
|
||||
#include "EllipsePy.h"
|
||||
#include "ParabolaPy.h"
|
||||
#include "HyperbolaPy.h"
|
||||
#include "OCCError.h"
|
||||
|
||||
#include <Base/VectorPy.h>
|
||||
@@ -164,6 +170,32 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::HyperbolaPy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) {
|
||||
try {
|
||||
Handle_Geom_Hyperbola hyperbola = Handle_Geom_Hyperbola::DownCast
|
||||
(static_cast<HyperbolaPy*>(o)->getGeomHyperbolaPtr()->handle());
|
||||
GC_MakeArcOfHyperbola arc(hyperbola->Hypr(), 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;
|
||||
|
||||
Reference in New Issue
Block a user