Skip to content

Commit

Permalink
[TD] Variable line stretching distance
Browse files Browse the repository at this point in the history
  • Loading branch information
edi271 authored and WandererFan committed Jan 21, 2022
1 parent c46a4f7 commit 242dcd7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/CommandExtensionPack.cpp
Expand Up @@ -1456,7 +1456,7 @@ void execExtendShortenLine(Gui::Command* cmd, bool extend) {
}
double scale = objFeat->getScale();
Base::Vector3d direction = (P1 - P0).Normalize();
Base::Vector3d delta = direction * 2.0;
Base::Vector3d delta = direction * activeDimAttributes.getLineStretch();
Base::Vector3d startPt, endPt;
if (extend) {
startPt = P0 - delta;
Expand Down
10 changes: 10 additions & 0 deletions src/Mod/TechDraw/Gui/TaskSelectLineAttributes.cpp
Expand Up @@ -180,13 +180,19 @@ App::Color lineAttributes::getColorValue(void)
dimAttributes::dimAttributes(void)
{
cascadeSpacing = 7.0;
lineStretch = 2.0;
}

void dimAttributes::setCascadeSpacing(double spacing)
{
cascadeSpacing = spacing;
}

void dimAttributes::setLineStretch(double stretch)
{
lineStretch = stretch;
}

dimAttributes activeDimAttributes; // container holding dimension attributes

//===========================================================================
Expand Down Expand Up @@ -291,6 +297,8 @@ void TaskSelectLineAttributes::setUiEdit()

double cascadeSpacing = activeDimAttributes.getCascadeSpacing();
ui->sbSpacing->setValue(cascadeSpacing);
double lineStretching = activeDimAttributes.getLineStretch();
ui->sbStretch->setValue(lineStretching);

}

Expand Down Expand Up @@ -355,6 +363,8 @@ bool TaskSelectLineAttributes::accept()

double cascadeSpacing = ui->sbSpacing->value();
activeDimAttributes.setCascadeSpacing(cascadeSpacing);
double lineStretching = ui->sbStretch->value();
activeDimAttributes.setLineStretch(lineStretching);

return true;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/TechDraw/Gui/TaskSelectLineAttributes.h
Expand Up @@ -32,12 +32,15 @@

class dimAttributes {
double cascadeSpacing;
double lineStretch;

public:

dimAttributes(void);
void setCascadeSpacing(double);
double getCascadeSpacing(void) {return cascadeSpacing;}
void setLineStretch(double);
double getLineStretch(void) {return lineStretch;}

}; // class dimAttributes

Expand Down
106 changes: 62 additions & 44 deletions src/Mod/TechDraw/Gui/TaskSelectLineAttributes.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>406</height>
<width>250</width>
<height>482</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -31,17 +31,17 @@
<item row="0" column="0">
<widget class="QLabel" name="label_styles">
<property name="text">
<string>Line style:</string>
<string>Linestyles:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbSolid">
<property name="toolTip">
<string>Set line style to solid</string>
<string>Set Line style to solid</string>
</property>
<property name="text">
<string>Solid</string>
<string>solid</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -54,7 +54,7 @@
<item row="2" column="0">
<widget class="QRadioButton" name="rbDashed">
<property name="text">
<string>Dashed</string>
<string>dashed</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -67,7 +67,7 @@
<item row="3" column="0">
<widget class="QRadioButton" name="rbDotted">
<property name="text">
<string>Dotted</string>
<string>dotted</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -80,7 +80,7 @@
<item row="4" column="0">
<widget class="QRadioButton" name="rbDashDotted">
<property name="text">
<string>Dashdot</string>
<string>dashdot</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -100,14 +100,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label_width">
<property name="text">
<string>Line width:</string>
<string>Lineswidth:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbThin">
<property name="text">
<string>Thin 0,18</string>
<string>thin 0,18</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -120,7 +120,7 @@
<item row="2" column="0">
<widget class="QRadioButton" name="rbMiddle">
<property name="text">
<string>Middle 0,35</string>
<string>middle 0,35</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -136,7 +136,7 @@
<item row="3" column="0">
<widget class="QRadioButton" name="rbThick">
<property name="text">
<string>Thick 0,70</string>
<string>thick 0,70</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -153,14 +153,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label_colors">
<property name="text">
<string>Line color:</string>
<string>Linecolors:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbBlack">
<property name="text">
<string>Black</string>
<string>black</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -176,7 +176,7 @@
<item row="1" column="1">
<widget class="QRadioButton" name="rbBlue">
<property name="text">
<string>Blue</string>
<string>blue</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -189,7 +189,7 @@
<item row="2" column="0">
<widget class="QRadioButton" name="rbGrey">
<property name="text">
<string>Grey</string>
<string>grey</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -202,7 +202,7 @@
<item row="2" column="1">
<widget class="QRadioButton" name="rbMagenta">
<property name="text">
<string>Magenta</string>
<string>magenta</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -215,7 +215,7 @@
<item row="3" column="0">
<widget class="QRadioButton" name="rbRed">
<property name="text">
<string>Red</string>
<string>red</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -228,7 +228,7 @@
<item row="3" column="1">
<widget class="QRadioButton" name="rbCyan">
<property name="text">
<string>Cyan</string>
<string>cyan</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -241,7 +241,7 @@
<item row="4" column="0">
<widget class="QRadioButton" name="rbGreen">
<property name="text">
<string>Green</string>
<string>green</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -254,7 +254,7 @@
<item row="4" column="1">
<widget class="QRadioButton" name="rbYellow">
<property name="text">
<string>Yellow</string>
<string>yellow</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
Expand All @@ -267,27 +267,45 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="horizontalGroupBox">
<layout class="QHBoxLayout" name="Spin001">
<item>
<widget class="QLabel" name="label_spacing">
<property name="text">
<string>Cascade spacing</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sbSpacing">
<property name="singleStep">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>7.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QGridLayout" name="cascadeValues" rowstretch="0,0" columnstretch="0,0">
<property name="leftMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_spacing">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cascade spacing</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="sbSpacing">
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_stretch">
<property name="text">
<string>Delta distance</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="sbStretch">
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand All @@ -296,12 +314,12 @@
</resources>
<connections/>
<buttongroups>
<buttongroup name="bgLineWidth">
<buttongroup name="bgLineStyles">
<property name="exclusive">
<bool>true</bool>
</property>
</buttongroup>
<buttongroup name="bgLineStyles">
<buttongroup name="bgLineWidth">
<property name="exclusive">
<bool>true</bool>
</property>
Expand Down

0 comments on commit 242dcd7

Please sign in to comment.