extend Python interface of sketcher and make non-parametic version working

This commit is contained in:
wmayer
2016-08-14 11:52:37 +02:00
parent d8298c6cff
commit 9a2114fdc5
5 changed files with 70 additions and 34 deletions

View File

@@ -63,6 +63,7 @@ int SketchPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
PyObject* SketchPy::solve(PyObject *args)
{
getSketchPtr()->resetSolver();
return Py::new_reference_to(Py::Int(getSketchPtr()->solve()));
}
@@ -169,10 +170,26 @@ Py::Int SketchPy::getConstraint(void) const
throw Py::AttributeError("Not yet implemented");
}
Py::Tuple SketchPy::getConstraints(void) const
Py::Tuple SketchPy::getConflicts(void) const
{
//return Py::Tuple();
throw Py::AttributeError("Not yet implemented");
std::vector<int> c = getSketchPtr()->getConflicting();
Py::Tuple t(c.size());
for (std::size_t i=0; i<c.size(); i++) {
t.setItem(i, Py::Long(c[i]));
}
return t;
}
Py::Tuple SketchPy::getRedundancies(void) const
{
std::vector<int> c = getSketchPtr()->getRedundant();
Py::Tuple t(c.size());
for (std::size_t i=0; i<c.size(); i++) {
t.setItem(i, Py::Long(c[i]));
}
return t;
}
Py::Tuple SketchPy::getGeometries(void) const