From 40e266dcf491f0f16c65e0dcce2246d4ff331caf Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Thu, 30 Mar 2023 19:00:18 +0200 Subject: [PATCH] Gui: prevent crashes on MacOS using boost::format --- src/Mod/Part/Gui/TaskOffset.cpp | 4 +- src/Mod/Part/Gui/TaskThickness.cpp | 4 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 82 ++++++++++----------- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 12 +-- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 10 +-- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/Mod/Part/Gui/TaskOffset.cpp b/src/Mod/Part/Gui/TaskOffset.cpp index 0701a0e7fc6f..9d33745d6e8c 100644 --- a/src/Mod/Part/Gui/TaskOffset.cpp +++ b/src/Mod/Part/Gui/TaskOffset.cpp @@ -174,8 +174,8 @@ bool OffsetWidget::accept() double offsetValue = d->ui.spinOffset->value().getValue(); Gui::cmdAppObjectArgs(d->offset, "Value = %f", offsetValue); d->ui.spinOffset->apply(); - Gui::cmdAppObjectArgs(d->offset, "Mode = %i", d->ui.modeType->currentIndex()); - Gui::cmdAppObjectArgs(d->offset, "Join = %i", d->ui.joinType->currentIndex()); + Gui::cmdAppObjectArgs(d->offset, "Mode = %d", d->ui.modeType->currentIndex()); + Gui::cmdAppObjectArgs(d->offset, "Join = %d", d->ui.joinType->currentIndex()); Gui::cmdAppObjectArgs(d->offset, "Intersection = %s", d->ui.intersection->isChecked() ? "True" : "False"); Gui::cmdAppObjectArgs(d->offset, "SelfIntersection = %s", d->ui.selfIntersection->isChecked() ? "True" : "False"); Gui::cmdAppObjectArgs(d->offset, "Fill = %s", d->ui.fillOffset->isChecked() ? "True" : "False"); diff --git a/src/Mod/Part/Gui/TaskThickness.cpp b/src/Mod/Part/Gui/TaskThickness.cpp index 859fef4c073c..0f38d380e9a2 100644 --- a/src/Mod/Part/Gui/TaskThickness.cpp +++ b/src/Mod/Part/Gui/TaskThickness.cpp @@ -221,8 +221,8 @@ bool ThicknessWidget::accept() Gui::cmdAppObjectArgs(d->thickness, "Faces = %s", d->selection.c_str()); } Gui::cmdAppObjectArgs(d->thickness, "Value = %f", d->ui.spinOffset->value().getValue()); - Gui::cmdAppObjectArgs(d->thickness, "Mode = %i", d->ui.modeType->currentIndex()); - Gui::cmdAppObjectArgs(d->thickness, "Join = %i", d->ui.joinType->currentIndex()); + Gui::cmdAppObjectArgs(d->thickness, "Mode = %d", d->ui.modeType->currentIndex()); + Gui::cmdAppObjectArgs(d->thickness, "Join = %d", d->ui.joinType->currentIndex()); Gui::cmdAppObjectArgs(d->thickness, "Intersection = %s", d->ui.intersection->isChecked() ? "True" : "False"); Gui::cmdAppObjectArgs(d->thickness, "SelfIntersection = %s", diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 2f38510e0f9d..58cb9c2eb1d8 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1444,10 +1444,10 @@ void CmdSketcherConstrainLock::activated(int iMsg) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", lastconstraintindex-1,"False"); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", lastconstraintindex,"False"); } } @@ -1483,10 +1483,10 @@ void CmdSketcherConstrainLock::activated(int iMsg) if ( (refpointfixed && pointfixed) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", lastconstraintindex-1,"False"); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", lastconstraintindex,"False"); } } @@ -1527,9 +1527,9 @@ void CmdSketcherConstrainLock::applyConstraint(std::vector &selSeq, i // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(sketchgui->getObject(), "setDriving(%i, %s)", ConStr.size()-2, "False"); + Gui::cmdAppObjectArgs(sketchgui->getObject(), "setDriving(%d, %s)", ConStr.size()-2, "False"); - Gui::cmdAppObjectArgs(sketchgui->getObject(), "setDriving(%i, %s)", ConStr.size()-1, "False"); + Gui::cmdAppObjectArgs(sketchgui->getObject(), "setDriving(%d, %s)", ConStr.size()-1, "False"); } // finish the transaction and update @@ -1929,10 +1929,10 @@ bool CmdSketcherConstrainCoincident::substituteConstraintCombinations(SketchObje if( constraintExists ) { // try to remove any pre-existing direct coincident constraints - Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%i,%i)", GeoId1, static_cast(PosId1)); + Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%d,%d)", GeoId1, static_cast(PosId1)); } - Gui::cmdAppObjectArgs(Obj, "delConstraint(%i)", j); + Gui::cmdAppObjectArgs(Obj, "delConstraint(%d)", j); doEndpointTangency(Obj, GeoId1, GeoId2, PosId1, PosId2); @@ -1951,7 +1951,7 @@ bool CmdSketcherConstrainCoincident::substituteConstraintCombinations(SketchObje // if a similar tangency already exists this must result in bad constraints if ((*it)->SecondPos == Sketcher::PointPos::none) { - Gui::cmdAppObjectArgs(Obj, "delConstraint(%i)", j); + Gui::cmdAppObjectArgs(Obj, "delConstraint(%d)", j); doEndpointTangency(Obj, GeoId1, GeoId2, PosId1, PosId2); @@ -2247,7 +2247,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) const std::vector &ConStr = Obj->Constraints.getValues(); Gui::cmdAppObjectArgs(selection[0].getObject(), - "setDriving(%i,%s)", + "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2280,7 +2280,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) const std::vector &ConStr = Obj->Constraints.getValues(); Gui::cmdAppObjectArgs(selection[0].getObject(), - "setDriving(%i,%s)", + "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2329,7 +2329,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) const std::vector &ConStr = Obj->Constraints.getValues(); Gui::cmdAppObjectArgs(selection[0].getObject(), - "setDriving(%i,%s)", + "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2364,7 +2364,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) constraintCreationMode==Reference) { const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2426,7 +2426,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2459,7 +2459,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2503,7 +2503,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2553,7 +2553,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2640,7 +2640,7 @@ bool CmdSketcherConstrainPointOnObject::substituteConstraintCombinations( Sket // NOTE: This function does not either open or commit a command as it is used for group addition // it relies on such infrastructure being provided by the caller. - Gui::cmdAppObjectArgs(Obj, "delConstraint(%i)", cid); + Gui::cmdAppObjectArgs(Obj, "delConstraint(%d)", cid); doEndpointToEdgeTangency(Obj, GeoId1, PosId1, GeoId2); @@ -2951,7 +2951,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -2984,7 +2984,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -3057,7 +3057,7 @@ void CmdSketcherConstrainDistanceX::applyConstraint(std::vector &selS // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -3206,7 +3206,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -3238,7 +3238,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -3310,7 +3310,7 @@ void CmdSketcherConstrainDistanceY::applyConstraint(std::vector &selS if (areBothPointsOrSegmentsFixed(Obj,GeoId1, GeoId2) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -4204,7 +4204,7 @@ bool CmdSketcherConstrainTangent::substituteConstraintCombinations(SketchObject doEndpointTangency(Obj, (*it)->First, (*it)->Second, (*it)->FirstPos, (*it)->SecondPos); - Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%i,%i)", first, firstpos); + Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%d,%d)", first, firstpos); commitCommand(); Obj->solve(); // The substitution requires a solve() so that the autoremove redundants works when Autorecompute not active. @@ -4223,7 +4223,7 @@ bool CmdSketcherConstrainTangent::substituteConstraintCombinations(SketchObject doEndpointToEdgeTangency(Obj, (*it)->First, (*it)->FirstPos, (*it)->Second); - Gui::cmdAppObjectArgs(Obj, "delConstraint(%i)", cid); // remove the preexisting point on object constraint. + Gui::cmdAppObjectArgs(Obj, "delConstraint(%d)", cid); // remove the preexisting point on object constraint. commitCommand(); @@ -5073,7 +5073,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) constrSize=ConStr.size(); - Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%i,%s)", constrSize-1,"False"); + Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%d,%s)", constrSize-1,"False"); } @@ -5121,7 +5121,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) if (constraintCreationMode==Reference) { const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", ConStr.size()-1,"False"); + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); } } } @@ -5187,7 +5187,7 @@ void CmdSketcherConstrainRadius::applyConstraint(std::vector &selSeq, bool fixed = isPointOrSegmentFixed(Obj,GeoId); if(fixed || constraintCreationMode==Reference) { - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1, "False"); updateNeeded=true; // We do need to update the solver DoF after setting the constraint driving. @@ -5365,7 +5365,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) constrSize=ConStr.size(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)",constrSize-1,"False"); + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)",constrSize-1,"False"); } finishDatumConstraint (this, Obj, false, externalGeoIdDiameterMap.size()); @@ -5404,7 +5404,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", ConStr.size()-1,"False"); + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1,"False"); } @@ -5473,7 +5473,7 @@ void CmdSketcherConstrainDiameter::applyConstraint(std::vector &selSe bool fixed = isPointOrSegmentFixed(Obj,GeoId); if(fixed || constraintCreationMode==Reference) { - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", ConStr.size()-1, "False"); + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1, "False"); updateNeeded=true; // We do need to update the solver DoF after setting the constraint driving. } @@ -5664,7 +5664,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) constrSize=ConStr.size(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)",constrSize-1,"False"); + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)",constrSize-1,"False"); } finishDatumConstraint (this, Obj, false, externalGeoIdRadiamMap.size()); @@ -5719,7 +5719,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", ConStr.size()-1,"False"); + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1,"False"); } @@ -5794,7 +5794,7 @@ void CmdSketcherConstrainRadiam::applyConstraint(std::vector &selSeq, bool fixed = isPointOrSegmentFixed(Obj,GeoId); if(fixed || constraintCreationMode==Reference) { - Gui::cmdAppObjectArgs(Obj, "setDriving(%i,%s)", ConStr.size()-1, "False"); + Gui::cmdAppObjectArgs(Obj, "setDriving(%d,%s)", ConStr.size()-1, "False"); updateNeeded=true; // We do need to update the solver DoF after setting the constraint driving. } @@ -6107,7 +6107,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) if (bothexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -6216,7 +6216,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) if (bothexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(),"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -6249,7 +6249,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -6273,7 +6273,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)", + Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -6390,7 +6390,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } @@ -6475,7 +6475,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); - Gui::cmdAppObjectArgs(Obj,"setDriving(%i,%s)", + Gui::cmdAppObjectArgs(Obj,"setDriving(%d,%s)", ConStr.size()-1,"False"); finishDatumConstraint (this, Obj, false); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 190f1febd2c7..1e7e31193f9c 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -806,7 +806,7 @@ void DrawSketchHandler::createAutoConstraints(const std::vector if (posId1 == Sketcher::PointPos::none) continue; // If the auto constraint has a point create a coincident otherwise it is an edge on a point - Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) " + Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) " , geoId1, static_cast(posId1), it->GeoId, static_cast(it->PosId)); } break; case Sketcher::PointOnObject: { @@ -817,18 +817,18 @@ void DrawSketchHandler::createAutoConstraints(const std::vector std::swap(posId1,posId2); } - Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%i,%i,%i)) " + Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) " , geoId1, static_cast(posId1), geoId2); } break; // In special case of Horizontal/Vertical constraint, geoId2 is normally unused and should be 'Constraint::GeoUndef' // However it can be used as a way to require the function to apply these constraints on another geometry // In this case the caller as to set geoId2, then it will be used as target instead of geoId2 case Sketcher::Horizontal: { - Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Horizontal',%i)) ", + Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Horizontal',%d)) ", geoId2 != GeoEnum::GeoUndef ? geoId2 : geoId1); } break; case Sketcher::Vertical: { - Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Vertical',%i)) ", + Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Vertical',%d)) ", geoId2 != GeoEnum::GeoUndef ? geoId2 : geoId1); } break; case Sketcher::Tangent: { @@ -883,7 +883,7 @@ void DrawSketchHandler::createAutoConstraints(const std::vector } } - Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Tangent',%i, %i)) " + Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Tangent',%d, %d)) " , geoId1, it->GeoId); } break; default: @@ -1001,4 +1001,4 @@ Sketcher::SketchObject * DrawSketchHandler::getSketchObject() void DrawSketchHandler::setAngleSnapping(bool enable, Base::Vector2d referencePoint) { ViewProviderSketchDrawSketchHandlerAttorney::setAngleSnapping(*sketchgui, enable, referencePoint); -} \ No newline at end of file +} diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 3a7543965d97..873e5d653f4d 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -806,7 +806,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) { getDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Drag Point")); try { - Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)" + Gui::cmdAppObjectArgs(getObject(), "movePoint(%d,%d,App.Vector(%f,%f,0),%d)" ,GeoId, static_cast(PosId), x-drag.xInit, y-drag.yInit, 0); getDocument()->commitCommand(); @@ -867,7 +867,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe } try { - Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)" + Gui::cmdAppObjectArgs(getObject(), "movePoint(%d,%d,App.Vector(%f,%f,0),%d)" ,drag.DragCurve, static_cast(Sketcher::PointPos::none), vec.x, vec.y, drag.relative ? 1 : 0); getDocument()->commitCommand(); @@ -3384,7 +3384,7 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) for (rit = delConstraints.rbegin(); rit != delConstraints.rend(); ++rit) { try { - Gui::cmdAppObjectArgs(getObject(), "delConstraint(%i)", *rit); + Gui::cmdAppObjectArgs(getObject(), "delConstraint(%d)", *rit); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -3408,7 +3408,7 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) if (((*it)->Type == Sketcher::Coincident) && (((*it)->First == GeoId && (*it)->FirstPos == PosId) || ((*it)->Second == GeoId && (*it)->SecondPos == PosId)) ) { try { - Gui::cmdAppObjectArgs(getObject(), "delConstraintOnPoint(%i,%i)", GeoId, (int)PosId); + Gui::cmdAppObjectArgs(getObject(), "delConstraintOnPoint(%d,%d)", GeoId, (int)PosId); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -3443,7 +3443,7 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) for (rit = delExternalGeometries.rbegin(); rit != delExternalGeometries.rend(); ++rit) { try { - Gui::cmdAppObjectArgs(getObject(), "delExternal(%i)", *rit); + Gui::cmdAppObjectArgs(getObject(), "delExternal(%d)", *rit); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what());