unit mismatch error for dimensions

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

aapo wrote: Thu Nov 26, 2020 6:36 pm It was in my proposal in the post above, where I proposed to add a UnitsSchema property for every view (where the user would select his/her projection schema, or choose to use the one from General Preferences, whatever that happens to be):
I think that is no option. I currently have to make technical drawings and my first versions were rejected because they were not norm-conform. I learned that all views must have the same unit system. For example I used dimensions without a unit (meaning mm) and for the dimensions in µm I displayed the unit.
I am just a poor physicist but apparently according to the "standard" ISO for technical drawings, either always a unit or never, and the latter is preferred. But again, my knowledge on how to make a proper drawing is unfortunately low and maybe I did actually not violate the norm. And as the norms are not accessible for free to check this, I cannot state on how to do it right.
aapo
Posts: 624
Joined: Mon Oct 29, 2018 6:41 pm

Re: unit mismatch error for dimensions

Post by aapo »

uwestoehr wrote: Thu Nov 26, 2020 6:45 pm I think that is no option. I currently have to make technical drawings and my first versions were rejected because they were not norm-conform. I learned that all views must have the same unit system. For example I used dimensions without a unit (meaning mm) and for the dimensions in µm I displayed the unit.
I am just a poor physicist but apparently according to the "standard" ISO for technical drawings, either always a unit or never, and the latter is preferred. But again, my knowledge on how to make a proper drawing is unfortunately low and maybe I did actually not violate the norm. And as the norms are not accessible for free to check this, I cannot state on how to do it right.
I meant a "view" as in TechDraw::DrawView, which is basically a drawing. The main idea of using these new UnitSchemas would be to make it possible to force all dimensions in a drawing to have the same unit (by utilizing a single-length-unit UnitSchema(s)). With the default TD UnitSchema this is not possible, as it is multi-unit for length, and I don't think it'd be wise to try to force the default UnitSchema to work like that, there'd be too many corner cases. I believe it would be much easier to add those single-unit UnitSchemas.

As for your point of not mixing different dimensions, I fully & completely agree with you; never mix different units on the same drawing. That said, I still think it'd good to let the user make bad choices, too. There will definitely always be someone who wants to mix meters and kilometers and whatever into the same drawing, so why try to prevent it? I'd just want to make it more easy to do it correctly, i.e. single unit per-view. At the moment, unit-mixup is the default, as you pointed out in the 1st post.

The technical reason why I'd want to use TechDraw::DrawView is that a working TechDraw::DrawViewDimension is always connected to a parent TechDraw::DrawView, so if the UnitSchema would be saved there it'd be easy to access it from TechDraw::DrawViewDimension. Of course, every view is on a page, so it could be per-page, too, but there could be other stuff between view and a page, like DrawViewCollection and other objects; but everything should end into a page. Hmm, maybe that needs another thought... :)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

uwestoehr wrote: Mon Nov 30, 2020 3:31 am Here is the proposed fix: https://github.com/FreeCAD/FreeCAD/pull/4094
I made now a complete test using all possible uni schemes with and without units. At the moment we have several bugs:

A. Standard (the one I reported initially):
Standard as is
Standard as is
Standard.png (14.4 KiB) Viewed 1161 times

B. Imperial Civial:
Imperial Civial with units as is
Imperial Civial with units as is
Imperial-civil-unit.png (13.51 KiB) Viewed 1161 times
Imperial Civial as is
Imperial Civial as is
Imperial-civil.png (13.43 KiB) Viewed 1161 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

C. Building-US:
Building-US with units as is
Building-US with units as is
Building-US-unit.png (12.83 KiB) Viewed 1160 times
Building-US as is
Building-US as is
Building-US.png (12.73 KiB) Viewed 1160 times

D. Building-Euro:
Building-Euro as is
Building-Euro as is
Building-Euro.png (13.03 KiB) Viewed 1160 times
Building-Euro with units as is
Building-Euro with units as is
Building-Euro-unit.png (13.47 KiB) Viewed 1160 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

E. MKS:
MKS as is
MKS as is
MKS.png (13.33 KiB) Viewed 1159 times

F. Imperial Decimal:
Imperial Decimal with units as is
Imperial Decimal with units as is
Imperial-decimal-unit.png (13.21 KiB) Viewed 1159 times
Imperial Decimal as is
Imperial Decimal as is
Imperial-decimal.png (12.85 KiB) Viewed 1159 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

My PR fixes issues A D and E:
Standard with PR
Standard with PR
Standard-PR.png (14.29 KiB) Viewed 1154 times
MKS with PR
MKS with PR
MKS-PR.png (14.72 KiB) Viewed 1154 times
Building-Euro with PR
Building-Euro with PR
Building-Euro-PR.png (14.64 KiB) Viewed 1125 times
Building-Euro with  units and PR
Building-Euro with units and PR
Building-Euro-unit-PR.png (15.18 KiB) Viewed 1125 times


Issues B, C and F are not fixed by the PR and I see that my PR even leads to wrong values for the imperial schemes when displayed without unit. So there is more work to do to fix the dimensioning
-> I'll come up with a better PR.
Last edited by uwestoehr on Mon Nov 30, 2020 3:01 pm, edited 1 time in total.
aapo
Posts: 624
Joined: Mon Oct 29, 2018 6:41 pm

Re: unit mismatch error for dimensions

Post by aapo »

uwestoehr wrote: Mon Nov 30, 2020 1:57 pm I made now a complete test using all possible uni schemes with and without units. At the moment we have several bugs:
I don't think the situation is that bad, I tested with the plain FreeCAD without the patch, and for me cases BCDF work with the vanilla FreeCAD. There's a thing, however, one must remember to set enough decimals (I put 8 instead of standard 2) into the general preferences decimal setting, and also use a format spec that always prints out the decimals, e.g. %.3g.

EDIT: There's a stupidity in the unit system with regards to TechDraw; why should these "hidden decimals" in the general settings affect the TechDraw values *before* the conversion takes place? That's very confusing, but that's the way it is. Putting "8" into that selection solves the problem, but I'd prefer that TD would use the full precision *before the conversion*!

20201130 TD-UnitMismatchError-pic01.png
20201130 TD-UnitMismatchError-pic01.png (27.76 KiB) Viewed 1143 times
20201130 TD-UnitMismatchError-pic02.png
20201130 TD-UnitMismatchError-pic02.png (24.01 KiB) Viewed 1143 times
Last edited by aapo on Mon Nov 30, 2020 2:53 pm, edited 1 time in total.
aapo
Posts: 624
Joined: Mon Oct 29, 2018 6:41 pm

Re: unit mismatch error for dimensions

Post by aapo »

uwestoehr wrote: Mon Nov 30, 2020 2:07 pm ... and i see that my PR even leads to wrong values for the imperial schemes when displayed without unit.
Yes, I think that'll unfortunately be the main problem, if one tries to fix the original general unit-problem without adding the extra UnitSchemas. There's no way to convert if you don't know what the preferred target unit is - the desired result won't always be "mm".
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: unit mismatch error for dimensions

Post by uwestoehr »

aapo wrote: Mon Nov 30, 2020 2:33 pm I don't think the situation is that bad, I tested with the plain FreeCAD without the patch, and for me cases BCDF work with the vanilla FreeCAD.
Not for me. I can set many decimals in advance but they only have an effect for new dimensions:
FreeCAD_TY0X9nU4qe.png
FreeCAD_TY0X9nU4qe.png (16.65 KiB) Viewed 1119 times
This is a no-go for real life because it is a loss of information. The dimensions must take care to automatically extend the precision when it is not sufficient, at least in my opinion.
But OK, let's do this step by step. Step one will be my PR that it does not introduce new issues, then I will sort out the remaining ones like I did for the hole dialog. Give me some time.
Post Reply