diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 0b4181cc9e..9f0050d581 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -319,3 +319,21 @@ std::string Preferences::bitmapFill(void) } return result; } + +double Preferences::ISOGap() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")-> + GetGroup("Mod/TechDraw/Dimensions"); + double factor = hGrp->GetFloat("ISOGap", 8.0); + return factor; +} + +double Preferences::ASMEGap() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")-> + GetGroup("Mod/TechDraw/Dimensions"); + double factor = hGrp->GetFloat("ASMEGap", 6.0); + return factor; +} diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index d8c73d49f9..96a4d9f1ae 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -73,7 +73,12 @@ static int mattingStyle(); static std::string svgFile(); static std::string patFile(); + static std::string bitmapFill(void); + +static double ISOGap(); +static double ASMEGap(); + }; } //end namespace TechDraw diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui index d0c3df6751..3f639dd3ed 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui @@ -7,7 +7,7 @@ 0 0 440 - 380 + 498 @@ -46,21 +46,81 @@ - - + + + + + 0 + 0 + + 0 - 0 + 22 + + Arrowhead size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 5.000000000000000 + + + ArrowSize + + + Mod/TechDraw/Dimensions + + + + + true - Standard and Style + Dimension Format + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + Arrowhead style + + + -1 + + + ArrowStyle + + + Mod/TechDraw/Dimensions + + + + + + + Diameter Symbol @@ -109,33 +169,15 @@ - - - - - 0 - 0 - - + + true - - Use system setting for number of decimals - - Use Global Decimals - - - true - - - UseGlobalDecimals - - - /Mod/TechDraw/Dimensions + Font Size @@ -167,100 +209,24 @@ - - - - Alternate Decimals - - - - - - - false - - - - 0 - 0 - - + + 0 - 22 + 0 - - Number of decimals if 'Use Global Decimals' is not used - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 2 - - - AltDecimals - - - /Mod/TechDraw/Dimensions - - - - - true - Dimension Format + Standard and Style - - - - <html><head/><body><p>Leave blank for automatic dimension format. Use %f, %g or %w specifiers to override.</p></body></html> - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - formatSpec - - - /Mod/TechDraw/Dimensions - - - - - - - - true - - - - Font Size - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -292,27 +258,27 @@ - - - - - 0 - 0 - - - - - 0 - 0 - - + + - false + true - Tolerance Text Scale + Arrow Size + + + + + + + + true + + + + Arrow Style @@ -360,10 +326,61 @@ Multiplier of 'Font Size' - - + + + + + 0 + 0 + + + + + 0 + 0 + + + + + false + + - Diameter Symbol + Tolerance Text Scale + + + + + + + false + + + + 0 + 0 + + + + + 0 + 22 + + + + Number of decimals if 'Use Global Decimals' is not used + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 2 + + + AltDecimals + + + /Mod/TechDraw/Dimensions @@ -403,90 +420,141 @@ Multiplier of 'Font Size' - - - - - true - - - - Arrow Style - - - - - + + 0 0 - - - 0 - 22 - + + + true + - Arrowhead style + Use system setting for number of decimals - - -1 + + Use Global Decimals + + + true - ArrowStyle + UseGlobalDecimals - Mod/TechDraw/Dimensions + /Mod/TechDraw/Dimensions - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Alternate Decimals + + + + + true + + Controls the size of gap between dimension point and start of extension line for ISO dimensions. + - Arrow Size + Extension Gap Factor - ISO - - - - - 0 - 0 - + + + + <html><head/><body><p>Leave blank for automatic dimension format. Use %f, %g or %w specifiers to override.</p></body></html> - - - 0 - 22 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + formatSpec + + + /Mod/TechDraw/Dimensions + + + + + + + + true + - Arrowhead size + Controls the size of gap between dimension point and start of extension line for ASME dimensions. + + + Extension Gap Factor - ASME + + + + + + + <html><head/><body><p>Controls the size of gap between dimension point and start of extension line for ISO dimensions. Value * linewidth is the gap.</p></body></html> Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - 5.000000000000000 + 8.000000000000000 - ArrowSize + GapISO Mod/TechDraw/Dimensions - + + + + <html><head/><body><p>Controls the size of gap between dimension point and start of extension line for ASME dimensions. Value * linewidth is the gap.</p></body></html> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 6.000000000000000 + + + GapASME + + + Mod/TechDraw/Dimensions + + + + @@ -500,7 +568,7 @@ Multiplier of 'Font Size' - <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> true diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp index a520e3bcf0..edbf181bdc 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp @@ -69,6 +69,8 @@ void DlgPrefsTechDrawDimensionsImp::saveSettings() ui->pcbArrow->onSave(); ui->plsb_ArrowSize->onSave(); ui->leFormatSpec->onSave(); + ui->pdsbISOGap->onSave(); + ui->pdsbASMEGap->onSave(); } void DlgPrefsTechDrawDimensionsImp::loadSettings() @@ -97,6 +99,9 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings() ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec())); ui->leFormatSpec->onRestore(); + + ui->pdsbISOGap->onRestore(); + ui->pdsbASMEGap->onRestore(); } /** diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 097ca747bd..1e056db734 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -1567,11 +1567,20 @@ void QGIViewDimension::drawDistanceExecutive(const Base::Vector2d &startPoint, c arrowCount = 0; } + auto vp = static_cast(getViewProvider(getViewObject())); + assert(vp); + if (arrowCount > 0 && renderExtent >= ViewProviderDimension::REND_EXTENT_REDUCED) { double gapSize = 0.0; if (standardStyle == ViewProviderDimension::STD_STYLE_ASME_REFERENCING || standardStyle == ViewProviderDimension::STD_STYLE_ASME_INLINED) { - gapSize = getDefaultAsmeExtensionLineGap(); + double factor = vp->GapFactorASME.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); + } + if (standardStyle == ViewProviderDimension::STD_STYLE_ISO_REFERENCING + || standardStyle == ViewProviderDimension::STD_STYLE_ISO_ORIENTED) { + double factor = vp->GapFactorISO.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); } Base::Vector2d extensionOrigin; @@ -1745,12 +1754,22 @@ void QGIViewDimension::drawDistanceOverride(const Base::Vector2d &startPoint, co arrowCount = 0; } + auto vp = static_cast(getViewProvider(getViewObject())); + assert(vp); + if (arrowCount > 0 && renderExtent >= ViewProviderDimension::REND_EXTENT_REDUCED) { double gapSize = 0.0; if (standardStyle == ViewProviderDimension::STD_STYLE_ASME_REFERENCING || standardStyle == ViewProviderDimension::STD_STYLE_ASME_INLINED) { - gapSize = getDefaultAsmeExtensionLineGap(); + double factor = vp->GapFactorASME.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); } + if (standardStyle == ViewProviderDimension::STD_STYLE_ISO_REFERENCING + || standardStyle == ViewProviderDimension::STD_STYLE_ISO_ORIENTED) { + double factor = vp->GapFactorISO.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); + } + Base::Vector2d extensionOrigin; Base::Vector2d extensionTarget(computeExtensionLinePoints(endPoint, endCross, lineAngle + M_PI_2, @@ -2307,12 +2326,22 @@ void QGIViewDimension::drawAngle(TechDraw::DrawViewDimension *dimension, ViewPro arrowCount = 0; } + auto vp = static_cast(getViewProvider(getViewObject())); + assert(vp); + if (arrowCount > 0 && renderExtent >= ViewProviderDimension::REND_EXTENT_REDUCED) { double gapSize = 0.0; if (standardStyle == ViewProviderDimension::STD_STYLE_ASME_REFERENCING || standardStyle == ViewProviderDimension::STD_STYLE_ASME_INLINED) { - gapSize = getDefaultAsmeExtensionLineGap(); + double factor = vp->GapFactorASME.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); } + if (standardStyle == ViewProviderDimension::STD_STYLE_ISO_REFERENCING + || standardStyle == ViewProviderDimension::STD_STYLE_ISO_ORIENTED) { + double factor = vp->GapFactorISO.getValue(); + gapSize = Rez::appX(m_lineWidth * factor); + } + Base::Vector2d extensionOrigin; Base::Vector2d extensionTarget(computeExtensionLinePoints(endPoint, @@ -2492,12 +2521,6 @@ double QGIViewDimension::getDefaultAsmeHorizontalLeaderLength() const return Rez::appX(m_lineWidth*12); } -double QGIViewDimension::getDefaultAsmeExtensionLineGap() const -{ - // Not specified by ASME Y14.5M, this is a best guess - return Rez::appX(m_lineWidth*6.0); -} - //frame, border, caption are never shown in QGIVD, so shouldn't be in bRect QRectF QGIViewDimension::boundingRect() const { diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.h b/src/Mod/TechDraw/Gui/QGIViewDimension.h index 4be07c71ca..b7eae9b80e 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.h +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.h @@ -297,7 +297,6 @@ private: double getDefaultIsoDimensionLineSpacing() const; double getDefaultIsoReferenceLineOverhang() const; double getDefaultAsmeHorizontalLeaderLength() const; - double getDefaultAsmeExtensionLineGap() const; /* QGIView* m_parent; //for edit dialog set up eventually*/ diff --git a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp index 152f191d43..ae509e00a8 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp @@ -81,6 +81,10 @@ ViewProviderDimension::ViewProviderDimension() RenderingExtent.setEnums(RenderingExtentEnums); ADD_PROPERTY_TYPE(FlipArrowheads, (false), group, App::Prop_None, "Reverses usual direction of dimension line terminators"); + ADD_PROPERTY_TYPE(GapFactorISO, (Preferences::ISOGap()), group, App::Prop_None, + "Adjusts the gap between dimension point and extension line"); + ADD_PROPERTY_TYPE(GapFactorASME, (Preferences::ASMEGap()), group, App::Prop_None, + "Adjusts the gap between dimension point and extension line"); } ViewProviderDimension::~ViewProviderDimension() @@ -196,8 +200,9 @@ void ViewProviderDimension::onChanged(const App::Property* p) (p == &LineWidth) || (p == &StandardAndStyle) || (p == &RenderingExtent) || - (p == &FlipArrowheads)) - { + (p == &FlipArrowheads) || + (p == &GapFactorASME) || + (p == &GapFactorISO)) { QGIView* qgiv = getQView(); if (qgiv) { qgiv->updateView(true); diff --git a/src/Mod/TechDraw/Gui/ViewProviderDimension.h b/src/Mod/TechDraw/Gui/ViewProviderDimension.h index 7be2894bf3..a3b7ce27da 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDimension.h +++ b/src/Mod/TechDraw/Gui/ViewProviderDimension.h @@ -64,6 +64,9 @@ public: App::PropertyBool FlipArrowheads; + App::PropertyFloat GapFactorISO; + App::PropertyFloat GapFactorASME; + virtual void attach(App::DocumentObject *); virtual void setDisplayMode(const char* ModeName); virtual bool useNewSelectionModel(void) const {return false;}