Sketcher: Implement Python function getConstruction(geoId) to retrieve geometry construction status

This commit is contained in:
Abdullah Tahiri
2020-12-21 16:43:48 +01:00
committed by abdullahtahiriyo
parent 3a845e4d07
commit c79ac8d1fc
2 changed files with 23 additions and 0 deletions

View File

@@ -48,6 +48,11 @@
<UserDocu>set construction mode of a geometry on or off</UserDocu>
</Documentation>
</Methode>
<Methode Name="getConstruction">
<Documentation>
<UserDocu>returns the construction mode of a geometry</UserDocu>
</Documentation>
</Methode>
<Methode Name="addConstraint">
<Documentation>
<UserDocu>add a constraint to the sketch</UserDocu>

View File

@@ -280,6 +280,24 @@ PyObject* SketchObjectPy::setConstruction(PyObject *args)
Py_Return;
}
PyObject* SketchObjectPy::getConstruction(PyObject *args)
{
int Index;
if (!PyArg_ParseTuple(args, "i", &Index))
return 0;
auto gf = this->getSketchObjectPtr()->getGeometryFacade(Index);
if(gf)
return Py::new_reference_to(Py::Boolean(gf->getConstruction()));
std::stringstream str;
str << "Not able to retrieve construction mode of a geometry with the given index: " << Index;
PyErr_SetString(PyExc_ValueError, str.str().c_str());
return 0;
}
PyObject* SketchObjectPy::addConstraint(PyObject *args)
{
PyObject *pcObj;