Sketcher is allergic to the letter l

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!
mcemp
Posts: 15
Joined: Wed Sep 25, 2019 8:38 am

Sketcher is allergic to the letter l

Post by mcemp »

I have Freecad 18.4
You can see all from picture or attached file. The dimension 25 has name l. I want to write expression at dimension 10.06.
I recieved error message Failed to write expression. When I change the name to ll, all is OK.
Attachments
sketcher.FCStd
(5.45 KiB) Downloaded 20 times
sketcher.jpg
sketcher.jpg (47.21 KiB) Viewed 1097 times
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher is allergic to the letter l

Post by openBrain »

Hi,
'l' is unit for lumen, thus it breaks expression parsing when you try to use it.
This is known, and true for every string representing a unit (A, V, rad, deg, ...).
There is a ticket to improve the situation by preventing the user to do so (or warning him/her). ;)

EDIT : JFYI issue #3379
mcemp
Posts: 15
Joined: Wed Sep 25, 2019 8:38 am

Re: Sketcher is allergic to the letter l

Post by mcemp »

Thanks a lot. It will be solved in version 19
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher is allergic to the letter l

Post by openBrain »

mcemp wrote: Thu Nov 21, 2019 3:32 pm Thanks a lot. It will be solved in version 19
:? 0.19 is the targeted version to fix this actually. :) But IMHO, not important enough to postpone 0.19 release if it's still not fixed when time will come. ;)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Sketcher is allergic to the letter l

Post by Kunda1 »

Moved to Help subforum
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Sketcher is allergic to the letter l

Post by vocx »

openBrain wrote: Thu Nov 21, 2019 3:13 pm Hi,
'l' is unit for lumen, thus it breaks expression parsing when you try to use it.
...
Is it not for "liter"?

Expressions
Expressions wrote: If you have a variable with a name of a unit you must put the variable into << >> to prevent that it will be recognized as unit. For example if you have the dimension 'Sketch.Constraints.A' it would be recognized as unit ampere. Therefore you must write it in the expression as 'Sketch.Constraints.<<A>>'.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher is allergic to the letter l

Post by openBrain »

vocx wrote: Thu Nov 21, 2019 5:04 pm
openBrain wrote: Thu Nov 21, 2019 3:13 pm Hi,
'l' is unit for lumen, thus it breaks expression parsing when you try to use it.
...
Is it not for "liter"?
Oh yes, you're right. :oops:
mcemp
Posts: 15
Joined: Wed Sep 25, 2019 8:38 am

Re: Sketcher is allergic to the letter l

Post by mcemp »

These are all just repairs.
Wouldn't be better to rewrite the parser ?
Every unit is preceded by a space, variable is preceded by dot.
If we just fix everything, then Freecad will never be good software.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher is allergic to the letter l

Post by openBrain »

mcemp wrote: Thu Nov 28, 2019 9:22 am Wouldn't be better to rewrite the parser ?

Feel free to submit a PR. :) It will resolve above issue I pointed.

If we just fix everything, then Freecad will never be good software.
:? Are you sure of this sentence?
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Sketcher is allergic to the letter l

Post by UR_ »

vocx wrote: Thu Nov 21, 2019 5:04 pm Expressions

Expressions wrote:
If you have a variable with a name of a unit you must put the variable into << >> to prevent that it will be recognized as unit. For example if you have the dimension 'Sketch.Constraints.A' it would be recognized as unit ampere. Therefore you must write it in the expression as 'Sketch.Constraints.<<A>>'.

Seems to be broken


tested version:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18782 (Git)
Build type: Release
Branch: master
Hash: 84752715e829ed7fec40453a0714513b36d637a9
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)



workflow:
- load
broken parser.FCStd
(9.26 KiB) Downloaded 21 times
- execute

Code: Select all

App.ActiveDocument.Sketch.setExpression('Constraints[9]', u'<<A>>')
:boom:
IndexError: Array out of bound: 9, 9 In unsigned __int64 __cdecl App::ObjectIdentifier::Component::getIndex(unsigned __int64) const in src\App\ObjectIdentifier.cpp:597
Post Reply