diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp
index d8f3001118..1a97616c34 100644
--- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp
+++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp
@@ -151,6 +151,8 @@ void SketcherSettingsDisplay::saveSettings()
ui->continueMode->onSave();
ui->constraintMode->onSave();
ui->checkBoxHideUnits->onSave();
+ ui->checkBoxShowDimensionalName->onSave();
+ ui->prefDimensionalStringFormat->onSave();
ui->checkBoxTVHideDependent->onSave();
ui->checkBoxTVShowLinks->onSave();
ui->checkBoxTVShowSupport->onSave();
@@ -173,6 +175,8 @@ void SketcherSettingsDisplay::loadSettings()
ui->continueMode->onRestore();
ui->constraintMode->onRestore();
ui->checkBoxHideUnits->onRestore();
+ ui->checkBoxShowDimensionalName->onRestore();
+ ui->prefDimensionalStringFormat->onRestore();
ui->checkBoxTVHideDependent->onRestore();
ui->checkBoxTVShowLinks->onRestore();
ui->checkBoxTVShowSupport->onRestore();
diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui
index 8913c29bed..3ba527ea93 100644
--- a/src/Mod/Sketcher/Gui/SketcherSettings.ui
+++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui
@@ -6,8 +6,8 @@
0
0
- 602
- 614
+ 500
+ 536
@@ -193,6 +193,10 @@ Requires to re-enter edit mode to take effect.
checkBoxAdvancedSolverTaskBox
+ checkBoxRecalculateInitialSolutionWhileDragging
+ checkBoxAutoRemoveRedundants
+ checkBoxEnableEscape
+ checkBoxNotifyConstraintSubstitutions
diff --git a/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui b/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui
index 830b27a8bd..60f8c2237c 100644
--- a/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui
+++ b/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui
@@ -7,93 +7,21 @@
0
0
500
- 515
+ 553
Display
-
- -
-
+
+
-
+
Sketch editing
-
-
-
-
-
- A dialog will pop up to input a value for new dimensional constraints
-
-
- Ask for value after creating a dimensional constraint
-
-
- true
-
-
- ShowDialogOnDistanceConstraint
-
-
- Mod/Sketcher
-
-
-
- -
-
-
- Segments per geometry
-
-
-
- -
-
-
- Current constraint creation tool will remain active after creation
-
-
- Constraint creation "Continue Mode"
-
-
- true
-
-
- ContinuousConstraintMode
-
-
- Mod/Sketcher
-
-
-
- -
-
-
- Line pattern used for grid lines
-
-
- -1
-
-
-
- -
-
-
- Base length units will not be displayed in constraints.
-Supports all unit systems except 'US customary' and 'Building US/Euro'.
-
-
- Hide base length units for supported unit systems
-
-
- HideUnits
-
-
- Mod/Sketcher
-
-
-
+
-
-
+
182
@@ -103,199 +31,15 @@ Supports all unit systems except 'US customary' and 'Building US/Euro'.
Font size
-
-
- -
-
-
- true
+
+ EditSketcherFontSize
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
-
- 0
- 0
-
-
-
- Visibility automation
-
-
-
-
-
-
- When opening sketch, hide all features that depend on it
-
-
- Hide all objects that depend on the sketch
-
-
- true
-
-
- HideDependent
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
- When opening sketch, show sources for external geometry links
-
-
- Show objects used for external geometry
-
-
- true
-
-
- ShowLinks
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
- When opening sketch, show objects the sketch is attached to
-
-
- Show objects that the sketch is attached to
-
-
- true
-
-
- ShowSupport
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
- When closing sketch, move camera back to where it was before sketch was opened
-
-
- Restore camera position after editing
-
-
- true
-
-
- RestoreCamera
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
- When entering edit mode, force orthographic view of camera.
-Works only when "Restore camera position after editing" is enabled.
-
-
- Force orthographic camera when entering edit
-
-
- false
-
-
- ForceOrtho
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
- Open a by default sketch in Section View mode.
-Then objects are only visible behind the sketch plane.
-
-
- Open sketch in Section View mode
-
-
- false
-
-
- SectionView
-
-
- Mod/Sketcher/General
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Note: these settings are defaults applied to new sketches. The behavior is remembered for each sketch individually as properties on the View tab.
-
-
- Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Applies current visibility automation settings to all sketches in open documents
-
-
- Apply to existing sketches
-
-
-
-
-
- Font size used for labels and constraints
+ Font size used for labels and constraints.
px
@@ -317,53 +61,8 @@ Then objects are only visible behind the sketch plane.
- -
-
-
- Current sketcher creation tool will remain active after creation
-
-
- Geometry creation "Continue Mode"
-
-
- true
-
-
- ContinuousCreationMode
-
-
- Mod/Sketcher
-
-
-
- -
-
-
- Grid line pattern
-
-
-
- -
-
-
- Number of polygons for geometry approximation
-
-
- 50
-
-
- 1000
-
-
- SegmentsPerGeometry
-
-
- View
-
-
-
-
-
+
182
@@ -373,12 +72,15 @@ Then objects are only visible behind the sketch plane.
View scale ratio
+
+ viewScalingFactor
+
-
- The 3D view is scaled based on this factor
+ The 3D view is scaled based on this factor.
Qt::ImhPreferNumbers
@@ -406,10 +108,359 @@ Then objects are only visible behind the sketch plane.
+ -
+
+
+ Grid line pattern
+
+
+ comboBox
+
+
+
+ -
+
+
+ Line pattern used for grid lines.
+
+
+ -1
+
+
+
+ -
+
+
+ Segments per geometry
+
+
+ SegmentsPerGeometry
+
+
+
+ -
+
+
+ The number of polygons used for geometry approximation.
+
+
+ 50
+
+
+ 1000
+
+
+ SegmentsPerGeometry
+
+
+ View
+
+
+
+ -
+
+
+ A dialog will pop up to input a value for new dimensional constraints.
+
+
+ Ask for value after creating a dimensional constraint
+
+
+ true
+
+
+ ShowDialogOnDistanceConstraint
+
+
+ Mod/Sketcher
+
+
+
+ -
+
+
+ The current sketcher creation tool will remain active after creation.
+
+
+ Geometry creation "Continue Mode"
+
+
+ true
+
+
+ ContinuousCreationMode
+
+
+ Mod/Sketcher
+
+
+
+ -
+
+
+ The current constraint creation tool will remain active after creation.
+
+
+ Constraint creation "Continue Mode"
+
+
+ true
+
+
+ ContinuousConstraintMode
+
+
+ Mod/Sketcher
+
+
+
+ -
+
+
+ Base length units will not be displayed in constraints.
+Supports all unit systems except 'US customary' and 'Building US/Euro'.
+
+
+ Hide base length units for supported unit systems
+
+
+ HideUnits
+
+
+ Mod/Sketcher
+
+
+
+ -
+
+
+ If checked, displays the name on dimensional constraints (if exists).
+
+
+ Show dimensional constraint name with format
+
+
+ ShowDimensionalName
+
+
+ Mod/Sketcher
+
+
+
+ -
+
+
+ %N = %V
+
+
+ %N = %V
+
+
+ The format of the dimensional constraint string presentation.
+Defaults to: %N = %V
+
+%N - name parameter
+%V - dimension value
+
+
+ DimensionalStringFormat
+
+
+ Mod/Sketcher
+
+
+
- -
+
-
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+ 0
+ 0
+
+
+
+ Visibility automation
+
+
+
-
+
+
+ When opening a sketch, hide all features that depend on it.
+
+
+ Hide all objects that depend on the sketch
+
+
+ true
+
+
+ HideDependent
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+ When opening a sketch, show sources for external geometry links.
+
+
+ Show objects used for external geometry
+
+
+ true
+
+
+ ShowLinks
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+ When opening a sketch, show objects the sketch is attached to.
+
+
+ Show objects that the sketch is attached to
+
+
+ true
+
+
+ ShowSupport
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+ When closing a sketch, move camera back to where it was before the sketch was opened.
+
+
+ Restore camera position after editing
+
+
+ true
+
+
+ RestoreCamera
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+ When entering edit mode, force orthographic view of camera.
+Works only when "Restore camera position after editing" is enabled.
+
+
+ Force orthographic camera when entering edit
+
+
+ false
+
+
+ ForceOrtho
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+ Open a sketch in Section View mode by default.
+Then objects are only visible behind the sketch plane.
+
+
+ Open sketch in Section View mode
+
+
+ false
+
+
+ SectionView
+
+
+ Mod/Sketcher/General
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Note: these settings are defaults applied to new sketches. The behavior is remembered for each sketch individually as properties on the View tab.
+
+
+ Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Applies current visibility automation settings to all sketches in open documents.
+
+
+ Apply to existing sketches
+
+
+
+
+
+
+ -
Qt::Vertical
@@ -426,13 +477,13 @@ Then objects are only visible behind the sketch plane.
- Gui::PrefSpinBox
- QSpinBox
+ Gui::PrefCheckBox
+ QCheckBox
- Gui::PrefCheckBox
- QCheckBox
+ Gui::PrefSpinBox
+ QSpinBox
@@ -440,12 +491,23 @@ Then objects are only visible behind the sketch plane.
QDoubleSpinBox
+
+ Gui::PrefLineEdit
+ QLineEdit
+
+
EditSketcherFontSize
+ viewScalingFactor
comboBox
+ SegmentsPerGeometry
dialogOnDistanceConstraint
continueMode
+ constraintMode
+ checkBoxHideUnits
+ checkBoxShowDimensionalName
+ prefDimensionalStringFormat
checkBoxTVHideDependent
checkBoxTVShowLinks
checkBoxTVShowSupport
diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
index 67732ca60b..cfeb1c0e59 100644
--- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
+++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
@@ -3164,23 +3164,35 @@ bool ViewProviderSketch::doubleClicked(void)
QString ViewProviderSketch::getPresentationString(const Constraint *constraint)
{
- Base::Reference hGrpSketcher; // param group that includes HideUnits option
- bool iHideUnits;
- QString userStr; // final return string
+ Base::Reference hGrpSketcher; // param group that includes HideUnits and ShowDimensionalName option
+ bool iHideUnits; // internal HideUnits setting
+ bool iShowDimName; // internal ShowDimensionalName setting
+ QString nameStr; // name parameter string
+ QString valueStr; // dimensional value string
+ QString presentationStr; // final return string
QString unitStr; // the actual unit string
QString baseUnitStr; // the expected base unit string
+ QString formatStr; // the user defined format for the representation string
double factor; // unit scaling factor, currently not used
Base::UnitSystem unitSys; // current unit system
if(!constraint->isActive)
return QString::fromLatin1(" ");
- // Get value of HideUnits option. Default is false.
+ // get parameter group for Sketcher display settings
hGrpSketcher = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher");
+ // Get value of HideUnits option. Default is false.
iHideUnits = hGrpSketcher->GetBool("HideUnits", 0);
+ // Get Value of ShowDimensionalName option. Default is true.
+ iShowDimName = hGrpSketcher->GetBool("ShowDimensionalName", false);
+ // Get the defined format string
+ formatStr = QString::fromStdString(hGrpSketcher->GetASCII("DimensionalStringFormat", "%N = %V"));
- // Get the current display string including units
- userStr = constraint->getPresentationValue().getUserString(factor, unitStr);
+ // Get the current name parameter string of the constraint
+ nameStr = QString::fromStdString(constraint->Name);
+
+ // Get the current value string including units
+ valueStr = constraint->getPresentationValue().getUserString(factor, unitStr);
// Hide units if user has requested it, is being displayed in the base
// units, and the schema being used has a clear base unit in the first
@@ -3225,19 +3237,45 @@ QString ViewProviderSketch::getPresentationString(const Constraint *constraint)
{
// Example code from: Mod/TechDraw/App/DrawViewDimension.cpp:372
QRegExp rxUnits(QString::fromUtf8(" \\D*$")); //space + any non digits at end of string
- userStr.remove(rxUnits); //getUserString(defaultDecimals) without units
+ valueStr.remove(rxUnits); //getUserString(defaultDecimals) without units
}
}
}
if (constraint->Type == Sketcher::Diameter){
- userStr.insert(0, QChar(8960)); // Diameter sign
+ valueStr.insert(0, QChar(8960)); // Diameter sign
}
else if (constraint->Type == Sketcher::Radius){
- userStr.insert(0, QChar(82)); // Capital letter R
+ valueStr.insert(0, QChar(82)); // Capital letter R
}
- return userStr;
+ /**
+ Create the representation string from the user defined format string
+ Format options are:
+ %N - the constraint name parameter
+ %V - the value of the dimensional constraint, including any unit characters
+ */
+ if (iShowDimName && !nameStr.isEmpty())
+ {
+ if (formatStr.contains(QLatin1String("%V")) || formatStr.contains(QLatin1String("%N")))
+ {
+ presentationStr = formatStr;
+ presentationStr.replace(QLatin1String("%N"), nameStr);
+ presentationStr.replace(QLatin1String("%V"), valueStr);
+ }
+ else
+ {
+ // user defined format string does not contain any valid parameter, using default format "%N = %V"
+ presentationStr = nameStr + QLatin1String(" = ") + valueStr;
+ FC_WARN("When parsing dimensional format string \""
+ << QString(formatStr).toStdString()
+ << "\", no valid parameter found, using default format.");
+ }
+
+ return presentationStr;
+ }
+
+ return valueStr;
}
QString ViewProviderSketch::iconTypeFromConstraint(Constraint *constraint)