allow to pass parameter range when creating a line from a line

This commit is contained in:
wmayer 2016-09-09 13:02:15 +02:00
parent ae02a456bf
commit 9370378ec7

View File

@ -101,6 +101,30 @@ int LinePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0; return 0;
} }
PyErr_Clear();
double first, last;
if (PyArg_ParseTuple(args, "O!dd", &(LinePy::Type), &pLine, &first, &last)) {
// Copy line
LinePy* pcLine = static_cast<LinePy*>(pLine);
// get Geom_Line of line segment
Handle_Geom_TrimmedCurve that_curv = Handle_Geom_TrimmedCurve::DownCast
(pcLine->getGeomLineSegmentPtr()->handle());
Handle_Geom_Line that_line = Handle_Geom_Line::DownCast
(that_curv->BasisCurve());
// get Geom_Line of line segment
Handle_Geom_TrimmedCurve this_curv = Handle_Geom_TrimmedCurve::DownCast
(this->getGeomLineSegmentPtr()->handle());
Handle_Geom_Line this_line = Handle_Geom_Line::DownCast
(this_curv->BasisCurve());
Infinite = pcLine->Infinite;
// Assign the lines
this_line->SetLin(that_line->Lin());
this_curv->SetTrim(first, last);
return 0;
}
PyErr_Clear(); PyErr_Clear();
PyObject *pV1, *pV2; PyObject *pV1, *pV2;
if (PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type), &pV1, if (PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type), &pV1,