Sketch: expose several methods to Python
* expose detectDegeneratedGeometries to Python * expose removeDegeneratedGeometries to Python * expose delConstraintsToExternal to Python * expose evaluateConstraints to Python * expose validateConstraints to Python
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
// other python types
|
||||
#include "ConstraintPy.h"
|
||||
#include "GeometryFacadePy.h"
|
||||
#include "SketchAnalysis.h"
|
||||
|
||||
|
||||
using namespace Sketcher;
|
||||
@@ -260,6 +261,30 @@ PyObject* SketchObjectPy::deleteAllGeometry(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::detectDegeneratedGeometries(PyObject* args)
|
||||
{
|
||||
double tolerance {};
|
||||
if (!PyArg_ParseTuple(args, "d", &tolerance)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SketchAnalysis analyse(this->getSketchObjectPtr());
|
||||
int count = analyse.detectDegeneratedGeometries(tolerance);
|
||||
return Py::new_reference_to(Py::Long(count));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::removeDegeneratedGeometries(PyObject* args)
|
||||
{
|
||||
double tolerance {};
|
||||
if (!PyArg_ParseTuple(args, "d", &tolerance)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SketchAnalysis analyse(this->getSketchObjectPtr());
|
||||
int count = analyse.removeDegeneratedGeometries(tolerance);
|
||||
return Py::new_reference_to(Py::Long(count));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::deleteAllConstraints(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
@@ -617,6 +642,12 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::delConstraintsToExternal()
|
||||
{
|
||||
this->getSketchObjectPtr()->delConstraintsToExternal();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::setDatum(PyObject* args)
|
||||
{
|
||||
double Datum;
|
||||
@@ -1941,6 +1972,18 @@ PyObject* SketchObjectPy::makeMissingEquality(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::evaluateConstraints()
|
||||
{
|
||||
bool ok = this->getSketchObjectPtr()->evaluateConstraints();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::validateConstraints()
|
||||
{
|
||||
this->getSketchObjectPtr()->validateConstraints();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::autoRemoveRedundants(PyObject* args)
|
||||
{
|
||||
PyObject* updategeo = Py_True;
|
||||
|
||||
Reference in New Issue
Block a user