Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gui: [skip ci] reduce confusion m vs. mm in units calculator
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
702ae02
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wwmayer I know this is old, so forgive me! Am working through Unit.
Is this PR a workaround for what is really a problem somewhere else?
702ae02
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is specific to this dialog. With the old implementation if the value of the quantity was "2.4 m" and you changed the unit then the quantity was always reset to 1.0 + the chosen which wasn't very helpful.
Now it keeps the old value and replaces the unit. So, it the quantity is e.g. 2.4 m and you change the unit from length to area then it should become 2.4 m^2. But because internally FreeCAD uses mm instead of m for lengths the value must be multiplied with a factor.
702ae02
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool.
Having said that, I spent some time trying to figure out Unit and its mates. It did my head in. I came away thinking "there must be a better way". The amount of repetiteos (Sp?) code makes me think a more structured solution is needed. One for another day.