Macro Wiki Object Properties List Generator Basic Version

Other languages:

Generic macro icon. Create your personal icon with the same name of the macro Wiki List Generator of Object Properties

Description
This macro generate properties list of selected object. List presented in wiki format into Python report view.

Macro version: 0.1
Last modified: 2021-09
Author: Evgeniy
Author
Evgeniy
Download
None
Links
Macro Version
0.1
Date last modified
2021-09
FreeCAD Version(s)
None
Default shortcut
None
See also
Macro Wiki Object Properties List Generator

Description

This simple macro generate properties list of selected object. The parameters list is printed to the Report view of FreeCAD. This example is more educational in nature and is not applicable for use without editing after generate, since it includes absolutely all the parameters of the object. The lists of properties that are published in this wiki contain, as a rule, only unique parameters. The parameters inherited from the parents objects are not published.

Usage

Recommendations

Do not delete spaces between lines. This is necessary to simplify the translation. Each line separated by a space will be considered a separate part for translation. When creating texts, always remember that large monolithic fragments of text are difficult for translators to translate.

Example of using

Results of using

The results may look like this:

Properties

View

Component

Display Options

Nodes

Object Style

The default value is 28.5 degrees, or 0.5 radians. The smaller the value the smoother the appearance in the 3D view, and the finer the mesh that will be exported.

in the 3D view (tessellation). Lower values indicate better quality. The value is in percent of object's size.

Selection

Object: On top only if the whole object is selected Element: On top only if some sub-element of the object is selected

Data

Base

Component

IFC

IFC Attributes

Structure

Script

#! python
# -*- coding: utf-8 -*-
# (c) 2021 <Evgeniy> LG
from FreeCAD import Qt

def print_obj_properties(obj,typ):
   prop={}
   i=1
   for pr in obj.PropertiesList:
      tp = obj.getTypeIdOfProperty(pr) or ""
      atr = obj.getTypeOfProperty(pr) or ("")
      # Wiki template supports only Hidden type of property. But it can be as: Hidden,Output,Readonly etc...
      if atr != "" and atr[0] == "Hidden":
         atr = "|"+atr[0]
      else:
         atr = ""      
      prop[str(i)] = pr,obj.getGroupOfProperty(pr),tp.replace("App::Property",""),obj.getDocumentationOfProperty(pr),atr
      i+=1
   sorted_prop = sorted(prop.items(), key=lambda x: x[1][1])

   title=""
   for pr in sorted_prop:
      if title != pr[1][1]:
         title = pr[1][1]
         print("\n"+"{{TitleProperty{"+title+"}}")
      print("\n"+"* {{Property"+typ+"{"+pr[1][0]+"{"+pr[1][2]+pr[1][4]+"}}: "+pr[1][3])

print("\n"+"==Properties==")
print("\n"+"===View===")
obj = Gui.activeDocument().ActiveObject
print_obj_properties(obj,"View")
print("\n"+"===Data===")
obj = FreeCAD.activeDocument().ActiveObject
print_obj_properties(obj,"Data")

Links

The discussion on the forum: https://forum.freecadweb.org/viewtopic.php?f=21&t=61998