(SOLVED) Sketcher: system-generated constraint name only usable after renaming? e.g. in the formula editor
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
- thomas-neemann
- Veteran
- Posts: 11801
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
(SOLVED) Sketcher: system-generated constraint name only usable after renaming? e.g. in the formula editor
I only manage to use the system generated contraint name if I rename it to itself. am I doing something wrong?
OS: Ubuntu 20.04.1 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.28918 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 69a4963)
Hash: 69a4963ebfdbdda0d069347d013f28f2d6ba687a
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: German/Germany (de_DE)
OS: Ubuntu 20.04.1 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.28918 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 69a4963)
Hash: 69a4963ebfdbdda0d069347d013f28f2d6ba687a
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: German/Germany (de_DE)
Last edited by thomas-neemann on Wed May 25, 2022 7:12 am, edited 2 times in total.
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
Code: Select all
Sketch.Constraints[0]
- thomas-neemann
- Veteran
- Posts: 11801
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
Thank you for your prompt reply. it works, but how do you get Constraints[0]
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
This is as any numbered element in FreeCAD (Face, Edge, Vertex, ...)thomas-neemann wrote: ↑Wed May 25, 2022 6:10 am Thank you for your prompt reply. it works, but how do you get Constraints[0]
'.ElementN' = '.Elements[N-1]'
-
- Posts: 590
- Joined: Wed Sep 29, 2021 8:35 am
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
The issue you have run into is, I suspect, common to many people.
The answer is given above.
It is also given in slightly longer form in the 'Referencing Objects' part of the Expressions wiki page (https://wiki.freecadweb.org/Expressions).
If the answer satisfies your need, great, but please do a follow up post if you want to know why the answer is correct.
---
Now a plea to the wiki writers:
In common with so much of the documentation, that page prioritises brevity over clarity and pedagogy. It is written from a programmer's point of view, not as a way to assist a non-technical new user. It would surely be much better to use a few more words to explain how stuff is stored internally (single variables vs. arrays) and the different ways you access them.
It is a very similar story with the 'Reference to CAD data' part of the page: 'If the property is a compound of fields, the individual fields can be accessed as object.property.field'. To a non-technical user, that is incomprehensible because they do not know the specialised meaning of each individual word. Even a 'data storage and retrieval 101' page that could be linked to would allow people to do a little background reading.
The answer is given above.
It is also given in slightly longer form in the 'Referencing Objects' part of the Expressions wiki page (https://wiki.freecadweb.org/Expressions).
If the answer satisfies your need, great, but please do a follow up post if you want to know why the answer is correct.
---
Now a plea to the wiki writers:
In common with so much of the documentation, that page prioritises brevity over clarity and pedagogy. It is written from a programmer's point of view, not as a way to assist a non-technical new user. It would surely be much better to use a few more words to explain how stuff is stored internally (single variables vs. arrays) and the different ways you access them.
It is a very similar story with the 'Reference to CAD data' part of the page: 'If the property is a compound of fields, the individual fields can be accessed as object.property.field'. To a non-technical user, that is incomprehensible because they do not know the specialised meaning of each individual word. Even a 'data storage and retrieval 101' page that could be linked to would allow people to do a little background reading.
- thomas-neemann
- Veteran
- Posts: 11801
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
thank you for your explanation. Isn't it wise to display it here from the system as well?
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
No opinion from my side on this.thomas-neemann wrote: ↑Wed May 25, 2022 6:40 am thank you for your explanation. Isn't it wise to display it here from the system as well?
- thomas-neemann
- Veteran
- Posts: 11801
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
is there a way to display all the names created by the system?
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
Not sure to get your point completely. Do you mean on a single sketch, or across a complete document ?thomas-neemann wrote: ↑Wed May 25, 2022 6:55 am is there a way to display all the names created by the system?
In the form 'ContraintN' or 'Constraints[N]' ?
- thomas-neemann
- Veteran
- Posts: 11801
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
Re: Sketcher: system-generated contraint name only usable after renaming? e.g. in the formula editor
I mean e.g. a macro which shows all variables of a document or a sketch. or a python line from which i can create a macro