View Issue Details

IDProjectCategoryView StatusLast Update
0002627FreeCADBugpublic2016-07-22 14:59
Reporterronp Assigned Towandererfan  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Product Version0.17 
Target Version0.17Fixed in Version0.17 
Summary0002627: Dimensions in TechDraw show mm value when imperial selected
DescriptionThis problem appears in Freecad compiled from source, revision 7976.

Dimensions shown in TechDraw show the value in mm when Imperial decimal (in/lb) units are selected. For example a dimension of 1.25 inches is printed as 34.544 in. When the units in preferences are changed to Standard (mm/kg/s/degree), the same dimension is correctly printed as 34.544 mm.

The problem occurs in the file src/Mod/TechDraw/App/DrawViewDimension.cpp in the function DrawViewDimension::getFormatedValue. The dimension is converted to a string named userStr on line 218 which correctly contains the value in inches when using Imperial decimal (in/lb). However, userStr is parsed and a new string named displayText is created in line 223 which is a concatenation of valText and unitText. Because valText was created before localized unit conversion, it represents the value in mm. String unitText correctly holds the localized units. Therefore, when using Imperial units, displayText is a mixture of a mm value and an imperial unit. String displayText is the dimension shown in TechDraw.

This may have been introduced in change 350d8bb55be292e80667626cdc22bbd4d83e8b74.
Steps To Reproduce1 Set the Unit preferences in Freecad to Imperial decimal (in/lb).
2 Open an existing part.
3 Create a new TechDraw drawing.
4 Insert a view of part into TechDraw drawing.
5 Add some dimensions.
6 Observe the units are imperial (in) but values are multiplied by 25.4
7 Save drawing.
8 Set the Unit preferences in Freecad to Standard (mm/kg/s/degree).
9 Restart Freecad
10 Open drawing and observe dimensions are printed with same values but units of mm.
Additional InformationA work around is to use the original string containing the dimension in the chosen units with the change shown below. This isn't ideal because the decimal setting of the dimension is ignored.

--- a/src/Mod/TechDraw/App/DrawViewDimension.cpp
+++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp
@@ -234,7 +234,7 @@ std::string DrawViewDimension::getFormatedValue() const
     for(QStringList::const_iterator it = list.begin(); it != list.end(); ++it) {
         if(*it == QString::fromAscii("%value%")){
- str.replace(*it,displayText);
+ str.replace(*it, userStr);^M
         } else { //insert additional placeholder replacement logic here
             str.replace(*it, QString::fromAscii("")); //maybe we should just leave what was there?
         }
TagsNo tags attached.
FreeCAD Information

Activities

ronp

2016-07-18 20:40

reporter   ~0007200

Correction to description: a dimension of 1.25 inches is printed as 31.75 in.

wandererfan

2016-07-20 20:03

manager   ~0007206

Your workaround is how it used to work. I was trying to get around Quantity::getUserString always returning 6 digit precision. We'll have to fix getUserString.

Related Changesets

FreeCAD: master 62a8828d

2016-07-21 20:49:36

wandererfan

Details Diff
Fix 0002627 wrong value in dimension
Remove obolete dimension properties
Affected Issues
0002627
mod - src/Mod/TechDraw/App/DrawViewDimension.cpp Diff File
mod - src/Mod/TechDraw/App/DrawViewDimension.h Diff File

Issue History

Date Modified Username Field Change
2016-07-18 20:26 ronp New Issue
2016-07-18 20:40 ronp Note Added: 0007200
2016-07-20 20:03 wandererfan Note Added: 0007206
2016-07-20 20:03 wandererfan Assigned To => wandererfan
2016-07-20 20:03 wandererfan Status new => confirmed
2016-07-20 20:03 wandererfan Product Version => 0.17
2016-07-20 20:03 wandererfan Target Version => 0.17
2016-07-22 14:58 wmayer Changeset attached => FreeCAD Master master 62a8828d
2016-07-22 14:59 wmayer Status confirmed => closed
2016-07-22 14:59 wmayer Resolution open => fixed
2016-07-22 14:59 wmayer Fixed in Version => 0.17