Sketcher: Python wrappers for new remove axes alignment algorithm

This commit is contained in:
Abdullah Tahiri
2021-06-19 08:56:08 +02:00
parent 11410fa53e
commit 87342ec668
2 changed files with 34 additions and 0 deletions

View File

@@ -242,6 +242,11 @@ If there is no such constraint an exception is raised.
<UserDocu>add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeAxesAlignment">
<Documentation>
<UserDocu>modifies constraints so that the shape is not forced to be aligned with axes.</UserDocu>
</Documentation>
</Methode>
<Methode Name="ExposeInternalGeometry">
<Documentation>
<UserDocu>Deprecated -- use exposeInternalGeometry</UserDocu>

View File

@@ -1293,6 +1293,35 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args)
throw Py::TypeError(error);
}
PyObject* SketchObjectPy::removeAxesAlignment(PyObject *args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return 0;
if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
std::vector<int> geoIdList;
Py::Sequence list(pcObj);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyLong_Check((*it).ptr()))
geoIdList.push_back(PyLong_AsLong((*it).ptr()));
}
int ret = this->getSketchObjectPtr()->removeAxesAlignment(geoIdList) + 1;
if(ret == -1)
throw Py::TypeError("Operation unsuccessful!");
Py_Return;
}
std::string error = std::string("type must be list of GeoIds, not ");
error += pcObj->ob_type->tp_name;
throw Py::TypeError(error);
}
PyObject* SketchObjectPy::calculateAngleViaPoint(PyObject *args)
{
int GeoId1=0, GeoId2=0;