sketcher: what does the option "Extended Information" do

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!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

sketcher: what does the option "Extended Information" do

Post by uwestoehr »

The sketcher dialog has in the section Constraints the option "Extended Information": https://www.freecadweb.org/wiki/Sketche ... onstraints

What does it do, I mean what do the numbers mean?
(I could only google that one user already asked this (https://forum.freecadweb.org/viewtopic. ... 10#p242878) but got no reply.)

Abdullah?
abdullah wrote: Fri Jul 06, 2018 12:33 pm Ping
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: what does the option "Extended Information" do

Post by uwestoehr »

Many thanks! (strange that I could not google this)

I documented it now: https://www.freecadweb.org/wiki/Sketche ... onstraints
However, I think there is an off-by one error because the extended info does not use the number of the element as used in the list of elements.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: sketcher: what does the option "Extended Information" do

Post by jmaustpc »

uwestoehr wrote: Sun Jul 14, 2019 9:40 pm However, I think there is an off-by one error because the extended info does not use the number of the element as used in the list of elements.
the first item is "0" and the next "1" in Python, but in the GUI the first is 1. This has always been like that, the extended info is reading the number you see from Python. You have to allow for that when writing code/macro in Python. :)
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: sketcher: what does the option "Extended Information" do

Post by bejant »

uwestoehr wrote: Sun Jul 14, 2019 9:40 pm Many thanks! (strange that I could not google this)
You're welcome, I had trouble finding it in the past too so since then I have had those pages Bookmarked.


uwestoehr wrote: Sun Jul 14, 2019 9:40 pm I think there is an off-by one error because the extended info does not use the number of the element as used in the list of elements.
That may be; from the 3rd reply in the first link:
[(GeoId1,PosId1);(GeoId2,PosId2);(GeoId3,PosId3)]

GeoId identifies the element. It is the value you use in Python to identify the geometric element.
PosId is: 0 = the edge, 1 = starting point, 2 = endpoint, 3 = midpoint
The internal Python identifier might be different than what is displayed to the user.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: what does the option "Extended Information" do

Post by uwestoehr »

jmaustpc wrote: Sun Jul 14, 2019 9:48 pm This has always been like that, the extended info is reading the number you see from Python. You have to allow for that when writing code/macro in Python. :)
bejant wrote: Sun Jul 14, 2019 9:57 pm The internal Python identifier might be different than what is displayed to the user.
I raised the topic now in the original thread of implementation: https://forum.freecadweb.org/viewtopic. ... 0&start=20

I don't see a reason why numbers are different in the dialogs than in the scripts. This is error-prone and I don't think users have a problem that numbers in the dialogs begin with '0'.
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: sketcher: what does the option "Extended Information" do

Post by TheMarkster »

In programming lists almost always begin with the first item at index 0. Python programmers will know this already. Average user who is not a programmer will expect the list to start with 1.

Could this be changed so the 2 are the same? Yes, we could ignore index 0 in the code, but this would be wasting memory, even if only a negligible amount. We could display the list to the user as starting with Constraint 0, but would this cause some confusion? Maybe so. Another potential issue with changing things like this is the possibility of breaking existing code or possibly even existing models depending on the current behavior.
chrisb
Veteran
Posts: 54192
Joined: Tue Mar 17, 2015 9:14 am

Re: sketcher: what does the option "Extended Information" do

Post by chrisb »

uwestoehr wrote: Sun Jul 14, 2019 11:48 pm This is error-prone
TheMarkster wrote: Mon Jul 15, 2019 1:31 am In programming lists almost always begin with the first item at index 0.
[Off topic]It was very well known in high level programming languages how to handle arrays that start at an arbitrary index, until C came around - the best assembler I have ever seen. Sad to say, but there are very well educated people who think it is high level near to natural thinking, to have months from 0 to 11 and days from 0 to 30. But that's the way it is.[/Off topic]

I don't think it would be a problem in Python code, because the numbers shown are not visible. I am not so sure as far as the expression system is concerned.

On the other hand: "error prone" means to me that errors occur frequently or regularly. This is not the case. Even the cases where people ask questions about it are very very rare.

Uwe, in other posts you go the opposite way, and vote - I exaggerate - that every uneducated idiot should be able to use FreeCAD. And these uneducated people should now become happier if the 1st element is the 0th? I could very well live with a change, but I think we can very well leave things as they are; searching the archives should prove this.

If you want to change this, you should go to the Python people and convince them to include higher level lists.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: what does the option "Extended Information" do

Post by uwestoehr »

chrisb wrote: Mon Jul 15, 2019 7:53 am Uwe, in other posts you go the opposite way, and vote - I exaggerate - that every uneducated idiot should be able to use FreeCAD. And these uneducated people should now become happier if the 1st element is the 0th?
You were not exaggerating. :D Of course CAD needs a lot of knowledge but with the focus on uneducated users you keep the focus on simplicity.

Concerning this issue, I say error-prone because I see e.g. in the task dialog that element 137 is a circle. Then I want to do something with it using a script, checking its dimension or whatever and accidentally use number 137. But 137 in the script would handle a line not a circle (which I see as 138 in the task dialog). In my programming experience these off-by-one errors occur frequently, even very experienced programmers make it.
Average users who don't use scripts or even don't know what a script is, would see as first element e.g. "0-Line" in the task dialog. I don't think they don't care.

I would continue in the other thread (developer section of the forum).
Post Reply