Part: Enable trimmed curves to set their parameter range, from c++ and Python

=============================================================================

>>> geometries = ActiveSketch.Geometry
>>> geo2 = geometries[2]
>>> geo2
ArcOfCircle (Radius : 27.5267, Position : (-70.4702, -31.8933, 0), Direction : (0, 0, 1), Parameter : (1.34187, 2.35619))
>>> geo2.setParameterRange(1,3)
>>> geometries[2]=geo2
>>> ActiveSketch.Geometry=geometries
This commit is contained in:
Abdullah Tahiri
2019-01-27 10:12:52 +01:00
committed by wmayer
parent 52cfac509a
commit f4e4f3441f
4 changed files with 76 additions and 19 deletions

View File

@@ -197,6 +197,31 @@ 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;
@@ -204,5 +229,5 @@ PyObject *ArcPy::getCustomAttributes(const char* /*attr*/) const
int ArcPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}