how add custom properties to any object?
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
how add custom properties to any object?
Something like AutoCAD blocks and Attribute properties, how can I add custon properties any object and introduce expressions, and if possible introduce scripts?
Re: how add custom properties to any object?
Don't know AutoCAD blocks.
Additional properties can be added, by right clicking in the Properties section and then "Show All". Then you can edit custom properties.
Expressions are possible, scripts are forbidden due to security risks.
Additional properties can be added, by right clicking in the Properties section and then "Show All". Then you can edit custom properties.
Expressions are possible, scripts are forbidden due to security risks.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: how add custom properties to any object?
nice feature, but when I added my custom property appears nothing.
how can I unlock the script inside properties?chrisb wrote: ↑Thu Jan 28, 2021 12:05 pm Expressions are possible, scripts are forbidden due to security risks.
Re: how add custom properties to any object?
It works for me. I created a group "Params" with names "Height" and "Diameter" for a Body. The group shows up at the very end.jtm2020hyo wrote: ↑Thu Jan 28, 2021 12:20 pm nice feature, but when I added my custom property appears nothing.
OS: PureOS (GNOME/gnome)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23756 (Git) AppImage
Build type: Release
Branch: master
Hash: 9c6e9184930a52b165a0b7274e3a45d1006bfe67
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: how add custom properties to any object?
thanks for the answer, I noticed than is possible add properties, but not all properties.
a link to any documentation could be great, but I am more interested in add custom properties and add custom properties with scripts.
for example, in a Circle Draft Object, How can I calculate the perimeter? until I know it needs scripts.
a link to any documentation could be great, but I am more interested in add custom properties and add custom properties with scripts.
for example, in a Circle Draft Object, How can I calculate the perimeter? until I know it needs scripts.
Re: how add custom properties to any object?
Have a careful look at the screenshot.jtm2020hyo wrote: ↑Tue Feb 02, 2021 2:49 pm for example, in a Circle Draft Object, How can I calculate the perimeter? until I know it needs scripts.
You have limited ability to "script" things with expressions. Most importantly, you have the ?:-Operator, which gives you basically If-Then-Else. I have only tried little examples so far. These expression can easily break, I believe.
Note: You have to pick the right return type: For first expression I did use String, for the second Float.
Have a look at this thread: https://forum.freecadweb.org/viewtopic.php?f=27&t=38974
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: how add custom properties to any object?
Look cool
... Just for be clear, then is not possible add a python script to properties right?
... Just for be clear, then is not possible add a python script to properties right?
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: how add custom properties to any object?
I find another method:
look like in "Shape" Property has stored all values that we wish.
look like in "Shape" Property has stored all values that we wish.
Re: how add custom properties to any object?
As mentioned above: arbitrary Python scripts are forbidden due to security risks.jtm2020hyo wrote: ↑Wed Feb 03, 2021 7:48 am ... Just for be clear, then is not possible add a python script to properties right?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- ifohancroft
- Posts: 206
- Joined: Fri May 31, 2019 11:25 pm
- Location: Sofia, Bulgaria
- Contact:
Re: how add custom properties to any object?
Can you access custom properties of a parent object?
Like if I have a Sketch, inside of a Body inside of a Part, can I add a custom property to the Part then access that as a dimension constraint in the Sketch? How?
Like if I have a Sketch, inside of a Body inside of a Part, can I add a custom property to the Part then access that as a dimension constraint in the Sketch? How?
I like making, breaking and modding stuff, using a soldering iron, code or both. https://ifohancroft.com