Macros for generation properties list of active object

Discussions about the wiki documentation of FreeCAD and its translation.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Macros for generation properties list of active object

Post by Evgeniy »

User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: Macros for generation properties list of active object

Post by Roy_043 »

Nice! Is there a way to exclude the inherited properties? See f.e. Draft_Facebinder.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: Macros for generation properties list of active object

Post by Evgeniy »

You mean properties inherited from Part feature?

1. May be add the ability to display not only the hidden type to the template?

https://wiki.freecadweb.org/index.php?t ... ction=edit
https://wiki.freecadweb.org/index.php?t ... ction=edit

From https://wiki.freecadweb.org/Part_Feature
Data (hidden)Visibility (Bool): whether to display the object or not..
this parameter is not hidden in FreeCAD interface

2. Is possible to extend "Data" and "View" text with {{#switch:}} as in #top template?

/en=Data
/ru=Данные
etc on other langage...

For https://wiki.freecadweb.org/index.php?t ... ction=edit

/en=View
/ru=Вид
/fr=
/it=
/de=
etc...

Code: Select all

{{Variable|{{{1}}}|Data|{{{2|}}}|{{#if:{{{3|}}}
                                     |hidden
                                     |}}}}<noinclude>
Last edited by Evgeniy on Mon Sep 06, 2021 6:48 pm, edited 3 times in total.
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: Macros for generation properties list of active object

Post by Roy_043 »

Of course not all objects are based on a Part Feature object. Arch_Structure and Draft_Facebinder are, but f.e. Draft_Wire and Draft_Text are not.

Removing inherited properties shortens the list, leaving only the properties that are of interest.
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: Macros for generation properties list of active object

Post by Roy_043 »

Evgeniy wrote: Mon Sep 06, 2021 6:18 pm 1. May be add the ability to display not only the hidden type to the template?
What other types do you mean?

Evgeniy wrote: Mon Sep 06, 2021 6:18 pm 2. Is possible to extend "Data" text with {{#switch:}} as in #top template?
Don't know how useful that is, sometimes you need more flexibility than such a template can offer: Draft_Dimension. And, contrary to the Top link, these headings typically do not occur multiple times on a single page. And where would you end, do you also want to create templates for the other standard headings (Description, Usage, etc.)?
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: Macros for generation properties list of active object

Post by Evgeniy »

User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: Macros for generation properties list of active object

Post by Roy_043 »

OK. I see that I misunderstood your "Data" template proposal...
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: Macros for generation properties list of active object

Post by Evgeniy »

Roy_043 wrote: Mon Sep 06, 2021 6:42 pm Removing inherited properties shortens the list, leaving only the properties that are of interest.
I think that creating such a macro is not possible at the moment. Because FreeCAD indicates that some fields are not hidden, although in fact they are hidden. I tried to create a similar macro, but it does work not correctly.

https://wiki.freecadweb.org/Macro_Wiki_ ... _Generator
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: Macros for generation properties list of active object

Post by Roy_043 »

Evgeniy wrote: Thu Sep 09, 2021 11:56 am I think that creating such a macro is not possible at the moment
Have you looked at the getAllDerivedFrom and getPropertyStatus methods?
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: Macros for generation properties list of active object

Post by Evgeniy »

Roy_043 wrote: Thu Sep 09, 2021 4:33 pm Have you looked at the getAllDerivedFrom?
This method will not give anything useful. Needs a method that allows us to find out the parent from which the object is inherited.

Code: Select all

>>> z = App.ActiveDocument.addObject("Part::Sphere","Sphere")
>>> z.getAllDerivedFrom()
['Part::Sphere']
Last edited by Evgeniy on Thu Sep 09, 2021 4:51 pm, edited 1 time in total.
Post Reply