+ fixes #0001380: Allow to set user-defined names for constraints

This commit is contained in:
wmayer
2014-02-10 15:36:58 +01:00
parent 006083258e
commit d81803de05
7 changed files with 59 additions and 8 deletions

View File

@@ -147,6 +147,28 @@ PyObject* SketchObjectPy::delConstraint(PyObject *args)
Py_Return;
}
PyObject* SketchObjectPy::renameConstraint(PyObject *args)
{
int Index;
char* Name;
if (!PyArg_ParseTuple(args, "is", &Index, &Name))
return 0;
if (this->getSketchObjectPtr()->Constraints.getSize() <= Index) {
std::stringstream str;
str << "Not able to rename a constraint with the given index: " << Index;
PyErr_SetString(PyExc_IndexError, str.str().c_str());
return 0;
}
Constraint* copy = this->getSketchObjectPtr()->Constraints[Index]->clone();
copy->Name = Name;
this->getSketchObjectPtr()->Constraints.set1Value(Index, copy);
delete copy;
Py_Return;
}
PyObject* SketchObjectPy::addExternal(PyObject *args)
{
char *ObjectName;