| Descrizione |
|---|
| Questa macro genera un elenco di proprietà dell'oggetto selezionato. L'elenco viene presentato in formato wiki nella vista report di Python. Versione macro: 0.1 Ultima modifica: 09-2021 Autore: Evgeniy |
| Autore |
| Evgeniy |
| Download |
| None |
| Link |
| Raccolta di macro Come installare le macro Personalizzare la toolbar |
| Versione macro |
| 0.1 |
| Data ultima modifica |
| 09-2021 |
| Versioni di FreeCAD |
| None |
| Scorciatoia |
| Nessuna |
| Vedere anche |
| Macro Wiki Object Properties List Generator |
Questa semplice macro genera un elenco di proprietà dell'oggetto selezionato. L'elenco dei parametri viene stampato nella vista Report di FreeCAD. Questo esempio ha scopo puramente didattico e non è utilizzabile senza modifiche successive alla generazione, poiché include assolutamente tutti i parametri dell'oggetto. Gli elenchi di proprietà pubblicati in questa wiki contengono, di norma, solo parametri univoci. I parametri ereditati dagli oggetti padre non vengono pubblicati.
Non eliminare gli spazi tra le righe. Ciò è necessario per semplificare la traduzione. Ogni riga separata da uno spazio verrà considerata una parte a sé stante ai fini della traduzione. Quando si creano testi, è importante ricordare che i frammenti di testo lunghi e monolitici sono difficili da tradurre per i traduttori.
I risultati potrebbero apparire in questo modo:
PythonObject):Component
Bool): Use the material color as this object's shape color, if availableDisplay Options
Bool): Display object bounding boxEnumeration): Set the display modeBool): Show the object in the tree viewBool): Show the object in the 3d viewNodes
Color): The color of the nodes lineFloat): The width of the nodes lineFloat): The size of the node pointsEnumeration): The type of structural nodeBool): If the nodes are visible or notObject Style
Angle): Specify how finely to generate the mesh for rendering on screen or when exporting.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.
FloatConstraint): Sets the accuracy of the polygonal representation of the modelin the 3D view (tessellation). Lower values indicate better quality. The value is in percent of object's size.
ColorList): Object diffuse color.Enumeration): Defines the style of the edges in the 3D view.Enumeration): Set object lighting.Color): Set object line color.ColorList): Object line color array.Material): Object line material.FloatConstraint): Set object line width.Color): Set object point colorColorList): Object point color array.Material): Object point material.FloatConstraint): Set object point size.Color): Set shape colorMaterial): Shape materialPercent): Set object transparencySelection
Enumeration): Enabled: Display the object on top of any other object when selectedObject: On top only if the whole object is selected Element: On top only if some sub-element of the object is selected
Bool): Set if the object is selectable in the 3d viewEnumeration): Set the object selection stylePlacement):PythonObject):Part::PropertyPartShape):Bool):Base
ExpressionEngine): Property expressionsString): User name of the object (UTF8)String): User description of the object (UTF8)Component
LinkList): Other shapes that are appended to this objectLink): An optional axis or axis system on which this object should be duplicatedLink): The base object this component is built uponLink): The object this component is cloningLink): An optional higher-resolution mesh or shape for this objectArea): The area of the projection of this object onto the XY planeLink): A material for this objectBool): Specifies if moving this object moves its base insteadBool): Specifies if this object must move together when its host is movedLength): The perimeter length of the horizontal areaString): An optional standard (OmniClass, etc...) code for this componentLinkList): Other shapes that are subtracted from this objectArea): The area of all vertical faces of this objectIFC
Map): IFC dataMap): IFC properties of this objectEnumeration): The type of this objectIFC Attributes
String): Description of IFC attributes are not yet implementedString): Description of IFC attributes are not yet implementedString): Description of IFC attributes are not yet implementedEnumeration): Description of IFC attributes are not yet implementedString): Description of IFC attributes are not yet implementedStructure
Enumeration): The facemaker type to use to build the profile of this objectLength): The height or extrusion depth of this element. Keep 0 for automaticLength): The length of this element, if not based on a profileVectorList): The structural nodes of this elementDistance): Offset distance between the centerline and the nodes lineVector): The normal extrusion direction of this object (keep (0,0,0) for automatic normal)String): A description of the standard profile this element is based uponLink): An optional extrusion path for this elementLength): The width of this element, if not based on a profile#! 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")
La discussione sul forum: https://forum.freecad.org/viewtopic.php?f=21&t=61998