Part Part2DObject/pt-br: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(2 intermediate revisions by the same user not shown)
Line 12: Line 12:
[[File:FreeCAD_core_objects.svg|800px]]
[[File:FreeCAD_core_objects.svg|800px]]


{{Caption|Simplified diagram of the relationships between the core objects in the program}}
{{Caption|Simplified diagram of the relationships between the core objects in FreeCAD}}


==Usage==
==Usage==
Line 34: Line 34:
{{TitleProperty|Attachment}}
{{TitleProperty|Attachment}}


* {{PropertyData|Attacher Type|String|Hidden}}: class name of the attach engine object driving the attachment. It defaults to {{incode|Attacher::AttachEnginePlane}}.
* <div id="Property_Attacher_Type"></div>{{PropertyData|Attacher Type|String|Hidden}}: class name of the attach engine object driving the attachment. It defaults to {{incode|Attacher::AttachEnginePlane}}.
* {{PropertyData|Support|LinkSubList}}: it is the plane or face supporting the 2D geometry. It defaults to an empty list {{incode|[]}}.
* <div id="Property_Support"></div>{{PropertyData|Support|LinkSubList}}: it is the plane or face supporting the 2D geometry. It defaults to an empty list {{incode|[]}}.
* {{PropertyData|Map Mode|Enumeration}}: {{value|Deactivated}} by default. This property determines a plane which the object will use as reference for 2D geometry. Clicking on the ellipsis {{KEY|...}} (three dots), to the right of the entry field starts the [[Part_EditAttachment|Part EditAttachment]] command that allows selecting the supporting plane by picking different elements in the [[3D_view|3D view]]. The different modes are: {{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_Mode"></div>{{PropertyData|Map Mode|Enumeration}}: {{value|Deactivated}} by default. This property determines a plane which the object will use as reference for 2D geometry. Clicking on the ellipsis {{KEY|...}} (three dots), to the right of the entry field starts the [[Part_EditAttachment|Part EditAttachment]] command that allows selecting the supporting plane by picking different elements in the [[3D_view|3D view]]. The different modes are: {{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}}.
* {{PropertyData|Map Reversed|Bool}}: it defaults to {{FALSE}}; if it is {{TRUE}} the Z direction will be reversed. For example, a [[sketch|sketch]] will be flipped upside down. Hidden if {{PropertyData|Map Mode}} is {{value|Deactivated}}.
* <div id="Property_Map_Reversed"></div>{{PropertyData|Map Reversed|Bool}}: it defaults to {{FALSE}}; if it is {{TRUE}} the Z direction will be reversed. For example, a [[sketch|sketch]] will be flipped upside down. Hidden if {{PropertyData|Map Mode}} is {{value|Deactivated}}.
* {{PropertyData|Map Path Parameter|Float|Hidden}}: sets point of curve to map a [[sketch|sketch]] to. It goes from {{value|0}} to {{value|1}}, which corresponds to the {{value|start}} and {{value|end}}. It defaults to {{value|0}}.
* <div id="Property_Map_Path"></div>{{PropertyData|Map Path Parameter|Float|Hidden}}: sets point of curve to map a [[sketch|sketch]] to. It goes from {{value|0}} to {{value|1}}, which corresponds to the {{value|start}} and {{value|end}}. It defaults to {{value|0}}.
* {{PropertyData|Attachment Offset|Placement}}: the position of the object in the [[3D_view|3D view]], with respect to the attachment object's placement. The placement is defined by a {{incode|Base}} point (vector), and a {{incode|Rotation}} (axis and angle). See [[Placement|Placement]]. Hidden if {{PropertyData|Map Mode}} is {{value|Deactivated}}.
* <div id="Property_Attachment_Offset"></div>{{PropertyData|Attachment Offset|Placement}}: the position of the object in the [[3D_view|3D view]], with respect to the attachment object's placement. The placement is defined by a {{incode|Base}} point (vector), and a {{incode|Rotation}} (axis and angle). See [[Placement|Placement]]. Hidden if {{PropertyData|Map Mode}} is {{value|Deactivated}}.


== Scripting ==
== Scripting ==
Line 56: Line 56:
obj.Label = "Custom label"
obj.Label = "Custom label"
}}
}}

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


For [[Python|Python]] subclassing you should create a {{incode|Part::Part2DObjectPython}} object.
For [[Python|Python]] subclassing you should create a {{incode|Part::Part2DObjectPython}} object.

Latest revision as of 11:11, 13 July 2022

Other languages:

Introdução

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

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

Simplified diagram of the relationships between the core objects in FreeCAD

Usage

The Part Part2DObject is an internal object, so it cannot be created from the graphical interface, only from the Python console as described in the Scripting section.

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), and for most objects created with 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.

The Part Part2DObject (Part::Part2DObject class) is derived from the Part Feature (Part::Feature class) and inherits all its properties.

The Part Part2DObject also has the following additional properties in the property editor. Hidden properties can be shown by using the Show all command in the context menu of the property editor.

Data

Attachment

  • Dados (Hidden)Attacher Type (String): class name of the attach engine object driving the attachment. It defaults to Attacher::AttachEnginePlane.
  • DadosSupport (LinkSubList): it is the plane or face supporting the 2D geometry. It defaults to an empty list [].
  • DadosMap Mode (Enumeration): 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 starts the Part EditAttachment command 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.
  • DadosMap Reversed (Bool): it defaults to false; if it is true the Z direction will be reversed. For example, a sketch will be flipped upside down. Hidden if DadosMap Mode is Deactivated.
  • Dados (Hidden)Map Path Parameter (Float): sets point of curve to map a sketch to. It goes from 0 to 1, which corresponds to the start and end. It defaults to 0.
  • DadosAttachment Offset (Placement): the position of the object in the 3D view, with respect to the attachment object's placement. The placement is defined by a Base point (vector), and a Rotation (axis and angle). See Placement. Hidden if DadosMap Mode is Deactivated.

Scripting

See also: FreeCAD Scripting Basics and scripted objects.

See Part Feature for the general information on adding objects to the document.

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

import FreeCAD as App

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

For Python subclassing you should create a Part::Part2DObjectPython object.

import FreeCAD as App

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