Part Feature/it: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
(21 intermediate revisions by 2 users not shown)
Line 3: Line 3:
== Introduzione ==
== Introduzione ==


[[File:Tree_Part.svg|32px]]

<div class="mw-translate-fuzzy">
Un oggetto [[Part Feature/it|Part Feature]], o formalmente un {{incode|Part::Feature}}, è un elemento semplice a cui è associato un {{incode|Shape}} topologico che può essere visualizzato nella [[3D view/it|Vista 3D]].
Un oggetto [[Part Feature/it|Part Feature]], o formalmente un {{incode|Part::Feature}}, è un elemento semplice a cui è associato un {{incode|Shape}} topologico che può essere visualizzato nella [[3D view/it|Vista 3D]].
</div>


A Part Feauture is the parent class of most 2D (Draft, Sketcher) and 3D (Part, PartDesign) objects, with the exception of meshes, which are normally based on [[Mesh_Feature|Mesh Feature]], or [[Fem_FemMeshObject|Fem FemMeshObject]] for FEM objects.
L'oggetto {{Incode|Part::Feature}} è definito in [[Part Workbench/it|Part]] ma può essere usato come classe base per [[scripted objects/it|script di oggetti]] in tutti gli [[Workbenches/it|ambienti]] che producono forme geometriche 2D e 3D.


[[File:FreeCAD_core_objects.svg|800px]]
Un oggetto {{incode|Part::Feature}} ha proprietà semplici come il posizionamento e i colori per definire l'aspetto dei suoi vertici, bordi e facce. Gli ambienti possono aggiungere altre proprietà a questo elemento di base per produrre un oggetto con un comportamento complesso.


