Sketcher: Driving/reference creation improvements and some other fixes
====================================================================== - Changing from Driving to reference does not include unnecessary solvings. - Added some checks to avoid making Driving constraints when calling directly from python and involving only external geometry (would give redundant constraints). - New python command toggleDriving to just change the status from reference to Driving - New UI toolbar Command to toggle constraints - Fix to allow switching from/to construction mode during continuous mode creation. - Enable/Disable for constraints in constraints widget has changed to operate on multiselection and now effects "toggle" instead of enable/disable. - Disable the option to directly create a SnellsLaw non-driving constraint (this constraint does not support direct creation, it can be toggled to non-driving after creation though).
This commit is contained in:
@@ -49,7 +49,7 @@ using namespace Sketcher;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string SketchObjectPy::representation(void) const
|
||||
{
|
||||
{
|
||||
return "<Sketcher::SketchObject>";
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ PyObject* SketchObjectPy::setDriving(PyObject *args)
|
||||
|
||||
if (this->getSketchObjectPtr()->setDriving(constrid, PyObject_IsTrue(driving) ? true : false)) {
|
||||
std::stringstream str;
|
||||
str << "Not able set Driving for constraint with the given index: " << constrid;
|
||||
str << "Not able set Driving/reference for constraint with the given index: " << constrid;
|
||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
@@ -603,6 +603,23 @@ PyObject* SketchObjectPy::getDriving(PyObject *args)
|
||||
return Py::new_reference_to(Py::Boolean(driving));
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::toggleDriving(PyObject *args)
|
||||
{
|
||||
int constrid;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &constrid))
|
||||
return 0;
|
||||
|
||||
if (this->getSketchObjectPtr()->toggleDriving(constrid)) {
|
||||
std::stringstream str;
|
||||
str << "Not able toggle Driving for constraint with the given index: " << constrid;
|
||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
|
||||
PyObject* SketchObjectPy::movePoint(PyObject *args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user