diff --git a/src/Mod/Part/App/ArcOfConicPy.xml b/src/Mod/Part/App/ArcOfConicPy.xml index 487afdc330..43745ba0fe 100644 --- a/src/Mod/Part/App/ArcOfConicPy.xml +++ b/src/Mod/Part/App/ArcOfConicPy.xml @@ -1,14 +1,14 @@ diff --git a/src/Mod/Part/App/ArcPy.xml b/src/Mod/Part/App/ArcPy.xml index 0e09e690d0..32948233c9 100644 --- a/src/Mod/Part/App/ArcPy.xml +++ b/src/Mod/Part/App/ArcPy.xml @@ -1,14 +1,14 @@ @@ -29,12 +29,5 @@ const Geom_Ellipse & value(void) const {return *getGeom_EllipsePtr();} --> - - - - Re-trims this curve to the provided parameter range ([Float=First, Float=Last]) - - - diff --git a/src/Mod/Part/App/ArcPyImp.cpp b/src/Mod/Part/App/ArcPyImp.cpp index bd6f217269..47348a19e8 100644 --- a/src/Mod/Part/App/ArcPyImp.cpp +++ b/src/Mod/Part/App/ArcPyImp.cpp @@ -197,31 +197,6 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) return -1; } -PyObject* ArcPy::setParameterRange(PyObject * args) -{ - Handle(Geom_Geometry) g = getGeomTrimmedCurvePtr()->handle(); - Handle(Geom_TrimmedCurve) c = Handle(Geom_TrimmedCurve)::DownCast(g); - try { - if (!c.IsNull()) { - double u,v; - u=c->FirstParameter(); - v=c->LastParameter(); - if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; - getGeomTrimmedCurvePtr()->setRange(u,v); - Py_Return; - } - } - catch (Base::CADKernelError& e) { - PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; - } - - PyErr_SetString(PartExceptionOCCError, "Geometry is not a trimmed curve"); - return 0; -} - - PyObject *ArcPy::getCustomAttributes(const char* /*attr*/) const { return 0; diff --git a/src/Mod/Part/App/BoundedCurvePyImp.cpp b/src/Mod/Part/App/BoundedCurvePyImp.cpp index 1e0b65acb2..47e9c2b0f3 100644 --- a/src/Mod/Part/App/BoundedCurvePyImp.cpp +++ b/src/Mod/Part/App/BoundedCurvePyImp.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2009 Werner Mayer * + * Copyright (c) 2019 Abdullah Tahiri diff --git a/src/Mod/Part/App/TrimmedCurvePy.xml b/src/Mod/Part/App/TrimmedCurvePy.xml new file mode 100644 index 0000000000..5749c3ca46 --- /dev/null +++ b/src/Mod/Part/App/TrimmedCurvePy.xml @@ -0,0 +1,28 @@ + + + + + + + The abstract class TrimmedCurve is the root class of all trimmed curve objects. + + + + + + Re-trims this curve to the provided parameter range ([Float=First, Float=Last]) + + + + + diff --git a/src/Mod/Part/App/TrimmedCurvePyImp.cpp b/src/Mod/Part/App/TrimmedCurvePyImp.cpp new file mode 100644 index 0000000000..40a365905d --- /dev/null +++ b/src/Mod/Part/App/TrimmedCurvePyImp.cpp @@ -0,0 +1,93 @@ +/*************************************************************************** + * Copyright (c) 2019 Abdullah Tahiri +#endif + +#include +#include + +#include "OCCError.h" + +#include "Geometry.h" +#include "TrimmedCurvePy.h" +#include "TrimmedCurvePy.cpp" + + +using namespace Part; + +// returns a string which represents the object e.g. when printed in python +std::string TrimmedCurvePy::representation(void) const +{ + return ""; +} + +PyObject *TrimmedCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper +{ + // never create such objects with the constructor + PyErr_SetString(PyExc_RuntimeError, + "You cannot create an instance of the abstract class 'BoundedCurve'."); + return 0; +} + +// constructor method +int TrimmedCurvePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) +{ + return 0; +} + +PyObject* TrimmedCurvePy::setParameterRange(PyObject * args) +{ + Handle(Geom_Geometry) g = getGeomTrimmedCurvePtr()->handle(); + Handle(Geom_TrimmedCurve) c = Handle(Geom_TrimmedCurve)::DownCast(g); + try { + if (!c.IsNull()) { + double u,v; + u=c->FirstParameter(); + v=c->LastParameter(); + if (!PyArg_ParseTuple(args, "|dd", &u,&v)) + return 0; + getGeomTrimmedCurvePtr()->setRange(u,v); + Py_Return; + } + } + catch (Base::CADKernelError& e) { + PyErr_SetString(PartExceptionOCCError, e.what()); + return 0; + } + + PyErr_SetString(PartExceptionOCCError, "Geometry is not a trimmed curve"); + return 0; +} + +PyObject *TrimmedCurvePy::getCustomAttributes(const char* /*attr*/) const +{ + return 0; +} + +int TrimmedCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) +{ + return 0; +}