Draft Label/pl: Difference between revisions

From FreeCAD Documentation
(Created page with "Rysunek roboczy: Etykieta")
 
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav
{{Docnav
|[[Draft_Dimension|Dimension]]
|[[Draft_CubicBezCurve|CubicBezCurve]]
|[[Draft_AnnotationStyleEditor|AnnotationStyleEditor]]
|[[Draft_AnnotationStyleEditor|AnnotationStyleEditor]]
|[[Draft_Module|Draft]]
|[[Draft_Module|Draft]]
|IconL=Draft CubicBezCurve.svg
|IconL=Draft_Dimension.svg
|IconR=Draft_AnnotationStyleEditor.svg
|IconR=Draft_AnnotationStyleEditor.svg
|IconC=Workbench_Draft.svg
|IconC=Workbench_Draft.svg
Line 11: Line 12:
{{GuiCommand
{{GuiCommand
|Name=Draft Label
|Name=Draft Label
|MenuLocation=Draft → Label
|MenuLocation=Annotation → Label
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Shortcut={{KEY|D}} {{KEY|L}}
|Shortcut={{KEY|D}} {{KEY|L}}
Line 20: Line 21:
==Description==
==Description==


The [[Image:Draft_Label.svg|24px]] [[Draft Label]] command creates a multi-line text with a 2-segment leader line and an arrow.
The Label tool inserts a multi-line textbox with a 2-segment leader line and an arrow. If an object or a sub-element (face, edge or vertex) is selected when starting the command, the Label can be made to display a certain attribute of the selected element, including position, length, area, volume, or material.


If an object or a sub-element (face, edge or vertex) is selected when starting the command, the text can be made to display one or two attributes of the selected element, including position, length, area, volume and material. The text will then be linked to the attributes and will update if their values change.
To insert a simpler text element without an arrow use [[Draft Text]]. To create solid text shapes use [[Draft ShapeString]] with [[Part Extrude]].

To insert a text element without an arrow use the [[Draft_Text|Draft Text]] command instead.


[[Image:Draft_Label_example.jpg|400px]]
[[Image:Draft_Label_example.jpg|400px]]
{{Caption|Various labels with different orientations, tip symbols, and information}}
{{Caption|Various labels with different orientations, arrows and information}}


==Usage==
==Usage==


See also: [[Draft_Tray|Draft Tray]], [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].
# Press the {{Button|[[Image:Draft_Label.svg|16px]] [[Draft Label]]}} button, or press {{KEY|D}} then {{KEY|L}} keys.
# Click a first point on the 3D view, or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button. This point indicates the target (arrow head). This can be anywhere, it doesn't need to be an element.
# Click a second point on the 3D view, or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button. This point indicates the start of a horizontal or vertical leader.
# Click a third point on the 3D view, or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button. This point indicates the base point of the text.


# Optionally select an object or a sub-element (vertex, edge or face) that you want to display attributes of.
{{emphasis|Note:}} the direction of the horizontal straight segment, to the right or to the left, will automatically align the text to the opposite direction. If the leader goes vertically up, the text is aligned to the left; if it goes vertically down, it is aligned to the right.
# There are several ways to invoke the command:

#* Press the {{Button|[[Image:Draft_Label.svg|16px]] [[Draft_Label|Draft Label]]}} button.
{{emphasis|Note 2:}} by pre-selecting an object, or a sub-element (vertex, edge or face), before pressing the tool button, the label will become parametric, that is, it will remember which object it is bound to, and it will be able to display a particular attribute of that object. If the attributes of the object change later on, the label will adjust the displayed information.
#* Select the {{MenuCommand|Annotation → [[Image:Draft_Label.svg|16px]] Label}} option from the menu.
#* Use the keyboard shortcut: {{KEY|D}} then {{KEY|L}}.
# The {{MenuCommand|Label}} task panel opens. See [[#Options|Options]] for more information.
# If you have selected an element: select an option from the {{MenuCommand|Label type}} dropdown list. Additional label types can be set by changing the {{PropertyData|Label Type}} later. See [[#Label_types|Label types]] below.
# Pick the first point in the [[3D_view|3D view]], or type [[Draft_Coordinates|coordinates]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button. This point indicates the target (arrow head). This can be anywhere, it does not have to be on an element.
# Pick the second point in the [[3D_view|3D view]], or type [[Draft_Coordinates|coordinates]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button. This point indicates the start of the horizontal or vertical segment of the leader.
# Pick the third point in the [[3D_view|3D view]], or type [[Draft_Coordinates|coordinates]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button. This point indicates the base point of the text.


==Options==
==Options==


The single character keyboard shortcuts available in the task panel can be changed. See [[Draft_Preferences|Draft Preferences]]. The shortcuts mentioned here are the default shortcuts.
* Click on {{Button|Label type}} to select the type of information to display, including "Custom", "Name", "Label", "Position", "Length", "Area", "Volume", "Tag", and "Material". (See explanation of [[#Label_types|Label types]] below)

* To enter coordinates manually, simply enter the numbers, then press {{KEY|Enter}} between each X, Y and Z component. You can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button when you have the desired values to insert the point.
* To manually enter coordinates enter the X, Y and Z component, and press {{KEY|Enter}} after each. Or you can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values. It is advisable to move the pointer out of the [[3D_view|3D view]] before entering coordinates.
* Hold {{KEY|Ctrl}} while placing the label to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Press {{KEY|R}} or click the {{MenuCommand|Relative}} checkbox to toggle relative mode. If relative mode is on, coordinates are relative to the last point, if available, else they are relative to the coordinate system origin.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command.
* Press {{KEY|G}} or click the {{MenuCommand|Global}} checkbox to toggle global mode. If global mode is on, coordinates are relative to the global coordinate system, else they are relative to the [[Draft_SelectPlane|working plane]] coordinate system. {{Version|0.20}}
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.

==Notes==

* The direction of the second segment of the leader determines the alignment of the text. If the segment is horizontal and pointing to the right the text is aligned to the left and vice versa. If the second segment goes vertically up, the text is aligned to the left. If it goes vertically down, the text is aligned to the right.


==Properties==
==Properties==

See also: [[property_editor|Property editor]].

A Draft Label object is derived from an [[App_FeaturePython|App FeaturePython]] object and inherits all its properties. The following properties are additional unless otherwise stated:


=== Data ===
=== Data ===

* {{PropertyData|Label Type}}: specifies the type of information shown by this label (see [[#Label_types|Label types]] below).
{{TitleProperty|Label}}
* {{PropertyData|Custom Text}}: specifies the text block to display when {{PropertyData|Label Type}} is set to "Custom", or the label is not parametric. The text is given as a list of strings; each element on the list, separated by a comma, indicates a new line of text.

* {{PropertyData|Text}}: (read-only) indicates the actual text displayed by the label, depending on the {{PropertyData|Label Type}}.
* {{PropertyData|Target Point}}: specifies the position of the tip of the leader.
* {{PropertyData|Custom Text|StringList}}: specifies the contents of the text if {{PropertyData|Label Type}} is {{Value|Custom}}. Each item in the list represents a new text line.
* {{PropertyData|Straight Direction}}: specifies the direction of the straight segment of the leader, either horizontal or vertical.
* {{PropertyData|Label Type|Enumeration}}: specifies the type of information displayed by the label. See [[#Label_types|Label types]].
* {{PropertyData|Straight Distance}}: specifies the length of the straight segment of the leader, starting from the base point of the text. If the distance is positive, the leader starts from the right side of the text, and the text aligns to the right; otherwise, the leader starts from the left side of the text, and the text aligns to the left.
* {{PropertyData|Placement|Placement}}: specifies the position of the text in the [[3D view|3D view]] and, unless {{PropertyData|Straight Direction}} is {{Value|Custom}}, also of the first leader segment, which is the segment where the text is attached. See [[Placement|Placement]].
* {{PropertyData|Position}}: specifies the base point of the first line of the text block; it also influences how the leader is drawn.
* {{PropertyData|Text|StringList}}: (read-only) specifies the contents of the text that is actually displayed. Each item in the list represents a new text line.

* {{PropertyData|Angle}}: specifies the rotation of the baseline of the first line of the text block; it also influences how the leader is drawn, as it will no longer be horizontal or vertical.
{{TitleProperty|Leader}}
* {{PropertyData|Axis}}: specifies the axis to use for the rotation.

* {{PropertyData|Points|VectorList}}: specifies the points of the leader.
* {{PropertyData|Straight Direction|Enumeration}}: specifies the direction of the first leader segment: {{Value|Custom}}, {{Value|Horizontal}} or {{Value|Vertical}}.
* {{PropertyData|Straight Distance|Distance}}: specifies the length of the first leader segment. Only used if {{PropertyData|Straight Direction}} is {{Value|Horizontal}} or {{Value|Vertical}}. If the distance is positive, the leader starts from the right side of the text and the text aligns to the right. Otherwise the leader starts from the left side of the text and the text aligns to the left.

{{TitleProperty|Target}}

* {{PropertyData|Target|LinkSub}}: specifies the object and optional subelement the label is linked to.
* {{PropertyData|Target Point|Vector}}: specifies the position of the tip of the leader, which is where the arrow is attached.


==== Label types ====
==== Label types ====


* {{Emphasis|Custom:}} displays the contents of {{PropertyData|Custom Text}}.
* {{Value|Custom}}: displays the contents of {{PropertyData|Custom Text}}.
* {{Emphasis|Name:}} displays the internal name of the target object; the internal name is assigned to the object at its creation time, and remains fixed throughout the existence of the object.
* {{Value|Name}}: displays the internal name of the target object. The internal name is assigned when an object is created and remains fixed throughout the existence of the object.
* {{Emphasis|Label:}} displays the label of the target object; the label of the object can be changed by the user at any time.
* {{Value|Label}}: displays the label of the target object. The label of an object can be changed by the user.
* {{Emphasis|Position:}} displays the coordinates of the base point of the target object, of the target vertex, or of the center of mass of the target sub-element, if applicable.
* {{Value|Position}}: displays the coordinates of the base point of the target object, of the target vertex, or of the center of mass of the target subelement, if applicable.
* {{Emphasis|Length:}} displays the length of the target sub-element, if applicable.
* {{Value|Length}}: displays the length of the target object or subelement, if applicable.
* {{Emphasis|Area:}} displays the area of the target sub-element, if applicable.
* {{Value|Area}}: displays the area of the target object or subelement, if applicable.
* {{Emphasis|Volume:}} displays the volume of the target object, if applicable.
* {{Value|Volume}}: displays the volume of the target object, if applicable.
* {{Emphasis|Tag:}} displays the {{incode|Tag}} attribute of the target object, if the object has such property, for example, objects created with the [[Arch Workbench]].
* {{Value|Tag}}: displays the {{incode|Tag}} attribute of the target object, if applicable. Objects created with the [[Arch_Workbench|Arch Workbench]] can have this attribute.
* {{Emphasis|Material:}} displays the label of the material of the target object, if the target object has such property.
* {{Value|Material}}: displays the label of the material of the target object, if applicable.
* {{Value|Label + Position}}
* {{Value|Label + Length}}
* {{Value|Label + Area}}
* {{Value|Label + Volume}}
* {{Value|Label + Material}}


=== View ===
=== View ===
* {{PropertyView|Text Font}}: specifies the font to use to draw the text. It can be a font name, such as "Arial", a default style such as "sans", "serif" or "mono", a family such as "Arial,Helvetica,sans" or a name with a style such as "Arial:Bold". If the given font is not found on the system, a generic one is used instead.
* {{PropertyView|Text Size}}: specifies the size of the text. If the label object is created in the tree view but no text is visible in the 3D view, increase the size of the text until it is visible.
* {{PropertyView|Text Alignment}}: specifies the vertical alignment of the baseline of the text with respect to the leader. It can be top, middle or bottom.
* {{PropertyView|Text Color}}: specifies the color of the text in an RGB tuple (R, G, B).
* {{PropertyView|Line Width}}: specifies the width of the leader.
* {{PropertyView|Line Color}}: specifies the color of the leader.
* {{PropertyView|Arrow Size}}: specifies the size of the symbol displayed at the tip of the leader.
* {{PropertyView|Arrow Type}}: specifies the type of symbol displayed at the tip of the leader, which can be dot, circle, arrow, or tick.
* {{PropertyView|Frame}}: if it is "Rectangle" it will draw a frame around the text.
* {{PropertyView|Line}}: if it is {{TRUE}} the leader line will be displayed; otherwise only the text and the symbol at the tip will be displayed.
* {{PropertyView|Display Mode}}: if it is "3D text" the text will be aligned to the scene axes, initially lying on the XY plane; if it is "2D text" the text will always face the camera.


{{TitleProperty|Annotation}}
==Scripting==
{{Emphasis|See also:}} [[Draft API]] and [[FreeCAD Scripting Basics]].


* {{PropertyView|Annotation Style|Enumeration}}: specifies the annotation style applied to the label. See [[Draft_AnnotationStyleEditor|Draft AnnotationStyleEditor]].
The Label tool can be used in [[macros]] and from the [[Python]] console by using the following function:
* {{PropertyView|Scale Multiplier|Float}}: specifies the general scaling factor applied to the label.
{{Code|code=
Label = makeLabel(targetpoint=None, target=None, direction=None, distance=None, labeltype=None, placement=None)
}}


{{TitleProperty|Display Options}}
* Creates a {{incode|Label}} object, with the leader pointing to {{incode|targetpoint}}, and linking to the {{incode|target}} object which must be a {{incode|DocumentObject}} ({{emphasis|Editor:}} or a SelectionObject? This is unclear).
* {{incode|direction}} is either "Horizontal", "Vertical", or "Custom".
* {{incode|distance}} is the distance from the base point of the text to the leader.
* {{incode|labeltype}} is one of "Custom", "Name", "Label", "Position", "Length", "Area", "Volume", "Tag", or "Material".
* If a {{incode|placement}} is given, it is used for the base point of the text; otherwise the text is created at the origin.


* {{PropertyView|Display Mode|Enumeration}}: specifies how the text is displayed. If it is {{value|3D text}} the text will be displayed in a plane defined by the {{PropertyData|Placement}} of the label. If it is {{value|2D text}} the text will always face the camera. This is an inherited property.
Change the custom text by overwriting the {{incode|CustomText}} attribute. A list of strings can be used; each element will be displayed in its own line.


{{TitleProperty|Graphics}}
The view properties of {{incode|Label}} can be changed by overwriting its attributes; for example, overwrite {{incode|ViewObject.TextSize}} with the new size in millimeters.

* {{PropertyView|Arrow Size|Length}}: specifies the size of the symbol displayed at the tip of the leader.
* {{PropertyView|Arrow Type|Enumeration}}: specifies the type of symbol displayed at the tip of the leader, which can be {{value|Dot}}, {{value|Circle}}, {{value|Arrow}}, {{value|Tick}} or {{value|Tick-2}}.
* {{PropertyView|Frame|Enumeration}}: specifies what type of frame is drawn around the text. The current options are {{Value|None}} or {{Value|Rectangle}}.
* {{PropertyView|Line|Bool}}: specifies whether to display the leader line. If it is {{FALSE}} only the arrow and the text are displayed.
* {{PropertyView|Line Color|Color}}: specifies the color of the leader and the arrow.
* {{PropertyView|Line Width|Float}}: specifies the width of the leader.

{{TitleProperty|Text}}

* {{PropertyView|Justification|Enumeration}}: specifies the horizontal alignment of the text: {{value|Left}}, {{value|Center}} or {{value|Right}}. Only used if {{PropertyData|Straight Direction}} is {{Value|Custom}}. Otherwise the horizontal alignment is based on the sign (positive or negative) of {{PropertyData|Straight Distance}}.
* {{PropertyView|Line Spacing|Float}}: specifies the factor applied to the default line height of the text.
* {{PropertyView|Max Chars|Integer}}: specifies the maximum number of characters on each line of the text.
* {{PropertyView|Text Alignment|Enumeration}}: specifies the vertical alignment of the text: {{value|Top}}, {{value|Middle}} or {{value|Bottom}}.
* {{PropertyView|Text Color|Color}}: specifies the color of the text.
* {{PropertyView|Text Font|Font}}: specifies the font used to draw the text. It can be a font name, such as {{value|Arial}}, a default style such as {{value|sans}}, {{value|serif}} or {{value|mono}}, a family such as {{value|Arial,Helvetica,sans}}, or a name with a style such as {{value|Arial:Bold}}. If the given font is not found on the system, a default font is used instead.
* {{PropertyView|Font Size|Length}}: specifies the size of the letters. The text can be invisible in the [[3D_view|3D view]] if this value is very small.

==Scripting==

See also: [https://www.freecadweb.org/api Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].

To create a Draft Label use the {{incode|make_label}} method ({{Version|0.19}}) of the Draft module. This method replaces the deprecated {{incode|makeLabel}} method.

{{Code|code=
label = make_label(target_point=App.Vector(0, 0, 0),
placement=App.Vector(30, 30, 0),
target_object=None, subelements=None,
label_type="Custom", custom_text="Label",
direction="Horizontal", distance=-10,
points=None)
}}


Example:
Example:

{{Code|code=
{{Code|code=
import FreeCAD, Draft
import FreeCAD as App
import Draft


Rectangle = Draft.makeRectangle(4000, 1000)
rectangle = Draft.make_rectangle(4000, 1000)
App.ActiveDocument.recompute()


p1 = FreeCAD.Vector(-200, 1000, 0)
p1 = App.Vector(-200, 1000, 0)
place1 = FreeCAD.Placement(FreeCAD.Vector(-1000, 1300, 0), FreeCAD.Rotation())
place1 = App.Placement(App.Vector(-1000, 1300, 0), App.Rotation())


Label1 = Draft.makeLabel(p1, Rectangle, "Horizontal", 500, "Label", place1)
label1 = Draft.make_label(p1, place1, target_object=rectangle, distance=500, label_type="Label")
Label1.ViewObject.TextSize = 200
label1.ViewObject.TextSize = 200


p2 = FreeCAD.Vector(-200, 0, 0)
p2 = App.Vector(-200, 0, 0)
place2 = FreeCAD.Placement(FreeCAD.Vector(-1000, -300, 0), FreeCAD.Rotation())
place2 = App.Placement(App.Vector(-1000, -300, 0), App.Rotation())


Label2 = Draft.makeLabel(p2, Rectangle, "Horizontal", 500, "Custom", place2)
label2 = Draft.make_label(p2, place2, target_object=rectangle, distance=500, label_type="Custom",
Label2.CustomText = ["Beware of the", "sharp edges"]
custom_text="Beware of the sharp edges")
Label2.ViewObject.TextSize = 200
label2.ViewObject.TextSize = 200
FreeCAD.ActiveDocument.recompute()


p3 = FreeCAD.Vector(1000, 1200, 0)
p3 = App.Vector(1000, 1200, 0)
place3 = FreeCAD.Placement(FreeCAD.Vector(2000, 1800, 0), FreeCAD.Rotation())
place3 = App.Placement(App.Vector(2000, 1800, 0), App.Rotation())


Label3 = Draft.makeLabel(p3, Rectangle, "Horizontal", -500, "Area", place3)
label3 = Draft.make_label(p3, place3, target_object=rectangle, distance=-500, label_type="Area")
Label3.ViewObject.TextSize = 200
label3.ViewObject.TextSize = 200

FreeCAD.ActiveDocument.recompute()
App.ActiveDocument.recompute()
}}
}}



{{Docnav
{{Docnav
|[[Draft_Dimension|Dimension]]
|[[Draft_CubicBezCurve|CubicBezCurve]]
|[[Draft_AnnotationStyleEditor|AnnotationStyleEditor]]
|[[Draft_AnnotationStyleEditor|AnnotationStyleEditor]]
|[[Draft_Module|Draft]]
|[[Draft_Module|Draft]]
|IconL=Draft CubicBezCurve.svg
|IconL=Draft_Dimension.svg
|IconR=Draft_AnnotationStyleEditor.svg
|IconR=Draft_AnnotationStyleEditor.svg
|IconC=Workbench_Draft.svg
|IconC=Workbench_Draft.svg
Line 140: Line 189:
{{Draft Tools navi{{#translation:}}}}
{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Revision as of 11:28, 4 May 2021

Draft Label

Menu location
Annotation → Label
Workbenches
Draft, Arch
Default shortcut
D L
Introduced in version
0.17
See also
Draft Text, Draft ShapeString

Description

The Draft Label command creates a multi-line text with a 2-segment leader line and an arrow.

If an object or a sub-element (face, edge or vertex) is selected when starting the command, the text can be made to display one or two attributes of the selected element, including position, length, area, volume and material. The text will then be linked to the attributes and will update if their values change.

To insert a text element without an arrow use the Draft Text command instead.

Various labels with different orientations, arrows and information

Usage

See also: Draft Tray, Draft Snap and Draft Constrain.

  1. Optionally select an object or a sub-element (vertex, edge or face) that you want to display attributes of.
  2. There are several ways to invoke the command:
    • Press the Draft Label button.
    • Select the Annotation → Label option from the menu.
    • Use the keyboard shortcut: D then L.
  3. The Label task panel opens. See Options for more information.
  4. If you have selected an element: select an option from the Label type dropdown list. Additional label types can be set by changing the DANELabel Type later. See Label types below.
  5. Pick the first point in the 3D view, or type coordinates and press the Enter point button. This point indicates the target (arrow head). This can be anywhere, it does not have to be on an element.
  6. Pick the second point in the 3D view, or type coordinates and press the Enter point button. This point indicates the start of the horizontal or vertical segment of the leader.
  7. Pick the third point in the 3D view, or type coordinates and press the Enter point button. This point indicates the base point of the text.

Options

The single character keyboard shortcuts available in the task panel can be changed. See Draft Preferences. The shortcuts mentioned here are the default shortcuts.

  • To manually enter coordinates enter the X, Y and Z component, and press Enter after each. Or you can press the Enter point button when you have the desired values. It is advisable to move the pointer out of the 3D view before entering coordinates.
  • Press R or click the Relative checkbox to toggle relative mode. If relative mode is on, coordinates are relative to the last point, if available, else they are relative to the coordinate system origin.
  • Press G or click the Global checkbox to toggle global mode. If global mode is on, coordinates are relative to the global coordinate system, else they are relative to the working plane coordinate system. introduced in version 0.20
  • Press Esc or the Close button to abort the command.

Notes

  • The direction of the second segment of the leader determines the alignment of the text. If the segment is horizontal and pointing to the right the text is aligned to the left and vice versa. If the second segment goes vertically up, the text is aligned to the left. If it goes vertically down, the text is aligned to the right.

Properties

See also: Property editor.

A Draft Label object is derived from an App FeaturePython object and inherits all its properties. The following properties are additional unless otherwise stated:

Data

Label

  • DANECustom Text (StringList): specifies the contents of the text if DANELabel Type is Custom. Each item in the list represents a new text line.
  • DANELabel Type (Enumeration): specifies the type of information displayed by the label. See Label types.
  • DANEPlacement (Placement): specifies the position of the text in the 3D view and, unless DANEStraight Direction is Custom, also of the first leader segment, which is the segment where the text is attached. See Placement.
  • DANEText (StringList): (read-only) specifies the contents of the text that is actually displayed. Each item in the list represents a new text line.

Leader

  • DANEPoints (VectorList): specifies the points of the leader.
  • DANEStraight Direction (Enumeration): specifies the direction of the first leader segment: Custom, Horizontal or Vertical.
  • DANEStraight Distance (Distance): specifies the length of the first leader segment. Only used if DANEStraight Direction is Horizontal or Vertical. If the distance is positive, the leader starts from the right side of the text and the text aligns to the right. Otherwise the leader starts from the left side of the text and the text aligns to the left.

Target

  • DANETarget (LinkSub): specifies the object and optional subelement the label is linked to.
  • DANETarget Point (Vector): specifies the position of the tip of the leader, which is where the arrow is attached.

Label types

  • Custom: displays the contents of DANECustom Text.
  • Name: displays the internal name of the target object. The internal name is assigned when an object is created and remains fixed throughout the existence of the object.
  • Label: displays the label of the target object. The label of an object can be changed by the user.
  • Position: displays the coordinates of the base point of the target object, of the target vertex, or of the center of mass of the target subelement, if applicable.
  • Length: displays the length of the target object or subelement, if applicable.
  • Area: displays the area of the target object or subelement, if applicable.
  • Volume: displays the volume of the target object, if applicable.
  • Tag: displays the Tag attribute of the target object, if applicable. Objects created with the Arch Workbench can have this attribute.
  • Material: displays the label of the material of the target object, if applicable.
  • Label + Position
  • Label + Length
  • Label + Area
  • Label + Volume
  • Label + Material

View

Annotation

  • WIDOKAnnotation Style (Enumeration): specifies the annotation style applied to the label. See Draft AnnotationStyleEditor.
  • WIDOKScale Multiplier (Float): specifies the general scaling factor applied to the label.

Display Options

  • WIDOKDisplay Mode (Enumeration): specifies how the text is displayed. If it is 3D text the text will be displayed in a plane defined by the DANEPlacement of the label. If it is 2D text the text will always face the camera. This is an inherited property.

Graphics

  • WIDOKArrow Size (Length): specifies the size of the symbol displayed at the tip of the leader.
  • WIDOKArrow Type (Enumeration): specifies the type of symbol displayed at the tip of the leader, which can be Dot, Circle, Arrow, Tick or Tick-2.
  • WIDOKFrame (Enumeration): specifies what type of frame is drawn around the text. The current options are None or Rectangle.
  • WIDOKLine (Bool): specifies whether to display the leader line. If it is false only the arrow and the text are displayed.
  • WIDOKLine Color (Color): specifies the color of the leader and the arrow.
  • WIDOKLine Width (Float): specifies the width of the leader.

Text

  • WIDOKJustification (Enumeration): specifies the horizontal alignment of the text: Left, Center or Right. Only used if DANEStraight Direction is Custom. Otherwise the horizontal alignment is based on the sign (positive or negative) of DANEStraight Distance.
  • WIDOKLine Spacing (Float): specifies the factor applied to the default line height of the text.
  • WIDOKMax Chars (Integer): specifies the maximum number of characters on each line of the text.
  • WIDOKText Alignment (Enumeration): specifies the vertical alignment of the text: Top, Middle or Bottom.
  • WIDOKText Color (Color): specifies the color of the text.
  • WIDOKText Font (Font): specifies the font used to draw the text. It can be a font name, such as Arial, a default style such as sans, serif or mono, a family such as Arial,Helvetica,sans, or a name with a style such as Arial:Bold. If the given font is not found on the system, a default font is used instead.
  • WIDOKFont Size (Length): specifies the size of the letters. The text can be invisible in the 3D view if this value is very small.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To create a Draft Label use the make_label method (introduced in version 0.19) of the Draft module. This method replaces the deprecated makeLabel method.

label = make_label(target_point=App.Vector(0, 0, 0),
                   placement=App.Vector(30, 30, 0),
                   target_object=None, subelements=None,
                   label_type="Custom", custom_text="Label",
                   direction="Horizontal", distance=-10,
                   points=None)

Example:

import FreeCAD as App
import Draft

rectangle = Draft.make_rectangle(4000, 1000)
App.ActiveDocument.recompute()

p1 = App.Vector(-200, 1000, 0)
place1 = App.Placement(App.Vector(-1000, 1300, 0), App.Rotation())

label1 = Draft.make_label(p1, place1, target_object=rectangle, distance=500, label_type="Label")
label1.ViewObject.TextSize = 200

p2 = App.Vector(-200, 0, 0)
place2 = App.Placement(App.Vector(-1000, -300, 0), App.Rotation())

label2 = Draft.make_label(p2, place2, target_object=rectangle, distance=500, label_type="Custom",
                          custom_text="Beware of the sharp edges")
label2.ViewObject.TextSize = 200

p3 = App.Vector(1000, 1200, 0)
place3 = App.Placement(App.Vector(2000, 1800, 0), App.Rotation())

label3 = Draft.make_label(p3, place3, target_object=rectangle, distance=-500, label_type="Area")
label3.ViewObject.TextSize = 200

App.ActiveDocument.recompute()