Description |
---|
Cette macro génère la liste des propriétés de l'objet sélectionné. Liste présentée au format wiki dans la vue du rapport Python. Version macro : 0.1 Date dernière modification : 2021-09 Auteur: Evgeniy |
Auteur |
Evgeniy |
Téléchargement |
None |
Liens |
Page des macros Comment installer une macro Comment créer une barre d'outils |
Version Macro |
0.1 |
Dernière modification |
2021-09 |
Version(s) FreeCAD |
None |
Raccourci clavier |
None |
Voir aussi |
Macro Wiki Object Properties List Generator |
Cette simple macro génère la liste des propriétés de l'objet sélectionné. La liste des paramètres est imprimée dans la Vue rapport de FreeCAD. Cet exemple est de nature plus pédagogique et n'est pas applicable pour une utilisation sans édition après génération, puisqu'il inclut absolument tous les paramètres de l'objet. Les listes de propriétés qui sont publiées dans ce wiki ne contiennent, en règle générale, que des paramètres uniques. Les paramètres hérités des objets parents ne sont pas publiés.
Ne supprimez pas les espaces entre les lignes. Cela est nécessaire pour simplifier la traduction. Chaque ligne séparée par un espace sera considérée comme une partie distincte pour la traduction. Lorsque vous créez des textes, n'oubliez jamais que les grands fragments monolithiques de texte sont difficiles à traduire pour les traducteurs.
Les résultats peuvent ressembler à ceci :
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 discussion sur le forum : https://forum.freecadweb.org/viewtopic.php?f=21&t=61998