Part Part2DObject: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Marked this version for translation)
Line 2: Line 2:
<translate>
<translate>


== Introduction ==
== Introduction == <!--T:1-->


<!--T:2-->
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]].
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]].


<!--T:3-->
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.
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.


<!--T:4-->
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]].
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]].


<!--T:5-->
Workbenches can add more properties to this basic element to produce an object with complex behavior.
Workbenches can add more properties to this basic element to produce an object with complex behavior.


<!--T:6-->
[[File:Tree_Part2D.svg|32px]]
[[File:Tree_Part2D.svg|32px]]


== Properties ==
== Properties == <!--T:7-->


<!--T:8-->
See [[Property|Property]] for all property types that scripted objects can have.
See [[Property|Property]] for all property types that scripted objects can have.


<!--T:9-->
In addition to the properties described in [[Part Feature|Part Feature]], the Part Part2DObject has the following properties in the [[property editor|property editor]].
In addition to the properties described in [[Part Feature|Part Feature]], the Part Part2DObject has the following properties in the [[property editor|property editor]].


=== Data ===
=== Data === <!--T:10-->


<!--T:11-->
{{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.
* {{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.


=== View ===
=== View === <!--T:12-->


<!--T:13-->
{{TitleProperty|Grid}}
{{TitleProperty|Grid}}
* {{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 Size}}: a float that determines the size of the spacing of the local grid lines in the [[3D view|3D view]].
Line 34: Line 43:
* {{PropertyView|Tight Grid}}: if {{TRUE}} the local grid will be localized around the origin of the shape, otherwise it will extend itself more.
* {{PropertyView|Tight Grid}}: if {{TRUE}} the local grid will be localized around the origin of the shape, otherwise it will extend itself more.


== Scripting ==
== Scripting == <!--T:14-->


<!--T:15-->
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].


<!--T:16-->
See [[Part_Feature|Part Feature]] for the general information.
See [[Part_Feature|Part Feature]] for the general information.


<!--T:17-->
A Part Part2DObject is created with the {{incode|addObject()}} method of the document.
A Part Part2DObject is created with the {{incode|addObject()}} method of the document.
{{Code|code=
{{Code|code=
Line 46: Line 58:
}}
}}


<!--T:18-->
{{Part Tools navi}}
{{Part Tools navi}}


<!--T:19-->
{{Userdocnavi}}
{{Userdocnavi}}
</translate>
</translate>

Revision as of 19:11, 6 October 2019

Introduction

A Part Part2DObject, or formally a Part::Part2DObject, is a simple element with a topological Shape associated that can be displayed in the 3D view.

The Part::Part2DObject is derived from a Part::Feature, but is specialized for 2D geometry, given that its shape will lie on a plane. This plane is defined by its DataPlacement 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.

The Part::Part2DObject is defined in the Part Workbench but can be used as the base class for scripted objects in all workbenches that produce 2D geometrical shapes. For example, it is the base object for sketches (Sketcher::SketchObject) in the Sketcher Workbench, and for most objects created in the Draft Workbench.

Workbenches can add more properties to this basic element to produce an object with complex behavior.

Properties

See Property for all property types that scripted objects can have.

In addition to the properties described in Part Feature, the Part Part2DObject has the following properties in the property editor.

Data

Attachment

  • DataMap 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 task panel that allows selecting the supporting plane by picking different elements in the 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 for more information on all mapping modes.

View

Grid

  • ViewGrid Size: a float that determines the size of the spacing of the local grid lines in the 3D view.
  • ViewGrid Snap: if true the grid can be used to snap points.
  • ViewGrid Style: Dashed or Light; the style of the grid lines.
  • ViewShow Grid: if true a grid local to the object will be displayed in the 3D view. This grid is independent of the Draft grid.
  • ViewTight Grid: if true the local grid will be localized around the origin of the shape, otherwise it will extend itself more.

Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

See Part Feature for the general information.

A Part Part2DObject is created with the addObject() method of the document.

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