[Sketcher] Constrain first pole when created

By doing this, duplicate radius constraints are not made when deleting and
redefining second pole.
This commit is contained in:
Ajinkya Dahale
2022-03-08 05:32:33 -05:00
committed by abdullahtahiriyo
parent 0f093f4221
commit c596c2fe3d

View File

@@ -4632,13 +4632,16 @@ public:
// insert circle point for pole, defer internal alignment constraining.
try {
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add Pole circle"));
//Add pole
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
EditCurve[0].x,EditCurve[0].y);
FirstPoleGeoId = getHighestCurveIndex();
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Weight',%d,%f)) ",
FirstPoleGeoId, 1.0 ); // First pole defaults to 1.0 weight
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
@@ -4653,8 +4656,6 @@ public:
//static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
FirstPoleGeoId = getHighestCurveIndex();
// add auto constraints on pole
if (sugConstr[CurrentConstraint].size() > 0) {
createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::PointPos::mid, false);
@@ -4698,11 +4699,6 @@ public:
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
EditCurve[EditCurve.size()-1].x,EditCurve[EditCurve.size()-1].y);
if(EditCurve.size() == 2) {
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Weight',%d,%f)) ",
FirstPoleGeoId, 1.0 ); // First pole defaults to 1.0 weight
}
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Equal',%d,%d)) ",
FirstPoleGeoId, FirstPoleGeoId+ EditCurve.size()-1);
}