TechDraw: Remove fudge factor for Section line ends
- Dominant language
- C++
- Stars
- 33.6k
- Forks
- 6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 196
Description
### Problem description
In [QGIViewPart::drawSectionLine](https://github.com/FreeCAD/FreeCAD/blob/c14d6f8848f3eb5b120bb89b4f2955ba70f7b027/src/Mod/TechDraw/Gui/QGIViewPart.cpp#L689) a fudge factor is applied to the length of section view lines.
//make the section line a little longer
double fudge = 2.0 * Preferences::dimFontSizeMM();
....
QPointF location0 = points.front().getLocation() * scale;
location0 = location0 - DU::toQPointF(lineDir) * fudge;
QPointF location1 = points.back().getLocation() * scale;
location1 = location1 + DU::toQPointF(lineDir) * fudge;
//change points have Rez::guiX applied in sectionLine
While this behavior may have been desirable before SectionLineStretch was added, now that SectionLineStretch exists the fudge factor makes precise control of section line rendering impossible (and it adds a weird dependency on the current setting for the default dimension font size in the user preferences).
If the fudge factor is removed, the default value for SectionLineStretch will probably need to be adjusted. IMO something in the 1.4–1.6 range looks best, but that can be decided later.
### Workbench affected?
TechDraw
### Steps to reproduce
1. Create a section view in the TechDraw workbench
2. Set a new value for the default dimension font size under Edit > Preferences > TechDraw > Dimensions > Font Size
3. Recompute the document
### Expected behavior
The length of the section line is controlled solely by the SectionLineStretch property of the section view
### Actual behavior
The length of the section line changes when the default dimension font size changes
### Development version About Info (in Safe Mode)
```shell
OS: Ubuntu 24.04.3 LTS (KDE/plasma/xcb)
Architecture: x86_64
Version: 1.0.2.39319 (Git) Conda AppImage
Build type: Release
Branch: (HEAD detached at 1.0.2)
Hash: 256fc7eff3379911ab5daf88e10182c509aa8052
Python 3.11.13, Qt 5.15.15, Coin 4.0.3, Vtk 9.3.0, OCC 7.8.1
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: unset/FreeCAD Classic/Qt default
Installed mods:
* sheetmetal 0.5.5
* lattice2 1.0.0
* freecad.gears 1.3.0
```
### Last known good version (optional)
```shell
```
Contributor guide
Research direction
Start in src/Mod/TechDraw/Gui/QGIViewPart.cpp at QGIViewPart::drawSectionLine and inspect how SectionLineStretch controls the endpoints. Reproduce the change with different TechDraw dimension font sizes, then verify that the section line length depends only on SectionLineStretch and that the default stretch value is appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100