Macro Wiki Object Properties List Generator Version basique

From FreeCAD Documentation
This page is a translated version of the page Macro Wiki Object Properties List Generator Basic Version and the translation is 100% complete.
Other languages:

Generic macro icon Wiki List Generator of Object Properties

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
Version Macro
0.1
Dernière modification
2021-09
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
Macro Wiki Object Properties List Generator

Description

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.

Utilisation

  • Préparation :
    • Copiez le code de la macro de cette page et placez-le dans un nouveau fichier *.FCMacro.
    • Enregistrez le fichier FCMacro. Et placez-le dans le dossier Macros de FreeCAD.
    • Désactiver la case à cocher Inclure un timecode pour chaque entrée dans Préférences -> Général -> Fenêtre de sortie (onglet).
  • Première utilisation :
    • Sélectionnez (ou créez et sélectionnez) l'objet dont vous avez besoin dans l'arborescence.
    • Sélectionnez l'élément Macro -> Macros... dans le menu principal.
    • Dans la fenêtre ouverte, trouvez le fichier *.FCMacro que vous avez sauvegardé et appuyez sur le bouton Lancer.
  • Comment l'utiliser à nouveau :
    • Pour exécuter rapidement cette macro à nouveau, vous pouvez utiliser le raccourci clavier Shift+Ctrl+1 (sous Windows) qui lancera la dernière macro exécutée.

Recommendations

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.

Exemples d'utilisation

  • Par exemple, ouvrez l'atelier Arch
  • Créez un objet Structure.
  • Sélectionnez l'objet Structure créé.
  • Exécutez la macro.
  • Copiez le texte de la vue du rapport et collez-le dans une page wiki et vérifiez le résultat.

Résultats de l'utilisation

Les résultats peuvent ressembler à ceci :

Properties

View

  • VueProxy (PythonObject):

Component

  • VueUseMaterialColor (Bool): Use the material color as this object's shape color, if available

Display Options

  • VueBoundingBox (Bool): Display object bounding box
  • VueDisplayMode (Enumeration): Set the display mode
  • VueShowInTree (Bool): Show the object in the tree view
  • VueVisibility (Bool): Show the object in the 3d view

Nodes

  • VueNodeColor (Color): The color of the nodes line
  • VueNodeLine (Float): The width of the nodes line
  • VueNodeSize (Float): The size of the node points
  • VueNodeType (Enumeration): The type of structural node
  • VueShowNodes (Bool): If the nodes are visible or not

Object Style

  • VueAngularDeflection (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.

  • VueDeviation (FloatConstraint): Sets the accuracy of the polygonal representation of the model

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

  • VueDiffuseColor (ColorList): Object diffuse color.
  • VueDrawStyle (Enumeration): Defines the style of the edges in the 3D view.
  • VueLighting (Enumeration): Set object lighting.
  • VueLineColor (Color): Set object line color.
  • VueLineColorArray (ColorList): Object line color array.
  • VueLineMaterial (Material): Object line material.
  • VueLineWidth (FloatConstraint): Set object line width.
  • VuePointColor (Color): Set object point color
  • VuePointColorArray (ColorList): Object point color array.
  • VuePointMaterial (Material): Object point material.
  • VuePointSize (FloatConstraint): Set object point size.
  • VueShapeColor (Color): Set shape color
  • VueShapeMaterial (Material): Shape material
  • VueTransparency (Percent): Set object transparency

Selection

  • VueOnTopWhenSelected (Enumeration): Enabled: Display the object on top of any other object when selected

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

  • VueSelectable (Bool): Set if the object is selectable in the 3d view
  • VueSelectionStyle (Enumeration): Set the object selection style

Data

  • DonnéesPlacement (Placement):
  • DonnéesProxy (PythonObject):
  • DonnéesShape (Part::PropertyPartShape):
  • DonnéesVisibility (Bool):

Base

  • Données (Hidden)ExpressionEngine (ExpressionEngine): Property expressions
  • DonnéesLabel (String): User name of the object (UTF8)
  • Données (Hidden)Label2 (String): User description of the object (UTF8)

Component

  • DonnéesAdditions (LinkList): Other shapes that are appended to this object
  • DonnéesAxis (Link): An optional axis or axis system on which this object should be duplicated
  • DonnéesBase (Link): The base object this component is built upon
  • DonnéesCloneOf (Link): The object this component is cloning
  • DonnéesHiRes (Link): An optional higher-resolution mesh or shape for this object
  • DonnéesHorizontalArea (Area): The area of the projection of this object onto the XY plane
  • DonnéesMaterial (Link): A material for this object
  • DonnéesMoveBase (Bool): Specifies if moving this object moves its base instead
  • DonnéesMoveWithHost (Bool): Specifies if this object must move together when its host is moved
  • DonnéesPerimeterLength (Length): The perimeter length of the horizontal area
  • DonnéesStandardCode (String): An optional standard (OmniClass, etc...) code for this component
  • DonnéesSubtractions (LinkList): Other shapes that are subtracted from this object
  • DonnéesVerticalArea (Area): The area of all vertical faces of this object

IFC

  • DonnéesIfcData (Map): IFC data
  • DonnéesIfcProperties (Map): IFC properties of this object
  • DonnéesIfcType (Enumeration): The type of this object

IFC Attributes

  • DonnéesDescription (String): Description of IFC attributes are not yet implemented
  • DonnéesGlobalId (String): Description of IFC attributes are not yet implemented
  • DonnéesObjectType (String): Description of IFC attributes are not yet implemented
  • DonnéesPredefinedType (Enumeration): Description of IFC attributes are not yet implemented
  • DonnéesTag (String): Description of IFC attributes are not yet implemented

Structure

  • DonnéesFaceMaker (Enumeration): The facemaker type to use to build the profile of this object
  • DonnéesHeight (Length): The height or extrusion depth of this element. Keep 0 for automatic
  • DonnéesLength (Length): The length of this element, if not based on a profile
  • DonnéesNodes (VectorList): The structural nodes of this element
  • DonnéesNodesOffset (Distance): Offset distance between the centerline and the nodes line
  • DonnéesNormal (Vector): The normal extrusion direction of this object (keep (0,0,0) for automatic normal)
  • DonnéesProfile (String): A description of the standard profile this element is based upon
  • DonnéesTool (Link): An optional extrusion path for this element
  • DonnéesWidth (Length): The width of this element, if not based on a profile

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")

Liens

La discussion sur le forum : https://forum.freecadweb.org/viewtopic.php?f=21&t=61998