Part Feature/it: Difference between revisions

From FreeCAD Documentation
(Created page with "Part Feature")
 
(Updating to match new version of source page)
 
(76 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{TOCright}}


== Introduction ==
== Introduzione ==


[[File:Part_3D_object.svg|32px]]
A [[Part Feature|Part Feature]] object, or formally a {{incode|Part::Feature}}, is a simple element with a topological {{incode|Shape}} associated that can be displayed in the [[3D view|3D view]].


<div class="mw-translate-fuzzy">
The {{incode|Part::Feature}} is defined in the [[Part Workbench|Part Workbench]] but can be used as the base class for [[scripted objects|scripted objects]] in all [[Workbenches|workbenches]] that produce 2D and 3D geometrical shapes.
Un oggetto [[Part Feature/it|Part Feature]], (Funzione Part) o formalmente un {{incode|Part::Feature}}, è un elemento semplice a cui è associato una [[Part_TopoShape/it|forma topologica]] che può essere visualizzato nella [[3D view/it|Vista 3D]].
</div>


<div class="mw-translate-fuzzy">
A {{incode|Part::Feature}} has simple properties like a placement, and colors to define the appearance of its vertices, edges, and faces. Workbenches can add more properties to this basic element to produce an object with complex behavior.
Una Part Feauture è la classe genitore della maggior parte degli oggetti 2D (Draft, Sketcher) e 3D (Part, PartDesign), ad eccezione delle mesh, che normalmente si basano su [[Mesh_Feature/it|Mesh Feature]], o [[FEM_Mesh/it|Fem FemMeshObject]] per gli oggetti FEM.
</div>


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


<div class="mw-translate-fuzzy">
== Properties ==
{{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) per avere una [[Part_TopoShape/it|Part TopoShape]].}}
</div>


==Utilizzo==
See [[Property|Property]] for all property types that scripted objects can have.


<div class="mw-translate-fuzzy">
These are the properties available in the [[property editor|property editor]].
[[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>


<div class="mw-translate-fuzzy">
=== Data ===
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. Sostanzialmente tutti gli oggetti prodotti in [[Part Workbench/it|Part]] sono istanze di una {{incode|Part::Feature}}. Gli oggetti solidi importati da file STEP o BREP sono importati utilizzando [[Part Workbench/it|Part]], quindi sono anche importati come elementi {{incode|Part::Feature}} sebbene senza cronologia parametrica.
</div>


<div class="mw-translate-fuzzy">
* {{PropertyData|Placement}}: the position of the object in the [[3D view|3D view]]. The placement is defined by a {{incode|Base}} point (vector), and a {{incode|Rotation}} (axis and angle).
{{incode|Part::Feature}} è anche la classe genitrice dei [[PartDesign Body/it|Corpi di PartDesign]], delle [[PartDesign_Feature/it|PartDesign Features]], e dei [[Part_Part2DObject/it|Part Part2DObject]], che è specializzato per le forme 2D (planari).
** {{PropertyData|Angle}}: the angle of rotation around the {{PropertyData|Axis}}.
</div>
** {{PropertyData|Axis}}: the unit vector that defines the axis of rotation for the placement. Each value is between 0 and 1. If any value is above 1, the vector is normalized so that the magnitude of the vector is 1.
** {{PropertyData|Position}}: the 3D coordinates of the base point of the placement.
* {{PropertyData|Label}}: the user editable description of this object.


<div class="mw-translate-fuzzy">
=== View ===
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.
</div>


== Proprietà ==
* {{PropertyView|Angular Deflection}}: it is a companion to {{PropertyView|Deviation}}. It is another way to 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 will be in the [[3D view|3D view]], and the finer the mesh that will be exported.

* {{PropertyView|Bounding Box}}: if it is {{TRUE}}, the object will show the bounding box in the [[3D view|3D view]].
Vedere [[Property/it|Proprietà]] per tutti i tipi di proprietà che possono avere oggetti con script.
* {{PropertyView|Deviation}}: it is a companion to {{PropertyView|Angular Deflection}}. It is another way to specify how finely to generate the mesh for rendering on screen or when exporting. The default value is 0.5. The smaller the value the smoother the appearance will be in the [[3D view|3D view]], and the finer the mesh that will be exported.

* {{PropertyView|Display Mode}}: Flat Lines (regular visualization), Shaded (soft edges), Wireframe (no faces), Points (only vertices).
<div class="mw-translate-fuzzy">
* {{PropertyView|Draw Style}}: Solid, Dashed, Dotted, Dashdot; defines the style of the edges in the [[3D view|3D view]].
Una [[Part_Feature/it|Part Feature]] (classe {{incode|Part::Feature}}) è derivata dalla base [[App_GeoFeature/it|App GeoFeature]] (classe{{incode|App::GeoFeature}}), pertanto condivide la maggior parte delle proprietà di quest'ultima.
* {{PropertyView|Lighting}}: Two side, One side; the illumination comes from two sides or one side in the [[3D view|3D view]].
</div>
* {{PropertyView|Line Color}}: a tuple of three values {{incode|(r,g,b)}} to define the color of the edges in the [[3D view|3D view]].

* {{PropertyView|Line Width}}: a float that determines the width in pixels of the edges in the [[3D view|3D view]].
<div class="mw-translate-fuzzy">
Queste sono le proprietà disponibili nell'[[property editor/it|editor delle proprietà]]. Le proprietà nascoste possono essere mostrate usando il comando {{MenuCommand|Mostra tutto}} nel menu contestuale dell '[[property editor/it|editor delle proprietà]].
</div>

=== Dati ===

{{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). Vedere [[Placement/it|Posizionamento]].
** {{PropertyData|Angle}}: l'angolo di rotazione attorno al {{PropertyData|Axis}}. Di default, è {{value|0°}} (zero gradi).
** {{PropertyData|Axis}}: il vettore unitario che definisce l'asse di rotazione per il posizionamento. Ogni componente ha un valore in virgola mobile compreso tra {{value|0}} e {{value|1}}. Se un valore è superiore a {{value|1}}, il vettore viene normalizzato in modo che l'entità del vettore sia {{value|1}}. Di default, è l'asse Z positivo, {{value|(0, 0, 1)}}
** {{PropertyData|Position}}: un vettore con le coordinate 3D del punto base. Di default, è l'origine {{value|(0, 0, 0)}}
* {{PropertyData|Label|String}}: il nome modificabile dall'utente di questo oggetto, è una stringa UTF8 arbitraria.
</div>

===Vista===

<div class="mw-translate-fuzzy">
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à.
</div>

{{TitleProperty|Base}}
* {{PropertyView|Proxy|PythonObject|hidden}}: a custom [[Viewprovider|viewprovider]] class associated with this object. This only exists for the [[Python|Python]] version. See [[#Scripting|Scripting]].

<div class="mw-translate-fuzzy">
{{TitleProperty|Base}}
</div>

* {{PropertyView|Bounding Box|Bool}}: if it is {{TRUE}}, the object will show the bounding box in the [[3D_view|3D view]].
* {{PropertyView|Display Mode|Enumeration}}: {{value|Flat Lines}} (regular visualization), {{value|Shaded}} (no edges), {{value|Wireframe}} (no faces), {{value|Points}} (only vertices).
* {{PropertyView|Show In Tree|Bool}}: it defaults to {{TRUE}}, in which case the object will appear in the [[Tree_view|Tree view]]; otherwise, the object will be hidden in the tree view. Once an object in the tree is invisible, you can see it again by opening the context menu over the name of the document (right-click), and selecting {{CheckBox|TRUE|Show hidden items}}. Then the hidden item can be chosen and {{PropertyView|Show In Tree}} can be switched back to {{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.

{{TitleProperty|Object style}}

<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|Bounding Box}}: se è {{TRUE}}, l'oggetto mostra il parallelepipedo che lo contiene nella [[3D view/it|vista 3D]].
* {{PropertyView|Deviation}}: accompagna {{PropertyView|Angular 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 [[3D view/it|vista 3D]] e più fine sarà la mesh che verrà esportata.
* {{PropertyView|Display Mode}}: Flat lines (visualizzazione normale con facce piene), Ombreggiato (bordi leggeri), Wireframe (solo reticolo e facce vuote), Punti (solo vertici).
* {{PropertyView|Draw Style}}: Solid, Dashed, Dotted, Dashdot; definisce lo stile dei bordi nella [[3D view/it|vista 3D]].
* {{PropertyView|Lighting}}: Two side, One side; l'illuminazione proviene da due lati o un lato nella [[3D view/it|vista 3D]].
* {{PropertyView|Line Color}}: una tupla di tre valori {{incode|(r,g,b)}} per definire il colore dei bordi nella [[3D view/it|vista 3D]].
* {{PropertyView|Line Width}}: un flottante che determina la larghezza in pixel dei bordi nella [[3D view/it|vista 3D]].
* {{PropertyView|On Top When Selected}}: Disabled, Enabled, Object, Element.
* {{PropertyView|On Top When Selected}}: Disabled, Enabled, Object, Element.
* {{PropertyView|Point Color}}: a tuple of three values {{incode|(r,g,b)}} to define the color of the vertices in the [[3D view|3D view]].
* {{PropertyView|Point Color}}: una tupla di tre valori {{incode|(r,g,b)}} per definire il colore dei vertici nella [[3D view/it|vista 3D]].
* {{PropertyView|Point Size}}: a float that determines the size in pixels of the vertices in the [[3D view|3D view]].
* {{PropertyView|Point Size}}: un flottante che determina la dimensione in pixel dei vertici nella [[3D view/it|vista 3D]].
* {{PropertyView|Selectable}}: 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|Selectable}}: se è {{TRUE}}, l'oggetto può essere selezionato con il puntatore nella [[3D view/it|vista 3D]]. Altrimenti, l'oggetto non può essere selezionato fino a quando questa opzione non è impostata su {{TRUE}}.
* {{PropertyView|Selection Style}}: Shape, BoundBox.
* {{PropertyView|Selection Style}}: Shape, BoundBox.
* {{PropertyView|Shape Color}}: a tuple of three values {{incode|(r,g,b)}} to define the color of the faces in the [[3D view|3D view]].
* {{PropertyView|Shape Color}}: una tupla di tre valori {{incode|(r,g,b)}} per definire il colore delle facce nella [[3D view/it|vista 3D]].
* {{PropertyView|Show In Tree}}: if it is {{TRUE}}, the object appears in the [[tree view|tree view]]. Otherwise, it is set as invisible.
* {{PropertyView|Show In Tree}}: se è {{TRUE}}, l'oggetto appare nella [[tree view/it|vista ad albero]]. Altrimenti, è impostato come invisibile.
* {{PropertyView|Transparency}}: a float from 0 to 100 that determines the level of transparency of the faces in the [[3D view|3D view]]. A value of 100 indicates completely invisible faces; the faces are invisible but they can still be picked as long as {{PropertyView|Selectable}} is {{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}}: if it is {{TRUE}}, the object appears in the [[3D view|3D view]]; otherwise it is not present.
* {{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>

* {{PropertyView|Point Color|Color}}: similar to {{PropertyView|Line Color}}, defines the color of the vertices.
* {{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|Point Size|FloatConstraint}}: similar to {{PropertyView|Line Width}}, defines the size of the vertices.

* {{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|Shape Material|Material|hidden}}: an [[App_Material|App Material]] associated with this object. By default it is empty.
* {{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}}.

{{TitleProperty|Selection}}

* {{PropertyView|On Top When Selected|Enumeration}}: it controls the way in which the selection occurs in the [[3D_view|3D view]] if the object has a [[Part_TopoShape|Shape]], and there are many objects partially covered by others. It defaults to {{value|Disabled}}, meaning that no special highlighting will occur; {{value|Enabled}} means that the object will appear on top of any other object when selected; {{value|Object}} means that the object will appear on top only if the entire object is selected in the [[Tree_view|Tree view]]; {{value|Element}} means that the object will appear on top only if a subelement (vertex, edge, face) is selected in the [[3D_view|3D view]].
* {{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}}: it controls the way the object is highlighted. If it is {{value|Shape}}, the entire shape (vertices, edges, and faces) will be highlighted in the [[3D_view|3D view]]; if it is {{value|BoundBox}} a bounding box will appear surrounding the object and will be highlighted.

=== Angular deflection and deviation ===

[[File:View_property_Deviation.svg|500px]]
{{Caption|Angular Deflection and deviation parameters; d < linear deflection, α < angular deflection.}}

La deviazione è un valore in percentuale correlato alle dimensioni in millimetri del parallelepipedo contenitore dell'oggetto. La deviazione in millimetri può essere calcolata come segue:

{{Code|code=
deviation_in_mm = (w + h + d)/3 * deviation/100
}}

dove {{value|w}}, {{value|h}}, {{value|d}} sono le dimensioni del contenitore.

== Script ==

<div class="mw-translate-fuzzy">
{{Emphasis|Vedere anche:}} [[FreeCAD Scripting Basics/it|Script di base per FreeCAD]], e [[scripted objects/it|script di oggetti]].
</div>

Un oggetto Part Feature viene creato con il metodo {{incode|addObject()}} del documento.

{{Code|code=
import FreeCAD as App

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

For [[Python|Python]] subclassing, you should create a {{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 ===

See also: [[Object_name|Object name]] for more information on the properties of the {{incode|Name}}.

The {{incode|addObject}} method 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 secondo argomento è una stringa che definisce l'attributo {{incode|Name}}. Se non viene fornito, per impostazione predefinita è {{incode|"Part__Feature"}}.
** Il {{Incode|Name}} viene stabilito al momento della creazione; non può essere modificato in seguito.
** Il {{incode|Name}} può includere solo caratteri alfanumerici semplici e il trattino basso, {{incode|[_0-9a-zA-Z]}}. Se vengono forniti altri simboli, questi verranno convertiti in caratteri di sottolineatura; per esempio, {{incode|"A+B:C*"}} viene convertito in {{incode|"A_B_C_"}}.
** Il {{incode|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, {{incode|"Name001"}}, {{incode|"Name002"}}, etc.
* Se lo si desidera, l'attributo {{incode|Label}} può essere modificato in un testo più significativo.
** Di default, {{incode|Label}} è uguale a {{incode|Name}}.
** 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}}.
</div>

=== Label ===

If desired, the {{incode|Label}} attribute can be changed to a more meaningful text.
* 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}}.



{{Document_objects_navi{{#translation:}}}}
{{Part Tools navi}}
{{Userdocnavi}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 07:35, 22 February 2022

Introduzione

Un oggetto Part Feature, (Funzione Part) o formalmente un Part::Feature, è un elemento semplice a cui è associato una forma topologica che può essere visualizzato nella Vista 3D.

Una Part Feauture è la classe genitore della maggior parte degli oggetti 2D (Draft, Sketcher) e 3D (Part, PartDesign), ad eccezione delle mesh, che normalmente si basano su Mesh Feature, o Fem FemMeshObject per gli oggetti FEM.

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) per avere una Part TopoShape.

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. Sostanzialmente tutti gli oggetti prodotti in Part sono istanze di una Part::Feature. Gli oggetti solidi importati da file STEP o BREP sono importati utilizzando Part, quindi sono anche importati come elementi Part::Feature sebbene senza cronologia parametrica.

Part::Feature è anche la classe genitrice dei Corpi di PartDesign, delle PartDesign Features, e dei Part Part2DObject, che è specializzato per le forme 2D (planari).

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à

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

Una Part Feature (classe Part::Feature) è derivata dalla base App GeoFeature (classeApp::GeoFeature), pertanto condivide la maggior parte delle proprietà di quest'ultima.

Queste sono le proprietà disponibili nell'editor delle proprietà. Le proprietà nascoste possono essere mostrate usando il comando Mostra tutto nel menu contestuale dell '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. Di default, è (zero gradi).
    • DatiAxis: il vettore unitario che definisce l'asse di rotazione per il posizionamento. Ogni componente ha un valore in virgola mobile compreso tra 0 e 1. Se un valore è superiore a 1, il vettore viene normalizzato in modo che l'entità del vettore sia 1. Di default, è l'asse Z positivo, (0, 0, 1)
    • DatiPosition: un vettore con le coordinate 3D del punto base. Di default, è l'origine (0, 0, 0)
  • DatiLabel (String): il nome modificabile dall'utente di questo oggetto, è una stringa UTF8 arbitraria.

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

  • Vista (hidden)Proxy (PythonObject): a custom viewprovider class associated with this object. This only exists for the Python version. See Scripting.

Base

  • VistaBounding Box (Bool): if it is true, the object will show the bounding box in the 3D view.
  • VistaDisplay Mode (Enumeration): Flat Lines (regular visualization), Shaded (no edges), Wireframe (no faces), Points (only vertices).
  • VistaShow In Tree (Bool): it defaults to true, in which case the object will appear in the Tree view; otherwise, the object will be hidden in the tree view. Once an object in the tree is invisible, you can see it again by opening the context menu over the name of the document (right-click), and selecting Show hidden items. Then the hidden item can be chosen and VistaShow In Tree can be switched back to 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.

Object style

  • 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.
  • VistaPoint Color (Color): similar to VistaLine Color, defines the color of the vertices.
  • 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.
  • VistaPoint Size (FloatConstraint): similar to VistaLine Width, defines the size of the vertices.
  • 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.
  • Vista (hidden)Shape Material (Material): an App Material associated with this object. By default it is empty.
  • 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.

Selection

  • VistaOn Top When Selected (Enumeration): it controls the way in which the selection occurs in the 3D view if the object has a Shape, and there are many objects partially covered by others. It defaults to Disabled, meaning that no special highlighting will occur; Enabled means that the object will appear on top of any other object when selected; Object means that the object will appear on top only if the entire object is selected in the Tree view; Element means that the object will appear on top only if a subelement (vertex, edge, face) is selected in the 3D view.
  • 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): it controls the way the object is highlighted. If it is Shape, the entire shape (vertices, edges, and faces) will be highlighted in the 3D view; if it is BoundBox a bounding box will appear surrounding the object and will be highlighted.

Angular deflection and deviation

Angular Deflection and deviation parameters; d < linear deflection, α < angular deflection.

La deviazione è un valore in percentuale correlato alle dimensioni in millimetri del parallelepipedo contenitore dell'oggetto. La deviazione in millimetri può essere calcolata come segue:

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

dove w, h, d sono le dimensioni del contenitore.

Script

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"

For Python subclassing, you should create a Part::FeaturePython object.

import FreeCAD as App

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

Name

See also: Object name for more information on the properties of the Name.

The addObject method 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.

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