Macro Wiki Object Properties List Generator Basic Version/it

Icona macro generica. Crea la tua icona personale con lo stesso nome della macro Wiki List Generator of Object Properties

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
Versione macro
0.1
Data ultima modifica
09-2021
Versioni di FreeCAD
None
Scorciatoia
Nessuna
Vedere anche
Macro Wiki Object Properties List Generator

Descrizione

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.

Utilizzo

Raccomandazioni

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.

Esempi di utilizzo

Risultati dell'utilizzo

I risultati potrebbero apparire in questo modo:

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

Link

La discussione sul forum: https://forum.freecad.org/viewtopic.php?f=21&t=61998