Skip to content

Latest commit

 

History

History
220 lines (124 loc) · 11.2 KB

Draft_Label.md

File metadata and controls

220 lines (124 loc) · 11.2 KB


Draft Label

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 Label 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. (v0.20)
  • Press S to switch Draft snapping on or off.
  • 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

{{TitleProperty|Label}}

  • Custom Text|StringList: specifies the contents of the text if Label Type is {{Value|Custom}}. Each item in the list represents a new text line.

  • Label Type|Enumeration: specifies the type of information displayed by the label. See Label types.

  • Placement|Placement: specifies the position of the text in the 3D view and, unless Straight Direction is {{Value|Custom}}, also of the first leader segment, which is the segment where the text is attached. See Placement.

  • Text|StringList: (read-only) specifies the contents of the text that is actually displayed. Each item in the list represents a new text line.

{{TitleProperty|Leader}}

  • Points|VectorList: specifies the points of the leader.

  • Straight Direction|Enumeration: specifies the direction of the first leader segment: {{Value|Custom}}, {{Value|Horizontal}} or {{Value|Vertical}}.

  • Straight Distance|Distance: specifies the length of the first leader segment. Only used if 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}}

  • Target|LinkSub: specifies the object and optional subelement the label is linked to.

  • Target Point|Vector: specifies the position of the tip of the leader, which is where the arrow is attached.

Label types

  • {{Value|Custom}}: displays the contents of Custom Text.

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

  • {{Value|Label}}: displays the label of the target object. The label of an object can be changed by the user.

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

  • {{Value|Length}}: displays the length of the target object or subelement, if applicable.

  • {{Value|Area}}: displays the area of the target object or subelement, if applicable.

  • {{Value|Volume}}: displays the volume of the target object, if applicable.

  • {{Value|Tag}}: displays the Tag attribute of the target object, if applicable. Objects created with the Arch Workbench can have this attribute.

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

{{TitleProperty|Annotation}}

  • Annotation Style|Enumeration: specifies the annotation style applied to the label. See Draft AnnotationStyleEditor.

  • Scale Multiplier|Float: specifies the general scaling factor applied to the label.

{{TitleProperty|Display Options}}

  • 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 Placement of the label. If it is {{value|2D text}} the text will always face the camera. This is an inherited property.

{{TitleProperty|Graphics}}

  • Arrow Size|Length: specifies the size of the symbol displayed at the tip of the leader.

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

  • Frame|Enumeration: specifies what type of frame is drawn around the text. The current options are {{Value|None}} or {{Value|Rectangle}}.

  • Line|Bool: specifies whether to display the leader line. If it is False only the arrow and the text are displayed.

  • Line Color|Color: specifies the color of the leader and the arrow.

  • Line Width|Float: specifies the width of the leader.

{{TitleProperty|Text}}

  • Justification|Enumeration: specifies the horizontal alignment of the text: {{value|Left}}, {{value|Center}} or {{value|Right}}. Only used if Straight Direction is {{Value|Custom}}. Otherwise the horizontal alignment is based on the sign (positive or negative) of Straight Distance.

  • Line Spacing|Float: specifies the factor applied to the default line height of the text.

  • Max Chars|Integer: specifies the maximum number of characters on each line of the text.

  • Text Alignment|Enumeration: specifies the vertical alignment of the text: {{value|Top}}, {{value|Middle}} or {{value|Bottom}}.

  • Text Color|Color: specifies the color of the text.

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

  • Font 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 ((v0.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

doc = App.newDocument()

rectangle = Draft.make_rectangle(4000, 1000)
doc.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

doc.recompute()

documentation index > Draft > Draft Label