<div class="mw-translate-fuzzy">
[[File:Tree_Part.svg|32px]]
{{Caption|Diagramma semplificato delle relazioni tra gli oggetti principali in FreeCAD. La classe {{incode|Part::Feature}} è l'origine della maggior parte degli oggetti 2D (Draft, Sketcher) e 3D (Part, PartDesign).}}
</div>

== Utilizzo ==

[[Part Feature/it|Part Feature]] è un oggetto interno, quindi non può essere creato dall'interfaccia grafica, ma solo dalla [[Python console/it|console Python]] come descritto nel paragrafo [[Part_Feature/it#Script|Script]].

<div class="mw-translate-fuzzy">
L'oggetto {{Incode|Part::Feature}} è definito in [[Part Workbench/it|Part]] ma può essere usato come classe base per [[scripted objects/it|script di oggetti]] in tutti gli [[Workbenches/it|ambienti]] che producono forme geometriche 2D e 3D. Ad esempio, è la classe genitrice del [[PartDesign Body/it|Corpo PartDesign]] e di [[Part_Part2DObject/it|Part Part2DObject]], che à specializzata in forme 2D (planari).
</div>

{{incode|Part::Feature}} is also the parent class of the [[PartDesign Body|PartDesign Body]], of the [[PartDesign_Feature|PartDesign Features]], and of the [[Part_Part2DObject|Part Part2DObject]], which is specialized for 2D (planar) shapes.

Un oggetto {{incode|Part::Feature}} ha proprietà semplici come il [[Placement/it|posizionamento]] e le proprietà vista per definire l'aspetto dei suoi vertici, bordi e facce. Gli ambienti possono aggiungere altre proprietà a questo elemento di base per produrre un oggetto con un comportamento complesso.


== Proprietà ==
== Proprietà ==

A [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class) is derived from the basic [[App_GeoFeature|App GeoFeature]] ({{incode|App::GeoFeature}} class), therefore it shares all the latter's properties.

In addition to the properties described in [[App_GeoFeature|App GeoFeature]], the Part Feature has the {{PropertyData|Shape}} property, which stores the [[Part_TopoShape|Part TopoShape]] of this object; this is the geometry that is shown in the [[3D view|3D view]].

Other properties that this object has are those related to the appearance of its [[Part_TopoShape|TopoShape]], including {{PropertyView|Angular Deflection}}, {{PropertyView|Deviation}}, {{PropertyView|Draw Style}}, {{PropertyView|Lighting}}, {{PropertyView|Line Color}}, {{PropertyView|Line Width}}, {{PropertyView|Point Color}}, {{PropertyView|Point Size}}, and also the hidden properties {{PropertyView|Diffuse Color}}, {{PropertyView|Line Color Array}}, {{PropertyView|Line Material}}, {{PropertyView|Point Color Array}}, and {{PropertyView|Point Material}}.


Vedere [[Property/it|Proprietà]] per tutti i tipi di proprietà che possono avere oggetti con script.
Vedere [[Property/it|Proprietà]] per tutti i tipi di proprietà che possono avere oggetti con script.


<div class="mw-translate-fuzzy">
Queste sono le proprietà disponibili nell'[[property editor/it|editor delle proprietà]].
Queste sono le proprietà disponibili nell'[[property editor/it|editor delle proprietà]].
</div>


=== Dati ===
=== Dati ===
Line 21: Line 47:
{{TitleProperty|Base}}
{{TitleProperty|Base}}


<div class="mw-translate-fuzzy">
* {{PropertyData|Placement}}: la posizione dell'oggetto nella [[3D view/it|Vista 3D]]. Il posizionamento è definito da un punto {{incode|Base}} (vettore) e una {{incode| Rotation}} (asse e angolo).
* {{PropertyData|Placement}}: la posizione dell'oggetto nella [[3D view/it|Vista 3D]]. Il posizionamento è definito da un punto {{incode|Base}} (vettore) e una {{incode| Rotation}} (asse e angolo). Vedere [[Placement/it|Posizionamento]].
** {{PropertyData|Angle}}: l'angolo di rotazione attorno al {{PropertyData|Axis}}.
** {{PropertyData|Angle}}: l'angolo di rotazione attorno al {{PropertyData|Axis}}.
** {{PropertyData|Axis}}: il vettore unitario che definisce l'asse di rotazione per il posizionamento. Ogni valore è compreso tra 0 e 1. Se un valore è superiore a 1, il vettore viene normalizzato in modo che l'entità del vettore sia 1.
** {{PropertyData|Axis}}: il vettore unitario che definisce l'asse di rotazione per il posizionamento. Ogni valore è compreso tra 0 e 1. Se un valore è superiore a 1, il vettore viene normalizzato in modo che l'entità del vettore sia 1.
** {{PropertyData|Position}}: le coordinate 3D del punto base del posizionamento.
** {{PropertyData|Position}}: le coordinate 3D del punto base del posizionamento.
* {{PropertyData|Label}}: la descrizione modificabile dall'utente di questo oggetto.
* {{PropertyData|Label}}: la descrizione modificabile dall'utente di questo oggetto.
</div>

==== Hidden properties Data ====

* {{PropertyData|Expression Engine|ExpressionEngine|hidden}}: a list of expressions. By default, it is empty {{value|[]}}.
* {{PropertyData|Label2|String|hidden}}: a longer, user editable description of this object, it is an arbitrary UTF8 string that may include newlines. By default, it is an empty string {{value|""}}.
* {{PropertyData|Proxy|PythonObject|hidden}}: a custom class associated with this object. This only exists for the [[Python|Python]] version. See [[Part_Feature#Scripting|Scripting]].
* {{PropertyData|Shape|PartShape|hidden}}: a [[Part_TopoShape|Part TopoShape]] class associated with this object.
* {{PropertyData|Visibility|Bool|hidden}}: whether to display the object or not.


===Vista===
===Vista===

La maggior parte degli oggetti in FreeCAD ha quello che viene chiamato un "fornitore di viste", che è una classe che definisce l'aspetto visivo dell'oggetto nella [[3D view/it|vista 3D]] e nella [[tree view/it|vista ad albero]]. Il fornitore di viste predefinito degli oggetti Part Feature definisce le seguenti proprietà. Anche gli oggetti con script derivati da Part Feature hanno accesso a queste proprietà.


{{TitleProperty|Base}}
{{TitleProperty|Base}}


<div class="mw-translate-fuzzy">
* {{PropertyView|Angular Deflection}}: accompagna {{PropertyView|Deviation}}. È un altro modo per specificare la precisione con cui generare la mesh per il rendering sullo schermo o durante l'esportazione. Il valore predefinito è 28,5 gradi o 0,5 radianti. Minore è il valore, più uniforme sarà l'aspetto nella [[3D view/it|vista 3D]] e più fine sarà la mesh che verrà esportata.
* {{PropertyView|Angular Deflection}}: accompagna {{PropertyView|Deviation}}. È un altro modo per specificare la precisione con cui generare la mesh per il rendering sullo schermo o durante l'esportazione. Il valore predefinito è 28,5 gradi o 0,5 radianti. Minore è il valore, più uniforme sarà l'aspetto nella [[3D view/it|vista 3D]] e più fine sarà la mesh che verrà esportata.
* {{PropertyView|Bounding Box}}: se è {{TRUE}}, l'oggetto mostra il parallelepipedo che lo contiene nella [[3D view/it|vista 3D]].
* {{PropertyView|Bounding Box}}: se è {{TRUE}}, l'oggetto mostra il parallelepipedo che lo contiene nella [[3D view/it|vista 3D]].
Line 47: Line 86:
* {{PropertyView|Show In Tree}}: se è {{TRUE}}, l'oggetto appare nella [[tree view/it|vista ad albero]]. Altrimenti, è impostato come invisibile.
* {{PropertyView|Show In Tree}}: se è {{TRUE}}, l'oggetto appare nella [[tree view/it|vista ad albero]]. Altrimenti, è impostato come invisibile.
* {{PropertyView|Transparency}}: un valore da 0 a 100 che determina il livello di trasparenza delle facce nella [[3D view/it|vista 3D]]. Un valore di 100 indica facce completamente invisibili; le facce che sono invisibili possono comunque essere selezionate se {{PropertyView|Selectable}} è {{TRUE}}.
* {{PropertyView|Transparency}}: un valore da 0 a 100 che determina il livello di trasparenza delle facce nella [[3D view/it|vista 3D]]. Un valore di 100 indica facce completamente invisibili; le facce che sono invisibili possono comunque essere selezionate se {{PropertyView|Selectable}} è {{TRUE}}.
* {{PropertyView|Visibility}}: se è {{TRUE}}, l'oggetto appare nella [[3D view/it|vista 3D]]; altrimenti non è visibile.
* {{PropertyView|Visibility}}: se è {{TRUE}}, l'oggetto appare nella [[3D view/it|vista 3D]]; altrimenti non è visibile. Per impostazione predefinita, questa proprietà può essere attivata e disattivata premendo la barra {{KEY|Spazio}} sulla tastiera.
</div>

The deviation is a value in percentage that is related to the dimensions in millimeters of the bounding box of the object. The deviation in millimeters can be calculated as follows:
{{Code|code=
deviation_in_mm = (w + h + d)/3 * deviation/100
}}
where {{value|w}}, {{value|h}}, {{value|d}} are the bounding box dimensions.

* {{PropertyView|Display Mode|Enumeration}}: {{value|Flat Lines}} (regular visualization), {{value|Shaded}} (no edges), {{value|Wireframe}} (no faces), {{value|Points}} (only vertices).
* {{PropertyView|Draw Style|Enumeration}}: {{value|Solid}} (default), {{value|Dashed}}, {{value|Dotted}}, {{value|Dashdot}}; defines the style of the edges in the [[3D view|3D view]].
* {{PropertyView|Lighting|Enumeration}}: {{value|Two side}} (default), {{value|One side}}; the illumination comes from two sides or one side in the [[3D view|3D view]].
* {{PropertyView|Line Color|Color}}: a tuple of three floating point RGB values {{value|(r,g,b)}} to define the color of the edges in the [[3D view|3D view]]; by default it is {{value|(0.09, 0.09, 0.09)}}, which is displayed as {{value|[25,25,25]}} on base 255, <span style="background-color:#222; color:#eee; width:3em; height:12pt; padding: 2px 1em 2px;"> almost black </span>.
* {{PropertyView|Line Width|FloatConstraint}}: a float that determines the width in pixels of the edges in the [[3D view|3D view]]. It defaults to {{value|2.0}}.
* {{PropertyView|On Top When Selected|Enumeration}}: {{value|Disabled}} (default), {{value|Enabled}}, {{value|Object}}, {{value|Element}}.
* {{PropertyView|Point Color|Color}}: similar to {{PropertyView|Line Color}}, defines the color of the vertices.
* {{PropertyView|Point Size|FloatConstraint}}: similar to {{PropertyView|Line Width}}, defines the size of the vertices.
* {{PropertyView|Selectable|Bool}}: if it is {{TRUE}}, the object can be picked with the pointer in the [[3D view|3D view]]. Otherwise, the object cannot be selected until this option is set to {{TRUE}}.
* {{PropertyView|Selection Style|Enumeration}}: {{value|Shape}} (default), {{value|BoundBox}}. If the option is {{value|Shape}}, the entire shape (vertices, edges, and faces) will be highlighted in the [[3D view|3D view]]; if it is {{value|BoundBox}} only the bounding box will be highlighted.
* {{PropertyView|Shape Color|Color}}: similar to {{PropertyView|Line Color}}, defines the color of the faces. It defaults to {{value|(0.8, 0.8, 0.8)}}, which is displayed as {{value|[204,204,204]}} on base 255, a <span style="background-color:#ccc; width:3em; height:12pt; padding: 2px 1em 2px;">light gray</span>.
* {{PropertyView|Show In Tree|Bool}}: if it is {{TRUE}}, the object appears in the [[tree view|tree view]]. Otherwise, it is set as invisible.
* {{PropertyView|Transparency|Percent}}: an integer from {{value|0}} to {{value|100}} (a percentage) that determines the level of transparency of the faces in the [[3D view|3D view]]. A value of {{value|100}} indicates completely invisible faces; the faces are invisible but they can still be picked as long as {{PropertyView|Selectable}} is {{TRUE}}.
* {{PropertyView|Visibility|Bool}}: if it is {{TRUE}}, the object appears in the [[3D view|3D view]]; otherwise it is invisible. By default this property can be toggled on and off by pressing the {{KEY|Space}} bar in the keyboard.

==== Hidden properties View ====

* {{PropertyView|Diffuse Color|ColorList|hidden}}: it is a list of RGB tuples defining colors, similar to {{PropertyView|Shape Color}}. It defaults to a list of one {{value|[(0.8, 0.8, 0.8)]}}.
* {{PropertyView|Line Color Array|ColorList|hidden}}: it is a list of RGB tuples defining colors, similar to {{PropertyView|Line Color}}. It defaults to a list of one {{value|[(0.09, 0.09, 0.09)]}}.
* {{PropertyView|Line Material|Material|hidden}}: an [[App_Material|App Material]] associated with the edges in this object. By default it is empty.
* {{PropertyView|Point Color Array|ColorList|hidden}}: it is a list of RGB tuples defining colors, similar to {{PropertyView|Point Color}}. It defaults to a list of one {{value|[(0.09, 0.09, 0.09)]}}.
* {{PropertyView|Point Material|Material|hidden}}: an [[App_Material|App Material]] associated with the vertices in this object. By default it is empty.
* {{PropertyView|Proxy|PythonObject|hidden}}: a custom view provider class associated with this object. This only exists for the [[Python|Python]] version. See [[Part_Feature#Scripting|Scripting]].
* {{PropertyView|Shape Material|Material|hidden}}: an [[App_Material|App Material]] associated with this object. By default it is empty.


== Script ==
== Script ==
Line 55: Line 126:
Un oggetto Part Feature viene creato con il metodo {{incode|addObject()}} del documento.
Un oggetto Part Feature viene creato con il metodo {{incode|addObject()}} del documento.
{{Code|code=
{{Code|code=
import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Feature", "Name")
obj = App.ActiveDocument.addObject("Part::Feature", "Name")
obj.Label = "Custom label"
obj.Label = "Custom label"
}}
}}


This basic {{incode|Part::Feature}} doesn't have a Proxy object so it can't be fully used for sub-classing.

Therefore, for [[Python|Python]] subclassing, you should create the {{incode|Part::FeaturePython}} object.
{{Code|code=
import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::FeaturePython", "Name")
obj.Label = "Custom label"
}}

=== Name ===

The {{incode|addObject}} function has two basic string arguments.

<div class="mw-translate-fuzzy">
* Il primo argomento indica il tipo di oggetto, in questo caso, {{incode|"Part::Feature"}}.
* Il primo argomento indica il tipo di oggetto, in questo caso, {{incode|"Part::Feature"}}.
* Il secondo argomento è una stringa che definisce l'attributo {{incode|Name}}. Se non viene fornito, per impostazione predefinita è {{incode|"Part__Feature"}}.
* Il secondo argomento è una stringa che definisce l'attributo {{incode|Name}}. Se non viene fornito, per impostazione predefinita è {{incode|"Part__Feature"}}.
Line 68: Line 158:
** A differenza di {{incode|Name}}, {{incode|Label}} può accettare qualsiasi stringa UTF8, inclusi accenti e spazi. Poiché la [[tree view/it|vista ad albero]] visualizza {{incode|Label}}, è buona norma cambiare {{incode|Label}} in una stringa più descrittiva.
** A differenza di {{incode|Name}}, {{incode|Label}} può accettare qualsiasi stringa UTF8, inclusi accenti e spazi. Poiché la [[tree view/it|vista ad albero]] visualizza {{incode|Label}}, è buona norma cambiare {{incode|Label}} in una stringa più descrittiva.
** Di default, {{incode|Label}} deve essere univoco. Questo comportamento può essere modificato nell'[[Preferences Editor/it|editor delle preferenze]], {{MenuCommand | Modifica → Preferenze → Generale → Documento → Consenti la duplicazione delle etichette nel documento}}.
** Di default, {{incode|Label}} deve essere univoco. Questo comportamento può essere modificato nell'[[Preferences Editor/it|editor delle preferenze]], {{MenuCommand | Modifica → Preferenze → Generale → Documento → Consenti la duplicazione delle etichette nel documento}}.
</div>

=== Label ===

If desired, the {{incode|Label}} attribute can be changed to a more meaningful text.
* Upon creating the object, the {{incode|Label}} is the same as the {{incode|Name}}.
* However, unlike the {{incode|Name}}, the {{incode|Label}} can accept any UTF8 string, including accents and spaces. Since the [[tree view|tree view]] displays the {{incode|Label}}, it is a good practice to change the {{incode|Label}} to a more descriptive string.
* By default the {{incode|Label}} is unique, just like the {{incode|Name}}. However, this behavior can be changed in the [[Preferences Editor|preferences editor]], {{MenuCommand|Edit → Preferences → General → Document → Allow duplicate object labels in one document}}. This means that in general the {{incode|Label}} may be repeated in the same document; when testing for a specific element the user should rely on the {{incode|Name}} rather than on the {{incode|Label}}.


<div class="mw-translate-fuzzy">
{{Part Tools navi/it}}
{{Part Tools navi/it}}
{{Userdocnavi/it}}
{{Userdocnavi/it}}
</div>

Revision as of 15:54, 18 January 2020

Introduzione

Un oggetto Part Feature, o formalmente un Part::Feature, è un elemento semplice a cui è associato un Shape topologico che può essere visualizzato nella Vista 3D.

A Part Feauture is the parent class of most 2D (Draft, Sketcher) and 3D (Part, PartDesign) objects, with the exception of meshes, which are normally based on Mesh Feature, or Fem FemMeshObject for FEM objects.

Diagramma semplificato delle relazioni tra gli oggetti principali in FreeCAD. La classe Part::Feature è l'origine della maggior parte degli oggetti 2D (Draft, Sketcher) e 3D (Part, PartDesign).

Utilizzo

Part Feature è un oggetto interno, quindi non può essere creato dall'interfaccia grafica, ma solo dalla console Python come descritto nel paragrafo Script.

L'oggetto Part::Feature è definito in Part ma può essere usato come classe base per script di oggetti in tutti gli ambienti che producono forme geometriche 2D e 3D. Ad esempio, è la classe genitrice del Corpo PartDesign e di Part Part2DObject, che à specializzata in forme 2D (planari).

Part::Feature is also the parent class of the PartDesign Body, of the PartDesign Features, and of the Part Part2DObject, which is specialized for 2D (planar) shapes.

Un oggetto Part::Feature ha proprietà semplici come il posizionamento e le proprietà vista per definire l'aspetto dei suoi vertici, bordi e facce. Gli ambienti possono aggiungere altre proprietà a questo elemento di base per produrre un oggetto con un comportamento complesso.

Proprietà

A Part Feature (Part::Feature class) is derived from the basic App GeoFeature (App::GeoFeature class), therefore it shares all the latter's properties.

In addition to the properties described in App GeoFeature, the Part Feature has the DatiShape property, which stores the Part TopoShape of this object; this is the geometry that is shown in the 3D view.

Other properties that this object has are those related to the appearance of its TopoShape, including VistaAngular Deflection, VistaDeviation, VistaDraw Style, VistaLighting, VistaLine Color, VistaLine Width, VistaPoint Color, VistaPoint Size, and also the hidden properties VistaDiffuse Color, VistaLine Color Array, VistaLine Material, VistaPoint Color Array, and VistaPoint Material.

Vedere Proprietà per tutti i tipi di proprietà che possono avere oggetti con script.

Queste sono le proprietà disponibili nell'editor delle proprietà.

Dati

Base

  • DatiPlacement: la posizione dell'oggetto nella Vista 3D. Il posizionamento è definito da un punto Base (vettore) e una Rotation (asse e angolo). Vedere Posizionamento.
    • DatiAngle: l'angolo di rotazione attorno al DatiAxis.
    • DatiAxis: il vettore unitario che definisce l'asse di rotazione per il posizionamento. Ogni valore è compreso tra 0 e 1. Se un valore è superiore a 1, il vettore viene normalizzato in modo che l'entità del vettore sia 1.
    • DatiPosition: le coordinate 3D del punto base del posizionamento.
  • DatiLabel: la descrizione modificabile dall'utente di questo oggetto.

Hidden properties Data

  • Dati (hidden)Expression Engine (ExpressionEngine): a list of expressions. By default, it is empty [].
  • Dati (hidden)Label2 (String): a longer, user editable description of this object, it is an arbitrary UTF8 string that may include newlines. By default, it is an empty string "".
  • Dati (hidden)Proxy (PythonObject): a custom class associated with this object. This only exists for the Python version. See Scripting.
  • Dati (hidden)Shape (PartShape): a Part TopoShape class associated with this object.
  • Dati (hidden)Visibility (Bool): whether to display the object or not.

Vista

La maggior parte degli oggetti in FreeCAD ha quello che viene chiamato un "fornitore di viste", che è una classe che definisce l'aspetto visivo dell'oggetto nella vista 3D e nella vista ad albero. Il fornitore di viste predefinito degli oggetti Part Feature definisce le seguenti proprietà. Anche gli oggetti con script derivati da Part Feature hanno accesso a queste proprietà.

Base

  • VistaAngular Deflection: accompagna VistaDeviation. È un altro modo per specificare la precisione con cui generare la mesh per il rendering sullo schermo o durante l'esportazione. Il valore predefinito è 28,5 gradi o 0,5 radianti. Minore è il valore, più uniforme sarà l'aspetto nella vista 3D e più fine sarà la mesh che verrà esportata.
  • VistaBounding Box: se è true, l'oggetto mostra il parallelepipedo che lo contiene nella vista 3D.
  • VistaDeviation: accompagna VistaAngular Deflection. È un altro modo per specificare la precisione con cui generare la mesh per il rendering sullo schermo o durante l'esportazione. Il valore predefinito è 28,5 gradi o 0,5 radianti. Minore è il valore, più uniforme sarà l'aspetto nella vista 3D e più fine sarà la mesh che verrà esportata.
  • VistaDisplay Mode: Flat lines (visualizzazione normale con facce piene), Ombreggiato (bordi leggeri), Wireframe (solo reticolo e facce vuote), Punti (solo vertici).
  • VistaDraw Style: Solid, Dashed, Dotted, Dashdot; definisce lo stile dei bordi nella vista 3D.
  • VistaLighting: Two side, One side; l'illuminazione proviene da due lati o un lato nella vista 3D.
  • VistaLine Color: una tupla di tre valori (r,g,b) per definire il colore dei bordi nella vista 3D.
  • VistaLine Width: un flottante che determina la larghezza in pixel dei bordi nella vista 3D.
  • VistaOn Top When Selected: Disabled, Enabled, Object, Element.
  • VistaPoint Color: una tupla di tre valori (r,g,b) per definire il colore dei vertici nella vista 3D.
  • VistaPoint Size: un flottante che determina la dimensione in pixel dei vertici nella vista 3D.
  • VistaSelectable: se è true, l'oggetto può essere selezionato con il puntatore nella vista 3D. Altrimenti, l'oggetto non può essere selezionato fino a quando questa opzione non è impostata su true.
  • VistaSelection Style: Shape, BoundBox.
  • VistaShape Color: una tupla di tre valori (r,g,b) per definire il colore delle facce nella vista 3D.
  • VistaShow In Tree: se è true, l'oggetto appare nella vista ad albero. Altrimenti, è impostato come invisibile.
  • VistaTransparency: un valore da 0 a 100 che determina il livello di trasparenza delle facce nella vista 3D. Un valore di 100 indica facce completamente invisibili; le facce che sono invisibili possono comunque essere selezionate se VistaSelectable è true.
  • VistaVisibility: se è true, l'oggetto appare nella vista 3D; altrimenti non è visibile. Per impostazione predefinita, questa proprietà può essere attivata e disattivata premendo la barra Spazio sulla tastiera.

The deviation is a value in percentage that is related to the dimensions in millimeters of the bounding box of the object. The deviation in millimeters can be calculated as follows:

deviation_in_mm = (w + h + d)/3 * deviation/100

where w, h, d are the bounding box dimensions.

  • VistaDisplay Mode (Enumeration): Flat Lines (regular visualization), Shaded (no edges), Wireframe (no faces), Points (only vertices).
  • VistaDraw Style (Enumeration): Solid (default), Dashed, Dotted, Dashdot; defines the style of the edges in the 3D view.
  • VistaLighting (Enumeration): Two side (default), One side; the illumination comes from two sides or one side in the 3D view.
  • VistaLine Color (Color): a tuple of three floating point RGB values (r,g,b) to define the color of the edges in the 3D view; by default it is (0.09, 0.09, 0.09), which is displayed as [25,25,25] on base 255, almost black .
  • VistaLine Width (FloatConstraint): a float that determines the width in pixels of the edges in the 3D view. It defaults to 2.0.
  • VistaOn Top When Selected (Enumeration): Disabled (default), Enabled, Object, Element.
  • VistaPoint Color (Color): similar to VistaLine Color, defines the color of the vertices.
  • VistaPoint Size (FloatConstraint): similar to VistaLine Width, defines the size of the vertices.
  • VistaSelectable (Bool): if it is true, the object can be picked with the pointer in the 3D view. Otherwise, the object cannot be selected until this option is set to true.
  • VistaSelection Style (Enumeration): Shape (default), BoundBox. If the option is Shape, the entire shape (vertices, edges, and faces) will be highlighted in the 3D view; if it is BoundBox only the bounding box will be highlighted.
  • VistaShape Color (Color): similar to VistaLine Color, defines the color of the faces. It defaults to (0.8, 0.8, 0.8), which is displayed as [204,204,204] on base 255, a light gray.
  • VistaShow In Tree (Bool): if it is true, the object appears in the tree view. Otherwise, it is set as invisible.
  • VistaTransparency (Percent): an integer from 0 to 100 (a percentage) that determines the level of transparency of the faces in the 3D view. A value of 100 indicates completely invisible faces; the faces are invisible but they can still be picked as long as VistaSelectable is true.
  • VistaVisibility (Bool): if it is true, the object appears in the 3D view; otherwise it is invisible. By default this property can be toggled on and off by pressing the Space bar in the keyboard.

Hidden properties View

  • Vista (hidden)Diffuse Color (ColorList): it is a list of RGB tuples defining colors, similar to VistaShape Color. It defaults to a list of one [(0.8, 0.8, 0.8)].
  • Vista (hidden)Line Color Array (ColorList): it is a list of RGB tuples defining colors, similar to VistaLine Color. It defaults to a list of one [(0.09, 0.09, 0.09)].
  • Vista (hidden)Line Material (Material): an App Material associated with the edges in this object. By default it is empty.
  • Vista (hidden)Point Color Array (ColorList): it is a list of RGB tuples defining colors, similar to VistaPoint Color. It defaults to a list of one [(0.09, 0.09, 0.09)].
  • Vista (hidden)Point Material (Material): an App Material associated with the vertices in this object. By default it is empty.
  • Vista (hidden)Proxy (PythonObject): a custom view provider class associated with this object. This only exists for the Python version. See Scripting.
  • Vista (hidden)Shape Material (Material): an App Material associated with this object. By default it is empty.

Script

Vedere anche: Script di base per FreeCAD, e script di oggetti.

Un oggetto Part Feature viene creato con il metodo addObject() del documento.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Feature", "Name")
obj.Label = "Custom label"

This basic Part::Feature doesn't have a Proxy object so it can't be fully used for sub-classing.

Therefore, for Python subclassing, you should create the Part::FeaturePython object.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::FeaturePython", "Name")
obj.Label = "Custom label"

Name

The addObject function has two basic string arguments.

  • Il primo argomento indica il tipo di oggetto, in questo caso, "Part::Feature".
  • Il secondo argomento è una stringa che definisce l'attributo Name. Se non viene fornito, per impostazione predefinita è "Part__Feature".
    • Il Name viene stabilito al momento della creazione; non può essere modificato in seguito.
    • Il Name può includere solo caratteri alfanumerici semplici e il trattino basso, [_0-9a-zA-Z]. Se vengono forniti altri simboli, questi verranno convertiti in caratteri di sottolineatura; per esempio, "A+B:C*" viene convertito in "A_B_C_".
    • Il Name deve essere unico in tutto il documento. Se vengono creati più oggetti con lo stesso nome, viene aggiunto un numero sequenziale per distinguerli, ad esempio, "Name001", "Name002", etc.
  • Se lo si desidera, l'attributo Label può essere modificato in un testo più significativo.
    • Di default, Label è uguale a Name.
    • A differenza di Name, Label può accettare qualsiasi stringa UTF8, inclusi accenti e spazi. Poiché la vista ad albero visualizza Label, è buona norma cambiare Label in una stringa più descrittiva.
    • Di default, Label deve essere univoco. Questo comportamento può essere modificato nell'editor delle preferenze, Modifica → Preferenze → Generale → Documento → Consenti la duplicazione delle etichette nel documento.

Label

If desired, the Label attribute can be changed to a more meaningful text.

  • Upon creating the object, the Label is the same as the Name.
  • However, unlike the Name, the Label can accept any UTF8 string, including accents and spaces. Since the tree view displays the Label, it is a good practice to change the Label to a more descriptive string.
  • By default the Label is unique, just like the Name. However, this behavior can be changed in the preferences editor, Edit → Preferences → General → Document → Allow duplicate object labels in one document. This means that in general the Label may be repeated in the same document; when testing for a specific element the user should rely on the Name rather than on the Label.