From e0ca4cf93c5f7d461cb8f796359c5eae8178ac41 Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Thu, 22 Jul 2021 13:07:15 +0200 Subject: [PATCH] [Sketcher] Display radius/diameter constraints with some angle So they are easily differentiated from distance constraints Default angle can be customized with 'BaseApp/Preferences/Mod/Sketcher/RaDiaAngle' --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 757394a3b4..de3ac3d607 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -91,6 +91,9 @@ bool isCreateConstraintActive(Gui::Document *doc) // Utility method to avoid repeating the same code over and over again void finishDistanceConstraint(Gui::Command* cmd, Sketcher::SketchObject* sketch, bool isDriven=true) { + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); + // Get the latest constraint const std::vector &ConStr = sketch->Constraints.getValues(); Sketcher::Constraint *constr = ConStr[ConStr.size() -1]; @@ -98,15 +101,16 @@ void finishDistanceConstraint(Gui::Command* cmd, Sketcher::SketchObject* sketch, // Guess some reasonable distance for placing the datum text Gui::Document *doc = cmd->getActiveGuiDocument(); float sf = 1.f; + float lp = hGrp->GetFloat("RadiusDiamConstraintDispAngle", 15) * (M_PI / 180); // Get radius/diameter constraint display angle if (doc && doc->getInEdit() && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { SketcherGui::ViewProviderSketch *vp = static_cast(doc->getInEdit()); sf = vp->getScaleFactor(); constr->LabelDistance = 2. * sf; + constr->LabelPosition = lp; // Can safely be done for all constraints as ignored by distances & angles vp->draw(false,false); // Redraw } - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool show = hGrp->GetBool("ShowDialogOnDistanceConstraint", true); // Ask for the value of the distance immediately