diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index a461fe6eca..fa2ed4043e 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -2428,11 +2428,24 @@ void GeomArcOfCircle::setRadius(double Radius) } } +/*! + * \brief GeomArcOfCircle::getAngle + * \param emulateCCWXY: if true, the arc will pretend to be a CCW arc in XY plane. + * For this to work, the arc must lie in XY plane (i.e. Axis is either +Z or -Z). + */ +double GeomArcOfCircle::getAngle(bool emulateCCWXY) const +{ + double startangle, endangle; + getRange(startangle, endangle, emulateCCWXY); + double angle = endangle - startangle; + return angle; +} + /*! * \brief GeomArcOfCircle::getRange * \param u [out] start angle of the arc, in radians. * \param v [out] end angle of the arc, in radians. - * \param emulateCCWXY: if true, the arc will pretent to be a CCW arc in XY plane. + * \param emulateCCWXY: if true, the arc will pretend to be a CCW arc in XY plane. * For this to work, the arc must lie in XY plane (i.e. Axis is either +Z or -Z). * Additionally, arc's rotation as a whole will be included in the returned u,v * (ArcOfCircle specific). diff --git a/src/Mod/Part/App/Geometry.h b/src/Mod/Part/App/Geometry.h index 6ca3eb8e33..aa92f85c2e 100644 --- a/src/Mod/Part/App/Geometry.h +++ b/src/Mod/Part/App/Geometry.h @@ -502,6 +502,8 @@ public: double getRadius() const; void setRadius(double Radius); + double getAngle(bool emulateCCWXY) const; + void getRange(double& u, double& v, bool emulateCCWXY) const override; void setRange(double u, double v, bool emulateCCWXY) override; diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index b9ef7c96d4..89f8e68f8f 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -8772,7 +8772,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) return; } } - else if (isEdge(GeoId1, PosId1)) {// line angle + else if (isEdge(GeoId1, PosId1)) {// line angle or arc angle if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { Gui::TranslatedUserWarning( Obj, @@ -8812,9 +8812,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) } else if (isArcOfCircle(*geom)) { auto arc = static_cast(geom); - double startangle, endangle; - arc->getRange(startangle, endangle, /*EmulateCCWXY=*/true); - double angle = endangle - startangle; + double angle = arc->getAngle(/*EmulateCCWXY=*/true); openCommand(QT_TRANSLATE_NOOP("Command", "Add angle constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(),