[Sketcher] Allow experienced users to not have...

...the extra points created on rounded rectangles, it started to become a real pain when box selecting large amounts of geometry and having to keep changing the two points back to construction. New and existing users are completely unaffected.
This commit is contained in:
Syres916
2023-04-09 11:44:07 +01:00
committed by abdullahtahiriyo
parent 38cac0f995
commit 36bd6709bc

View File

@@ -511,27 +511,40 @@ public:
firstCurve + 4, firstCurve + 6, // equal 3
Gui::Command::getObjectCmd(sketchgui->getObject()).c_str()); // the sketch
// now add construction geometry - two points used to take suggested constraints
Gui::Command::doCommand(Gui::Command::Doc,
"geoList = []\n"
"geoList.append(Part.Point(App.Vector(%f, %f, 0)))\n"
"geoList.append(Part.Point(App.Vector(%f, %f, 0)))\n"
"%s.addGeometry(geoList, True)\n" // geometry as construction
"conList = []\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"%s.addConstraint(conList)\n"
"del geoList, conList\n",
StartPos.x, StartPos.y, // point at StartPos
EndPos.x, EndPos.y, // point at EndPos
Gui::Command::getObjectCmd(sketchgui->getObject()).c_str(), // the sketch
firstCurve + 8, firstCurve + 1, // point on object constraint
firstCurve + 8, firstCurve + 7, // point on object constraint
firstCurve + 9, firstCurve + 3, // point on object constraint
firstCurve + 9, firstCurve + 5, // point on object constraint
Gui::Command::getObjectCmd(sketchgui->getObject()).c_str()); // the sketch
// not all users want these extra points, some power users find them unnecessary
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Sketcher");
auto showExtraPoints = hGrp->GetBool("RoundRectangleSuggConstraints", true);
if (showExtraPoints) {
// now add construction geometry - two points used to take suggested constraints
Gui::Command::doCommand(
Gui::Command::Doc,
"geoList = []\n"
"geoList.append(Part.Point(App.Vector(%f, %f, 0)))\n"
"geoList.append(Part.Point(App.Vector(%f, %f, 0)))\n"
"%s.addGeometry(geoList, True)\n"// geometry as construction
"conList = []\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"conList.append(Sketcher.Constraint('PointOnObject', %i, 1, %i, ))\n"
"%s.addConstraint(conList)\n"
"del geoList, conList\n",
StartPos.x,
StartPos.y,// point at StartPos
EndPos.x,
EndPos.y,// point at EndPos
Gui::Command::getObjectCmd(sketchgui->getObject()).c_str(),// the sketch
firstCurve + 8,
firstCurve + 1,// point on object constraint
firstCurve + 8,
firstCurve + 7,// point on object constraint
firstCurve + 9,
firstCurve + 3,// point on object constraint
firstCurve + 9,
firstCurve + 5,// point on object constraint
Gui::Command::getObjectCmd(sketchgui->getObject()).c_str());// the sketch
}
Gui::Command::commitCommand();