Building US Units are not displayed correctly in dimensions

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
elsordo
Posts: 69
Joined: Sat Jan 30, 2016 6:34 am

Building US Units are not displayed correctly in dimensions

Post by elsordo »

I have a problem with Techdraw. It is not displaying Building US dimensions correctly. Consider the following drawing
PageWithWall.pdf
(119.83 KiB) Downloaded 59 times
.

The height of the wall is shown a 8.5 ft but it should be shown as 8' 6".

The info for the version of freecad is
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23683 (Git)
Build type: Release
Branch: master
Hash: af4de262e326452fd79f036253cf7cac6a7e7e00
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

I have attached the model.

-David
Attachments
WallWithDimensions.FCStd
(15.61 KiB) Downloaded 45 times
Last edited by elsordo on Thu Jan 14, 2021 7:40 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Building US Units are not displayed correctly in dimensions

Post by chrisb »

Please don't attach your FreeCAD infos as a separate file. Copy the text directly into the post. You can edit your post and correct it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
pfong
Posts: 42
Joined: Tue Jan 12, 2021 7:17 am

Re: Building US Units are not displayed correctly in dimensions

Post by pfong »

Looks like we're seeing the same issue.
Should a bug be filed for this?
pfong
Posts: 42
Joined: Tue Jan 12, 2021 7:17 am

Re: Building US Units are not displayed correctly in dimensions

Post by pfong »

I believe the bug is in lines 813-821 of DrawViewDimension.cpp

Code: Select all

    if ((unitSystem == Base::UnitSystem::ImperialBuilding) &&
        !angularMeasure) {
        qMultiValueStr = formattedValue;
        if (!genPrefix.empty()) {
            //qUserString from Quantity includes units - prefix + R + nnn ft + suffix
            qMultiValueStr = formatPrefix + qGenPrefix + qUserString + formatSuffix;
        }
        formattedValue = qMultiValueStr;
    }
    
This attempts to fix up the dimension text for ImperialBuilding. It has at least two problems.
  1. It does nothing when there is no prefix. This is why linear dimensions end up with fractional ft.
  2. It unnecessarily adds prefix and suffix when there is a prefix. So, for example, for a radius I see something like:
    radius.png
    radius.png (9.04 KiB) Viewed 1687 times
A potential fix is to remove this code and add block in the if block above like the one for ImperialCivil angular measure.
bdful
Posts: 1
Joined: Wed Jan 13, 2021 9:20 pm

Re: Building US Units are not displayed correctly in dimensions

Post by bdful »

I recently switched from version 0.18 to version 0.19 and I am having this same problem with the TechDraw workbench. Version 0.18 will display correctly 10' 6+1/2" whereas version 0.19 will only display 10.542 ft
0.19 Display
0.19 Display
2021-01-16 13_40_35-FreeCAD 0.19.png (4.27 KiB) Viewed 1628 times

Regards
Bill

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23578 (Git)
Build type: Release
Branch: master
Hash: 50c3cbf00579dc4941ca743c25720d016b0453ce
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Canada (en_CA)
elsordo
Posts: 69
Joined: Sat Jan 30, 2016 6:34 am

Re: Building US Units are not displayed correctly in dimensions

Post by elsordo »

When will this be fixed?
pfong
Posts: 42
Joined: Tue Jan 12, 2021 7:17 am

Re: Building US Units are not displayed correctly in dimensions

Post by pfong »

I'm new to the FreeCAD community. I'm not sure what the process is to have a TechDraw dev look at this and verify it's a bug.
It seems like a possible workaround is to use 0.18 for TechDraw. However, 0.18 hangs when I try to load the file that I made 0.19.
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Building US Units are not displayed correctly in dimensions

Post by aapo »

pfong wrote: Sat Jan 16, 2021 9:38 pm I'm new to the FreeCAD community. I'm not sure what the process is to have a TechDraw dev look at this and verify it's a bug.
It seems like a possible workaround is to use 0.18 for TechDraw. However, 0.18 hangs when I try to load the file that I made 0.19.
I'm afraid that version 0.18 is quite outdated today. However, I think the changes in v 0.19 might be related to the recent improvements made into the unit printing code. These changes have been discussed in the threads linked below, and developer uwestoehr has programmed the improvements, so most likely he knows best what if anything related to US unit printing has been changed recently.

https://forum.freecadweb.org/viewtopic.php?f=35&t=52545

https://forum.freecadweb.org/viewtopic.php?f=35&t=53473

uwestoehr wrote: pinged by pinger macro
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Building US Units are not displayed correctly in dimensions

Post by uwestoehr »

elsordo wrote: Thu Jan 14, 2021 5:27 pm I have a problem with Techdraw. It is not displaying Building US dimensions correctly. Consider the following drawingPageWithWall.pdf.

The height of the wall is shown a 8.5 ft but it should be shown as 8' 6".
Thanks for the report. We recently applied some improvements for the dimension handling concerning tolerances. That way I realized that US Building seems not to work correctly. But there was nobody who could give input. With the help of you, we can now also fix US Building.

@aapo, could you have a look? I am at the moment busy with some PartDesign things, thus I might needs some days before I can have a look.
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Building US Units are not displayed correctly in dimensions

Post by aapo »

uwestoehr wrote: Mon Jan 18, 2021 10:51 am @aapo, could you have a look? I am at the moment busy with some PartDesign things, thus I might needs some days before I can have a look.
Okay, I guess I can spend a few hours on this, although I'm not familiar with the US unit schemes either. It seems quite straightforward though, as I believe that it has been very well documented in this thread how the desired output should look like. Thanks @elsordo and @pfong! :D
Post Reply