I expect the same, but from what I learned here, it is not possible.
It is correct and sensible to keep the unit shown, when a value is entered via GUI. And we expect the same from an expression.
Alas, the expression doesn't know the GUI and doesn't know how the value was before.
If we had before a value given in V an we enter a unitless value, then we expect the result in V.
If we had before a value given in mV an we enter a unitless value, then we expect the result in mV.
We cannot have both of these with expressions. If in doubt, enter the unit in the expression and everything is ok.
Expression parser broken for Python objects
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Expression parser broken for Python objects
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Expression parser broken for Python objects
This example doesn't sound very convincing and looks like too devised to me. If you hit the wrong key your input is really invalid and you cannot expect the parser to fix this automatically. That's why the result label shows the red error text "Unit mismatch between result and required unit" and the OK button is disabled in order to avoid to accept the wrong input.I asked about forcing them to enter "3V" but this would not only be a keystroke more but is error-prone. One might hit the wrong key, so e.g. enter "3C", then get an error and annoyed since one loose time to read the error message.
Because the error is shown immediately I don't see how you would lose time. IMO, it's even a time saver because what would happen if the expression parser were too permissive and accepted some invalid input? Sooner or later you will run into a situation where the invalid expression will produce total nonsense as the result of an operation or will raise weird error message without having a clue where it comes from. Then it may become really time consuming to find the root of the problem.
Re: Expression parser broken for Python objects
You know how it is in stressy daily work. In my example entering accidentally "3C" "steals time":wmayer wrote: ↑Thu Sep 08, 2022 12:43 pmThis example doesn't sound very convincing and looks like too devised to me. If you hit the wrong key your input is really invalid and you cannot expect the parser to fix this automatically. That's why the result label shows the red error text "Unit mismatch between result and required unit" and the OK button is disabled in order to avoid to accept the wrong input.I asked about forcing them to enter "3V" but this would not only be a keystroke more but is error-prone. One might hit the wrong key, so e.g. enter "3C", then get an error and annoyed since one loose time to read the error message.
- you get an error message that must be read
. you need to understand what is written there
- you must reenter the value
From the user's perspective, the value is a voltage, why is there a need to input the unit when it is obviously "V"?
When the unit is always volt, why is there an accidental input of "3C" possible at all?
I know that this is difficult to answer and we have our technical reasons but as user who has to work with a dozen programs every day, I understand these questions.
---------------------------
Important is in my opinion, if we can improve the situation and how? I feel meanwhile guilty to changed for FEM some inputs to be expressions when people obviously don't want to be bothered with that when it is clear what the unit. is. So i can change the expressions to a FloatSpinEdit. Should i?
Re: Expression parser broken for Python objects
As a user of Imperial Decimal units I learned a long time ago to check *every* input for correct units. It quickly becomes completely transparent and automatic. No time wasted at all.
Gene
Re: Expression parser broken for Python objects
It's a single line and it shouldn't take more than a second to read it. The error message is very clear about what the problem is.- you get an error message that must be read
If it happens the very first time it may take a while to get it. But if it happens more often you immediately see the problem.you need to understand what is written there
Since the dialog disables the OK button the incorrect input won't be accepted. You don't have to enter again the whole expression but fix the wrong part.- you must reenter the value
How does the expression parser know that your input is complete? For more complex expressions it can happen that you have a quantity in Joule and another quantity in Coulomb: 12J / 3CWhen the unit is always volt, why is there an accidental input of "3C" possible at all?
Re: Expression parser broken for Python objects
Sure, complex expressions with mixed units should be possible and are useful. The two questions I raised are examples of what I got as feedback. As I stated, we have good reasons for the current feature.
My proposal was that when the user did not enter any unit, if we can then automatically add the default unit. Can this somehow be done?
(I want to improve the situation since I understand the daily stress well and learned that average users don't care much about the specialties of a certain program. For example I recently wrote a laboratory equipment control software for a customer and the users all have a university degree. Nevertheless they don't read docs, nor even the messages I issue in the program. They just click OK and then call me why it is not working as they expect, despite the message dialog they confirmed with pressing OK describes exactly what will happen when clicking OK . Sometimes one has to live with this. However, since every call to me costs them money, it became better .)