[Ticket #4104] Void property value defaults to 1

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!
openBrain
Posts: 5215
Joined: Fri Nov 09, 2018 5:38 pm

[Ticket #4104] Void property value defaults to 1

Postby openBrain » Wed Aug 28, 2019 7:00 pm

Hi,
I just remarked that a void property value defaults to 1.
I found this counter-intuitive, error-prone, and IIRC it wasn't the case some times ago (before the LinkMerge ?) where it correctly defaults to 0.=> Bad memory

To reproduce, select any numerical value in the property editor (in combo view) and delete (void) the existing value (you can keep the unit if present) then hit "Tab" to switch out of the field => Value is 1 (I would expect 0).

Can one confirm ?

OS: Ubuntu 18.04.3 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
Last edited by openBrain on Thu Aug 29, 2019 2:51 pm, edited 2 times in total.
kisolre
Posts: 3033
Joined: Wed Nov 21, 2018 1:13 pm

Re: [Bug ?] Void property value defaults to 1

Postby kisolre » Wed Aug 28, 2019 7:24 pm

Same here.

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17877 (Git)
Build type: Release
Branch: master
Hash: 1e19ef5be4735f4200eaf99ce9e487d2be6f4151
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)

But also with version before LinkMerge:

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17505 (Git)
Build type: Release
Branch: master
Hash: 755536e9df94d2d39da1468420f1fd333c35da7a
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
openBrain
Posts: 5215
Joined: Fri Nov 09, 2018 5:38 pm

Re: [Bug ?] Void property value defaults to 1

Postby openBrain » Wed Aug 28, 2019 7:28 pm

Thanks kisolre.
Am I the only one expecting 0 or does it seems sensible?
kisolre
Posts: 3033
Joined: Wed Nov 21, 2018 1:13 pm

Re: [Bug ?] Void property value defaults to 1

Postby kisolre » Wed Aug 28, 2019 7:36 pm

Its the same with

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)

and

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Bulgarian/Bulgaria (bg_BG)

and even

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
?!?

I had probably used this to clear a value in the past but never noticed that. It looks sensible to be 0 but probably there is other logic behind that?
User avatar
DeepSOIC
Posts: 7832
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: [Bug ?] Void property value defaults to 1

Postby DeepSOIC » Wed Aug 28, 2019 7:48 pm

interestingly, not just to "1", but to "1 default unit" (tried with imperial decimal). So I would suppose it is a quirk of how unit is parsed?..
openBrain
Posts: 5215
Joined: Fri Nov 09, 2018 5:38 pm

Re: [Bug ?] Void property value defaults to 1

Postby openBrain » Wed Aug 28, 2019 7:54 pm

DeepSOIC wrote:
Wed Aug 28, 2019 7:48 pm
interestingly, not just to "1", but to "1 default unit" (tried with imperial decimal). So I would suppose it is a quirk of how unit is parsed?..
Interesting insight... I'm now more in front of a computer, but it would be interesting to try with a unitless field, such as array repetition count.
chrisb
Posts: 30875
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug ?] Void property value defaults to 1

Postby chrisb » Wed Aug 28, 2019 8:23 pm

It has been like that since many years. I always thought it was sensible, because in many places it prevents the model from becoming temporarily invalid which may cause weird things. It had been forgotten in the pocket dialog and that made FreeCAD crash.

So it is not sensible to have height, width, or length of a cube to be 0, while 1 is ok. As this should happen only as an intermediate state during editing it shouldn't really be a problem.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Chris_G
Posts: 1583
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: [Bug ?] Void property value defaults to 1

Postby Chris_G » Wed Aug 28, 2019 8:32 pm

chrisb wrote:
Wed Aug 28, 2019 8:23 pm
So it is not sensible to have height, width, or length of a cube to be 0, while 1 is ok. As this should happen only as an intermediate state during editing it shouldn't really be a problem.
+1
Defaulting to 0, can be dangerous on some tools or workbenches.
( Even if it should be up to them to care about these special cases ).
wmayer
Site Admin
Posts: 16875
Joined: Thu Feb 19, 2009 10:32 am

Re: [Bug ?] Void property value defaults to 1

Postby wmayer » Thu Aug 29, 2019 9:00 am

IMO the only sensible value should be the one that was set before deleting the content. And that's also the behaviour of Qt's spin box classes.
openBrain
Posts: 5215
Joined: Fri Nov 09, 2018 5:38 pm

Re: [Bug ?] Void property value defaults to 1

Postby openBrain » Thu Aug 29, 2019 10:03 am

wmayer wrote:
Thu Aug 29, 2019 9:00 am
IMO the only sensible value should be the one that was set before deleting the content. And that's also the behaviour of Qt's spin box classes.
Like it ! Does that deserve a ticket ? Could you confirm that this behavior is introduced by the expression parser ?