Draft Text: Difference between revisions
No edit summary |
(Updated default shortcuts.) |
||
(45 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Page_in_progress}} |
|||
<languages/> |
<languages/> |
||
<translate> |
<translate> |
||
Line 5: | Line 4: | ||
<!--T:18--> |
<!--T:18--> |
||
{{Docnav |
{{Docnav |
||
|[[Draft_Hatch|Hatch]] |
|||
|[[Draft_ShapeString|ShapeString]] |
|||
|[[Draft_Dimension|Dimension]] |
|[[Draft_Dimension|Dimension]] |
||
|[[ |
|[[Draft_Workbench|Draft]] |
||
|IconL= |
|IconL=Draft_Hatch.svg |
||
|IconR=Draft_Dimension.svg |
|IconR=Draft_Dimension.svg |
||
|IconC=Workbench_Draft.svg |
|IconC=Workbench_Draft.svg |
||
Line 17: | Line 16: | ||
|Name=Draft Text |
|Name=Draft Text |
||
|MenuLocation=Annotation → Text |
|MenuLocation=Annotation → Text |
||
|Workbenches=[[ |
|Workbenches=[[Draft_Workbench|Draft]], [[Arch_Workbench|Arch]] |
||
|Shortcut={{KEY|T}} {{KEY|E}} |
|Shortcut={{KEY|T}} {{KEY|E}} |
||
|Version=0.7 |
|Version=0.7 |
||
Line 26: | Line 25: | ||
<!--T:2--> |
<!--T:2--> |
||
The [[Image:Draft_Text.svg|24px]] |
The [[Image:Draft_Text.svg|24px]] '''Draft Text''' command creates a multi-line text at a given point. |
||
<!--T:11--> |
<!--T:11--> |
||
To |
To create a text element with an arrow use the [[Draft_Label|Draft Label]] command instead. |
||
<!--T:3--> |
<!--T:3--> |
||
[[Image:Draft_Text_example.png|400px]] |
[[Image:Draft_Text_example.png|400px]] |
||
{{Caption|Single point required to position the |
{{Caption|Single point required to position the text}} |
||
==Usage== <!--T:23--> |
==Usage== <!--T:23--> |
||
<!--T:24--> |
|||
See also: [[Draft_Tray|Draft Tray]] and [[Draft_Snap|Draft Snap]]. |
|||
<!--T:4--> |
<!--T:4--> |
||
# There are several ways to invoke the command: |
# There are several ways to invoke the command: |
||
#* Press the {{Button|[[Image:Draft_Text.svg|16px]] [[Draft_Text| |
#* Press the {{Button|[[Image:Draft_Text.svg|16px]] [[Draft_Text|Text]]}} button. |
||
#* Select the {{MenuCommand|Annotation → [[Image:Draft_Text.svg|16px]] Text}} option from the menu. |
#* Select the {{MenuCommand|Annotation → [[Image:Draft_Text.svg|16px]] Text}} option from the menu. |
||
#* Use the keyboard shortcut: {{KEY|T}} then {{KEY|E}}. |
#* Use the keyboard shortcut: {{KEY|T}} then {{KEY|E}}. |
||
# The {{MenuCommand|Text}} task panel opens. See [[#Options|Options]] for more information. |
|||
# |
# Pick a point in the [[3D_view|3D view]], or type coordinates and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button. |
||
# Enter the desired text, pressing {{KEY|Enter}} between each line. |
|||
# |
# Enter the desired text, press {{KEY|Enter}} to start a new line. |
||
# Press {{KEY|Enter}} twice or press the {{Button|[[Image:Button_valid.svg|16px]] Create text}} button to finish the command. |
|||
==Options== <!--T:5--> |
==Options== <!--T:5--> |
||
<!--T:25--> |
|||
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 (for version 0.22). |
|||
<!--T:6--> |
<!--T:6--> |
||
* To enter coordinates |
* 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. |
||
* 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}} |
|||
* Hold {{KEY|Ctrl}} while placing the text to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance. |
|||
* Press {{KEY|N}} or click the {{MenuCommand|Continue}} checkbox to toggle continue mode. If continue mode is on, the command will restart after finishing, allowing you to continue creating texts. The shortcut does not work in the second task panel. This option is not available in the first task panel in FreeCAD version 0.19 and earlier. |
|||
* Press {{KEY|Enter}} or {{KEY|↓ Down arrow}} to enter a new line of text. |
|||
* Press {{KEY| |
* Press {{KEY|S}} to switch [[Draft_Snap|Draft snapping]] on or off. |
||
* Press {{KEY|Enter}} or {{KEY|↓ Down arrow}} twice to finish editing the text. |
|||
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command. |
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command. |
||
==Notes== |
==Notes== <!--T:26--> |
||
<!--T:21--> |
<!--T:21--> |
||
* A Draft Text can be edited by double-clicking it in the [[Tree_view|Tree view]]. {{Version|0.20}} |
|||
* Draft Texts created with [[Release_notes_0. |
* Draft Texts created or saved with [[Release_notes_0.21|FreeCAD version 0.21]] are not backward compatible. |
||
==Properties== <!--T:7--> |
==Properties== <!--T:7--> |
||
<!--T:27--> |
|||
⚫ | |||
See also: [[Property_editor|Property editor]]. |
|||
<!--T:28--> |
|||
A Draft Text object is derived from an [[App_FeaturePython|App FeaturePython]] object and inherits all its properties. The following properties are additional unless otherwise stated. |
|||
⚫ | |||
<!--T:30--> |
|||
{{TitleProperty|Base}} |
|||
<!--T:12--> |
<!--T:12--> |
||
* {{PropertyData| |
* {{PropertyData|Placement|Placement}}: specifies the position of the text in the [[3D view|3D view]]. See [[Placement|Placement]]. |
||
* {{PropertyData| |
* {{PropertyData|Text|StringList}}: specifies the contents of the text. 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. |
|||
⚫ | |||
* {{PropertyData|Axis}}: specifies the axis to use for the rotation. |
|||
<!--T:32--> |
|||
{{TitleProperty|Annotation}} |
|||
<!--T:33--> |
|||
* {{PropertyView|Annotation Style|Enumeration}}: specifies the annotation style applied to the text. See [[Draft_AnnotationStyleEditor|Draft AnnotationStyleEditor]]. |
|||
* {{PropertyView|Scale Multiplier|Float}}: specifies the general scaling factor applied to the text. |
|||
<!--T:34--> |
|||
{{TitleProperty|Display Options}} |
|||
<!--T:35--> |
|||
* {{PropertyView|Display Mode|Enumeration}}: specifies how the text is displayed. If it is {{value|World}} the text will be displayed on a plane defined by its {{PropertyData|Placement}}. If it is {{value|Screen}} the text will always face the screen. This is an inherited property. The mentioned options are the renamed options ({{Version|0.21}}). |
|||
<!--T:36--> |
|||
{{TitleProperty|Graphics}} |
|||
<!--T:37--> |
|||
* {{PropertyView|Line Color|Color}}: not used. |
|||
* {{PropertyView|Line Width|Float}}: not used. |
|||
<!--T:38--> |
|||
⚫ | |||
{{TitleProperty|Text}} |
|||
<!--T:13--> |
<!--T:13--> |
||
* {{PropertyView|Font Name|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|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. |
|||
* {{PropertyView|Font |
* {{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. |
||
* {{PropertyView| |
* {{PropertyView|Justification|Enumeration}}: specifies if the alignment of the text: {{value|Left}}, {{value|Center}} or {{value|Right}}. |
||
* {{PropertyView| |
* {{PropertyView|Line Spacing|Float}}: specifies the factor applied to the default line height of the text. |
||
* {{PropertyView| |
* {{PropertyView|Text Color|Color}}: specifies the color of the text. |
||
==Scripting== |
==Scripting== <!--T:39--> |
||
<!--T:8--> |
<!--T:8--> |
||
See also: [https:// |
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]]. |
||
<!--T:14--> |
<!--T:14--> |
||
To create a Draft Text use the {{incode| |
To create a Draft Text use the {{incode|make_text}} method ({{Version|0.19}}) of the Draft module. This method replaces the deprecated {{incode|makeText}} method. |
||
</translate> |
</translate> |
||
Line 95: | Line 131: | ||
<!--T:9--> |
<!--T:9--> |
||
* Creates a {{incode|text}} object, at {{incode|placement}}, which can be a {{incode|FreeCAD.Placement}}, but also a {{incode|FreeCAD.Rotation}} |
* Creates a {{incode|text}} object, at {{incode|placement}}, which can be a {{incode|FreeCAD.Placement}}, but also a {{incode|FreeCAD.Rotation}} or a {{incode|FreeCAD.Vector}}. |
||
* {{incode|string}} is a string |
* {{incode|string}} is a string or a list of strings. If it is a list, each element is displayed on its own line. |
||
* If {{incode|screen}} is {{incode|True}}, the text always faces the camera, otherwise it |
* If {{incode|screen}} is {{incode|True}}, the text always faces the camera, otherwise it is displayed in a plane defined by its {{PropertyData|Placement}}. |
||
<!--T:16--> |
<!--T:16--> |
||
Line 138: | Line 174: | ||
<!--T:17--> |
<!--T:17--> |
||
{{Docnav |
{{Docnav |
||
|[[Draft_Hatch|Hatch]] |
|||
|[[Draft_ShapeString|ShapeString]] |
|||
|[[Draft_Dimension|Dimension]] |
|[[Draft_Dimension|Dimension]] |
||
|[[ |
|[[Draft_Workbench|Draft]] |
||
|IconL= |
|IconL=Draft_Hatch.svg |
||
|IconR=Draft_Dimension.svg |
|IconR=Draft_Dimension.svg |
||
|IconC=Workbench_Draft.svg |
|IconC=Workbench_Draft.svg |
Latest revision as of 18:30, 6 January 2024
Draft Text |
Menu location |
---|
Annotation → Text |
Workbenches |
Draft, Arch |
Default shortcut |
T E |
Introduced in version |
0.7 |
See also |
Draft Label, Draft ShapeString |
Description
The Draft Text command creates a multi-line text at a given point.
To create a text element with an arrow use the Draft Label command instead.
Single point required to position the text
Usage
See also: Draft Tray and Draft Snap.
- There are several ways to invoke the command:
- Press the Text button.
- Select the Annotation → Text option from the menu.
- Use the keyboard shortcut: T then E.
- The Text task panel opens. See Options for more information.
- Pick a point in the 3D view, or type coordinates and press the Enter point button.
- Enter the desired text, press Enter to start a new line.
- Press Enter twice or press the Create text button to finish the command.
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 (for version 0.22).
- 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 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 N or click the Continue checkbox to toggle continue mode. If continue mode is on, the command will restart after finishing, allowing you to continue creating texts. The shortcut does not work in the second task panel. This option is not available in the first task panel in FreeCAD version 0.19 and earlier.
- Press S to switch Draft snapping on or off.
- Press Esc or the Close button to abort the command.
Notes
- A Draft Text can be edited by double-clicking it in the Tree view. introduced in version 0.20
- Draft Texts created or saved with FreeCAD version 0.21 are not backward compatible.
Properties
See also: Property editor.
A Draft Text object is derived from an App FeaturePython object and inherits all its properties. The following properties are additional unless otherwise stated.
Data
Base
- DataPlacement (
Placement
): specifies the position of the text in the 3D view. See Placement. - DataText (
StringList
): specifies the contents of the text. Each item in the list represents a new text line.
View
Annotation
- ViewAnnotation Style (
Enumeration
): specifies the annotation style applied to the text. See Draft AnnotationStyleEditor. - ViewScale Multiplier (
Float
): specifies the general scaling factor applied to the text.
Display Options
- ViewDisplay Mode (
Enumeration
): specifies how the text is displayed. If it isWorld
the text will be displayed on a plane defined by its DataPlacement. If it isScreen
the text will always face the screen. This is an inherited property. The mentioned options are the renamed options (introduced in version 0.21).
Graphics
- ViewLine Color (
Color
): not used. - ViewLine Width (
Float
): not used.
Text
- ViewFont Name (
Font
): specifies the font used to draw the text. It can be a font name, such asArial
, a default style such assans
,serif
ormono
, a family such asArial,Helvetica,sans
, or a name with a style such asArial:Bold
. If the given font is not found on the system, a default font is used instead. - ViewFont Size (
Length
): specifies the size of the letters. The text can be invisible in the 3D view if this value is very small. - ViewJustification (
Enumeration
): specifies if the alignment of the text:Left
,Center
orRight
. - ViewLine Spacing (
Float
): specifies the factor applied to the default line height of the text. - ViewText Color (
Color
): specifies the color of the text.
Scripting
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
To create a Draft Text use the make_text
method (introduced in version 0.19) of the Draft module. This method replaces the deprecated makeText
method.
text = make_text(string, placement=None, screen=False)
- Creates a
text
object, atplacement
, which can be aFreeCAD.Placement
, but also aFreeCAD.Rotation
or aFreeCAD.Vector
. string
is a string or a list of strings. If it is a list, each element is displayed on its own line.- If
screen
isTrue
, the text always faces the camera, otherwise it is displayed in a plane defined by its DataPlacement.
The view properties of text
can be changed by overwriting its attributes; for example, overwrite ViewObject.FontSize
with the new size in millimeters.
Example:
import FreeCAD as App
import Draft
doc = App.newDocument()
t1 = "This is a sample text"
p1 = App.Vector(0, 0, 0)
t2 = ["First line", "second line"]
p2 = App.Vector(1000, 1000, 0)
text1 = Draft.make_text(t1, p1)
text2 = Draft.make_text(t2, p2)
text1.ViewObject.FontSize = 200
text2.ViewObject.FontSize = 200
zaxis = App.Vector(0, 0, 1)
t3 = ["Upside", "down"]
p3 = App.Vector(-1000, -500, 0)
place3 = App.Placement(p3, App.Rotation(zaxis, 180))
text3 = Draft.make_text(t3, place3)
text3.ViewObject.FontSize = 200
doc.recompute()
- Drafting: Line, Polyline, Fillet, Arc, Arc by 3 points, Circle, Ellipse, Rectangle, Polygon, B-spline, Cubic Bézier curve, Bézier curve, Point, Facebinder, ShapeString, Hatch
- Annotation: Text, Dimension, Label, Annotation styles, Annotation scale
- Modification: Move, Rotate, Scale, Mirror, Offset, Trimex, Stretch, Clone, Array, Polar array, Circular array, Path array, Path link array, Point array, Point link array, Edit, Subelement highlight, Join, Split, Upgrade, Downgrade, Wire to B-spline, Draft to sketch, Set slope, Flip dimension, Shape 2D view
- Draft Tray: Select plane, Set style, Toggle construction mode, AutoGroup
- Snapping: Snap lock, Snap endpoint, Snap midpoint, Snap center, Snap angle, Snap intersection, Snap perpendicular, Snap extension, Snap parallel, Snap special, Snap near, Snap ortho, Snap grid, Snap working plane, Snap dimensions, Toggle grid
- Miscellaneous: Apply current style, Layer, Manage layers, Add a new named group, Move to group, Select group, Add to construction group, Toggle normal/wireframe display, Create working plane proxy, Heal, Show snap toolbar
- Additional: Constraining, Pattern, Preferences, Import Export Preferences, DXF/DWG, SVG, OCA, DAT
- Context menu:
- Layer container: Merge layer duplicates, Add new layer
- Layer: Activate this layer, Select layer contents
- Text: Open hyperlinks
- Wire: Flatten
- Working plane proxy: Write camera position, Write objects state
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub