Sketcher: expose the LabelDistance and LabelPosition members of Constraint to Python
This commit is contained in:
@@ -1041,6 +1041,74 @@ PyObject* SketchObjectPy::toggleActive(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::getLabelPosition(PyObject* args)
|
||||
{
|
||||
int constrid {};
|
||||
float pos {};
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &constrid)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (this->getSketchObjectPtr()->getLabelPosition(constrid, pos)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid constraint id");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py::new_reference_to(Py::Float(pos));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::setLabelPosition(PyObject* args)
|
||||
{
|
||||
int constrid {};
|
||||
float pos {};
|
||||
|
||||
if (!PyArg_ParseTuple(args, "if", &constrid, &pos)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (this->getSketchObjectPtr()->setLabelPosition(constrid, pos)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid constraint id");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::getLabelDistance(PyObject* args)
|
||||
{
|
||||
int constrid {};
|
||||
float dist {};
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &constrid)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (this->getSketchObjectPtr()->getLabelDistance(constrid, dist)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid constraint id");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py::new_reference_to(Py::Float(dist));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::setLabelDistance(PyObject* args)
|
||||
{
|
||||
int constrid {};
|
||||
float dist {};
|
||||
|
||||
if (!PyArg_ParseTuple(args, "if", &constrid, &dist)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (this->getSketchObjectPtr()->setLabelDistance(constrid, dist)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid constraint id");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::movePoint(PyObject* args)
|
||||
{
|
||||
PyObject* pcObj;
|
||||
|
||||
Reference in New Issue
Block a user