Draft ShapeString: Difference between revisions

From FreeCAD Documentation
(Inital Draft)
 
No edit summary
Line 5: Line 5:
The ShapeString tool inserts a compound shape representing a text string at a given point in the current document. Text height, tracking and font can be specified.
The ShapeString tool inserts a compound shape representing a text string at a given point in the current document. Text height, tracking and font can be specified.


[[Image:Draft_ShapeString_Example.png|400px]]
[[Image:Draft_ShapeString_Example.jpg|400px]]


==How to use==
==How to use==


# Press the {{KEY|[[Image:Draft_ShapeString64.png|16px]] [[Draft ShapeString]]}} button, or press {{KEY|S}} then {{KEY|S}} keys
# Press the {{KEY|[[Image:Draft_ShapeString.png|16px]] [[Draft ShapeString]]}} button, or press {{KEY|S}} then {{KEY|S}} keys
# Click a point on the 3D view, or type a [[Draft_Coordinates|coordinate]]
# Click a point on the 3D view, or type a [[Draft_Coordinates|coordinate]]
# Enter the desired text, press {{KEY|ENTER}}
# Enter the desired text, press {{KEY|ENTER}}
Line 34: Line 34:
The ShapeString tool can by used in [[macros]] and from the python console by using the following function:
The ShapeString tool can by used in [[macros]] and from the python console by using the following function:


Draft.makeShapeString(String,FontFile,Size = 100,Tracking = 0):
'''makeShapeString(String,FontFile,[Size],[Tracking])''' : Turns a text string into a
Compound Shape using a specified font.
'''ShapeString(Text,FontFile,Height,Track): Turns a text string into a Compound Shape'''


Example:
Example:

Revision as of 19:02, 9 April 2013

Draft_ShapeString

Menu location
Draft -> ShapeString
Workbenches
Draft
Default shortcut
S S
Introduced in version
-
See also
None

Description

The ShapeString tool inserts a compound shape representing a text string at a given point in the current document. Text height, tracking and font can be specified.

File:Draft ShapeString Example.jpg

How to use

  1. Press the Draft ShapeString button, or press S then S keys
  2. Click a point on the 3D view, or type a coordinate
  3. Enter the desired text, press ENTER
  4. Enter the desired size, press ENTER
  5. Enter the desired tracking, press ENTER
  6. Press ENTER to accept the displayed font, or,
  7. Press ... to select a font file.

Options

  • To enter coordinates manually, simply enter the numbers, then press ENTER between each X, Y and Z component.
  • Pressing ESC will cancel the operation.

Properties

  • DataPosition: The base point of the compound shape
  • DataString: The contents of the text string
  • DataSize: The height of the letters in FC units
  • DataTracking: The inter-character spacing in FC units
  • DataFont File: The font definition file used to draw the string

Scripting

The ShapeString tool can by used in macros and from the python console by using the following function:

makeShapeString(String,FontFile,[Size],[Tracking]) : Turns a text string into a 

Compound Shape using a specified font.

Example:

import FreeCAD,Draft
Draft.makeShapeString("This is a sample text",
                      "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf',
                      200.0,10)

Limitations

  • This tool is not yet available. It will be included in a future version. (as of v0.13)
  • This tool currently only handles ASCII characters in the text string and font file path. Non-ASCII characters give unpredictable results. (as of v0.13)
Available translations of this page: {{|}}