Ticket #3691 - Bug in draft scale. Only integers work

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Roy_043
Veteran
Posts: 8577
Joined: Thu Dec 27, 2018 12:28 pm

Re: Bug in draft scale. Only integers work

Post by Roy_043 »

IMO it is wrong that the units setting has any impact on the scale input. It is actually not possible to set the number of decimals to zero. But even if that were possible, the setting should only influence how numerical properties and values are displayed, but not constrict user input.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Bug in draft scale. Only integers work

Post by GeneFC »

Roy_043 wrote: Tue Feb 05, 2019 6:01 pm IMO it is wrong that the units setting has any impact on the scale input.
I don't think that is the problem. The actual problem is that the "units" entry in preferences is not initialized in the default or reset "user.cfg" file. I don't know why the scale operation needs to look there, but it appears to restrict scaling if nothing is found in preferences.

(I just tried it both ways, with a populated preference file and without.)

Gene
User avatar
Roy_043
Veteran
Posts: 8577
Joined: Thu Dec 27, 2018 12:28 pm

Re: Bug in draft scale. Only integers work

Post by Roy_043 »

@GeneFC:
I understand that you want to go into details, but fundamentally the scale operation should not be affected by the units setting. It should not 'look there'! And that, very much, is the problem I would say.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Bug in draft scale. Only integers work

Post by GeneFC »

It is *not* affected by the unit setting, but if that setting has never been initialized the scale operation fails. A very common problem in all sorts of software.

It is a bug, but not because the units have any particular numerical value.

i did not write the code, so I do not know why it was done that way.

Gene
User avatar
HarryGeier
Veteran
Posts: 1231
Joined: Mon Jul 10, 2017 12:36 pm
Location: Hof Germany

Re: Bug in draft scale. Only integers work

Post by HarryGeier »

Interesting, as these days i had a discussion on that matter.. Works for me, but not for a customers FreeCAD.

If someone starts to work on it, and improve it.. A box for the step increments , like in transform , would be very useful and allow smoother visual scaling.

harry
Kaum macht man´s richtig , gehts´s
My Video Tutorials on Youtube: https://www.youtube.com/channel/UCoe3B ... p8Q/videos
My FreeCAD Stuff on Hidrive: https://my.hidrive.com/share/qr3l1yddy6#$/
User avatar
Roy_043
Veteran
Posts: 8577
Joined: Thu Dec 27, 2018 12:28 pm

Re: Bug in draft scale. Only integers work

Post by Roy_043 »

@GeneFC:
My point is that the units setting, initialized or not, and whatever its value, should not have any impact on the scale operation. IMO crisb's initial comment in the bug tracker: "Works as designed, OP might have set decimal places wrong" does not make sense.
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Bug in draft scale. Only integers work

Post by chrisb »

Roy_043 wrote: Wed Feb 06, 2019 9:40 am @GeneFC:
My point is that the units setting, initialized or not, and whatever its value, should not have any impact on the scale operation. IMO crisb's initial comment in the bug tracker: "Works as designed, OP might have set decimal places wrong" does not make sense.
... and I added another comment. What is it precisely what you want? The issue is described in detail, there is a workaround and it might get fixed someday.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
JAndersM
Posts: 63
Joined: Tue Dec 22, 2015 1:35 pm

Re: Bug in draft scale. Only integers work

Post by JAndersM »

I agree with Roy_043 that the scale factor should not be affected by the precision settings for dimensions at all. The best thing would be to enable expressions in the scale factor input (eg. to write 1/3).
I did change the code in my copy (DraftGui.py line 2296, 2303, 2310) to always use 6 decimals.
I have not figured out how to implement expressions in the input. If someone wants to point me to an example showing how to do this I will be happy to try implementing it and share the result if successful.
User avatar
Roy_043
Veteran
Posts: 8577
Joined: Thu Dec 27, 2018 12:28 pm

Re: Bug in draft scale. Only integers work

Post by Roy_043 »

chrisb wrote: Wed Feb 06, 2019 11:06 am What is it precisely what you want? The issue is described in detail, there is a workaround and it might get fixed someday.
There are two potential solutions:
1.
The scale factor should stay linked to the number of decimal units. In the current implementation the link is incorrect, and this should be fixed.
2.
The scale factor should not be linked to the number of decimal units in any way as this is illogical. To fix things the link should be removed.

IMO only solution #2 is correct. Your and GeneFC's comments leave me in doubt about your opinions.
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Bug in draft scale. Only integers work

Post by chrisb »

This is my last try to explain it, because I have the feeling that except Gene the contributors havent carefully read what was posted and haven't thoroughly tested the current behaviour.

The scale factor is independent from the number of decimal units!

Let me give two examples to make it clearer:
If I set the number of decimal units to 2 the number of decimals in the scale factor is 6.
If I set the number of decimal units to 4 the number of decimals in the scale factor is 6.

Only the initialization is somehow linked to having edited the number of decimals in preferences once.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply