Part Part2DObject/it: Difference between revisions

From FreeCAD Documentation
(Created page with "===Vista===")
No edit summary
 
(65 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{TOCright}}


<span id="Introduction"></span>
== Introduzione ==
== Introduzione ==


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


Un [[Part_Part2DObject/it|Part Part2DObject]], o formalmente un {{incode|Part::Part2DObject}}, è un elemento semplice con una [[Part_TopoShape/it|forma topologica]] che può essere visualizzato nella [[3D_view/it|Vista 3D]].
The {{incode|Part::Part2DObject}} is derived from a [[Part Feature|{{incode|Part::Feature}}]], but is specialized for 2D geometry, given that its shape will lie on a plane. This plane is defined by its {{PropertyData|Placement}} property (position, normal, and rotation). However, the plane can also be defined by supporting geometrical elements, such as the plane created by three arbitrary vertices, or a face of a solid body.


{{Incode|Part::Part2DObject}} è derivato dalla [[Part Feature/it|Part Feature]], ma è specializzato nella geometria 2D, dato che la sua forma è posizionata su un piano. Il piano è definito dalla sua proprietà {{PropertyData|Placement}} (posizione, normale e rotazione). Tuttavia, il piano può anche essere definito supportando elementi geometrici, come il piano creato da tre vertici arbitrari o una faccia di un corpo solido.
The {{incode|Part::Part2DObject}} 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 geometrical shapes. For example, it is the base object for sketches ({{incode|Sketcher::SketchObject}}) in the [[Sketcher Workbench|Sketcher Workbench]], and for most objects created in the [[Draft Workbench|Draft Workbench]].


[[File:FreeCAD_core_objects.svg|800px]]
Workbenches can add more properties to this basic element to produce an object with complex behavior.


{{Caption|Diagramma semplificato delle relazioni tra gli oggetti principali in FreeCAD}}
[[File:Tree_Part2D.svg|32px]]


<span id="Usage"></span>
==Utilizzo==

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

{{Incode|Part::Part2DObject}} è definito nell'ambiente [[Part_Workbench/it|Part]] ma può essere usato come classe base per gli [[Scripted_objects/it|oggetti da script]] in tutti gli [[Workbenches/it|ambienti] ] che producono forme geometriche 2D. Ad esempio, è l'oggetto base per gli ([[Sketcher_SketchObject/it|Sketcher SketchObject]]) degli schizzi e per la maggior parte degli oggetti creati con [[Draft_Workbench/it|Draft]].

I workbench possono aggiungere diverse proprietà a questo elemento di base per produrre un oggetto con comportamento complesso.

<span id="Properties"></span>
== Proprietà ==
== Proprietà ==


See [[Property|Property]] for all property types that scripted objects can have.
Vedere [[Property/it|Proprietà]] per tutti i tipi di proprietà che possono avere gli oggetti con script.


Il [[Part_Part2DObject/it|Part Part2DObject]] (classe {{incode|Part::Part2DObject}}) è derivato da [[Part_Feature/it|Part Feature]] (classe {{incode|Part::Feature}}) e ne eredita tutte le proprietà.
In addition to the properties described in [[Part Feature|Part Feature]], the Part Part2DObject has the following properties in the [[property editor|property editor]].


Il Part Part2DObject ha anche le seguenti proprietà aggiuntive nell'[[Property_editor/it|editor delle proprietà]]. Le proprietà nascoste possono essere visualizzate utilizzando il comando {{MenuCommand|Mostra tutto}} nel menu contestuale dell'[[Property_editor/it|editor delle proprietà]].

<span id="Data"></span>
=== Dati ===
=== Dati ===


{{TitleProperty|Attachment}}
{{TitleProperty|Attachment}}
* {{PropertyData|Map Mode}}: "Deactivated" by default. This property determines a plane which the object will use as reference for 2D geometry. Clicking on the ellipsis (three dots), to the right of the entry field opens the [[Part Attachment|Part Attachment]] [[task panel|task panel]] that allows selecting the supporting plane by picking different elements in the [[3D view|3D view]]. The different modes are: Deactivated, Translate origin, Object's XY, Object's XZ, Object's YZ, Plane face, Tangent to surface, Normal to edge, Frenet NB, Frenet TN, Frenet TB, Concentric, Revolution section, Plane by 3 points, Normal to 3 points, Folding, Inertia 2-3, Align O-N-X, Align O-N-Y, Align O-X-Y, Align O-X-N, Align O-Y-N, Align O-Y-X. See [[Part Attachment|Part Attachment]] for more information on all mapping modes.


* <div id="Property_Attacher_Type"></div>{{PropertyData|Attacher Type|String|Hidden}}: nome della classe dell'oggetto motore di collegamento che guida l'allegato. Il valore predefinito è {{incode|Attacher::AttachEnginePlane}}.
===Vista===
* <div id="Property_Support"></div>{{PropertyData|Support|LinkSubList}}: è il piano o la faccia che supporta la geometria 2D. Il valore predefinito è un elenco vuoto {{incode|[]}}.
* <div id="Property_Map_Mode"></div>{{PropertyData|Map Mode|Enumeration}}: {{value|Deactivated}} per impostazione predefinita. Questa proprietà determina un piano che l'oggetto utilizzerà come riferimento per la geometria 2D. Cliccando sui puntini di sospensione {{KEY|...}} (tre punti), a destra del campo di immissione si avvia il comando [[Part_EditAttachment/it|Part EditAttachment]] che consente di selezionare il piano di appoggio selezionando diversi elementi nella [[3D_view/it|Vista 3D]]. Le diverse modalità sono: {{value|Deactivated}}, {{value|Translate origin}}, {{value|Object's XY}}, {{value|Object's XZ}}, {{value|Object's YZ}}, {{value|Plane face}}, {{value|Tangent to surface}}, {{value|Normal to edge}}, {{value|Frenet NB}}, {{value|Frenet TN}}, {{value|Frenet TB}}, {{value|Concentric}}, {{value|Revolution section}}, {{value|Plane by 3 points}}, {{value|Normal to 3 points}}, {{value|Folding}}, {{value|Inertia 2-3}}, {{value|Align O-N-X}}, {{value|Align O-N-Y}}, {{value|Align O-X-Y}}, {{value|Align O-X-N}}, {{value|Align O-Y-N}}, {{value|Align O-Y-X}}.
* <div id="Property_Map_Reversed"></div>{{PropertyData|Map Reversed|Bool}}: il valore predefinito è {{FALSE}}; se è {{TRUE}} la direzione Z verrà invertita. Ad esempio, uno [[Sketch/it|schizzo]] verrà capovolto. Nascosto se {{PropertyData|Map Mode}} è {{value|Deactivated}}.
* <div id="Property_Map_Path"></div>{{PropertyData|Map Path Parameter|Float|Hidden}}: imposta il punto della curva su cui mappare uno [[Sketch/it|schizzo]]. Va da {{value|0}} a {{value|1}}, che corrisponde a {{value|start}} e {{value|end}}. Il valore predefinito è {{value|0}}.
* <div id="Property_Attachment_Offset"></div>{{PropertyData|Attachment Offset|Placement}}: la posizione dell'oggetto nella [[3D_view/it|vista 3D]], rispetto al posizionamento dell'oggetto allegato. Il posizionamento è definito da un punto {{incode|Base}} (vettore) e da una {{incode|Rotazione}} (asse e angolo). Vedi [[Placement/it|Posizionamento]]. Nascosto se {{PropertyData|Map Mode}} è {{value|Deactivated}}.


<span id="Scripting"></span>
{{TitleProperty|Grid}}
== Script ==
* {{PropertyView|Grid Size}}: a float that determines the size of the spacing of the local grid lines in the [[3D view|3D view]].
* {{PropertyView|Grid Snap}}: if {{TRUE}} the grid can be used to snap points.
* {{PropertyView|Grid Style}}: Dashed or Light; the style of the grid lines.
* {{PropertyView|Show Grid}}: if {{TRUE}} a grid local to the object will be displayed in the [[3D view|3D view]]. This grid is independent of the [[Draft_ToggleGrid|Draft grid]].
* {{PropertyView|Tight Grid}}: if {{TRUE}} the local grid will be localized around the origin of the shape, otherwise it will extend itself more.


{{Emphasis|Vedere anche:}} [[FreeCAD_Scripting_Basics/it|Script di base per FreeCAD]], e [[Scripted_objects/it|script di oggetti]].
== Scripting ==


Vedere [[Part_Feature/it|Part Feature]] per le informazioni generali sull'aggiunta di oggetti al documento..
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].


Un Part2DObject viene creato con il metodo {{incode|addObject()}} del documento.
See [[Part_Feature|Part Feature]] for the general information.


A Part Part2DObject is created with the {{incode|addObject()}} method of the document.
{{Code|code=
{{Code|code=
import FreeCAD as App

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


Per la sottoclasse [[Python/it|Python]], è necessario creare un oggetto {{incode|Part::Part2DObjectPython}}.
{{Part Tools navi}}

{{Code|code=
import FreeCAD as App

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



{{Document_objects_navi{{#translation:}}}}
{{Userdocnavi}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 23:11, 29 December 2023

Introduzione

Un Part Part2DObject, o formalmente un Part::Part2DObject, è un elemento semplice con una forma topologica che può essere visualizzato nella Vista 3D.

Part::Part2DObject è derivato dalla Part Feature, ma è specializzato nella geometria 2D, dato che la sua forma è posizionata su un piano. Il piano è definito dalla sua proprietà DatiPlacement (posizione, normale e rotazione). Tuttavia, il piano può anche essere definito supportando elementi geometrici, come il piano creato da tre vertici arbitrari o una faccia di un corpo solido.

Diagramma semplificato delle relazioni tra gli oggetti principali in FreeCAD

Utilizzo

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

Part::Part2DObject è definito nell'ambiente Part ma può essere usato come classe base per gli oggetti da script in tutti gli [[Workbenches/it|ambienti] ] che producono forme geometriche 2D. Ad esempio, è l'oggetto base per gli (Sketcher SketchObject) degli schizzi e per la maggior parte degli oggetti creati con Draft.

I workbench possono aggiungere diverse proprietà a questo elemento di base per produrre un oggetto con comportamento complesso.

Proprietà

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

Il Part Part2DObject (classe Part::Part2DObject) è derivato da Part Feature (classe Part::Feature) e ne eredita tutte le proprietà.

Il Part Part2DObject ha anche le seguenti proprietà aggiuntive nell'editor delle proprietà. Le proprietà nascoste possono essere visualizzate utilizzando il comando Mostra tutto nel menu contestuale dell'editor delle proprietà.

Dati

Attachment

  • Dati (Hidden)Attacher Type (String): nome della classe dell'oggetto motore di collegamento che guida l'allegato. Il valore predefinito è Attacher::AttachEnginePlane.
  • DatiSupport (LinkSubList): è il piano o la faccia che supporta la geometria 2D. Il valore predefinito è un elenco vuoto [].
  • DatiMap Mode (Enumeration): Deactivated per impostazione predefinita. Questa proprietà determina un piano che l'oggetto utilizzerà come riferimento per la geometria 2D. Cliccando sui puntini di sospensione ... (tre punti), a destra del campo di immissione si avvia il comando Part EditAttachment che consente di selezionare il piano di appoggio selezionando diversi elementi nella Vista 3D. Le diverse modalità sono: Deactivated, Translate origin, Object's XY, Object's XZ, Object's YZ, Plane face, Tangent to surface, Normal to edge, Frenet NB, Frenet TN, Frenet TB, Concentric, Revolution section, Plane by 3 points, Normal to 3 points, Folding, Inertia 2-3, Align O-N-X, Align O-N-Y, Align O-X-Y, Align O-X-N, Align O-Y-N, Align O-Y-X.
  • DatiMap Reversed (Bool): il valore predefinito è false; se è true la direzione Z verrà invertita. Ad esempio, uno schizzo verrà capovolto. Nascosto se DatiMap Mode è Deactivated.
  • Dati (Hidden)Map Path Parameter (Float): imposta il punto della curva su cui mappare uno schizzo. Va da 0 a 1, che corrisponde a start e end. Il valore predefinito è 0.
  • DatiAttachment Offset (Placement): la posizione dell'oggetto nella vista 3D, rispetto al posizionamento dell'oggetto allegato. Il posizionamento è definito da un punto Base (vettore) e da una Rotazione (asse e angolo). Vedi Posizionamento. Nascosto se DatiMap Mode è Deactivated.

Script

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

Vedere Part Feature per le informazioni generali sull'aggiunta di oggetti al documento..

Un Part2DObject viene creato con il metodo addObject() del documento.

import FreeCAD as App

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

Per la sottoclasse Python, è necessario creare un oggetto Part::Part2DObjectPython.

import FreeCAD as App

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