Draft ShapeString/de: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 10: Line 10:
==Description==
==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.
The ShapeString tool inserts a compound shape that represents a text string. Text height, tracking and font can be specified.
The resulting shape can be used with the [[Part Extrude]] tool to create 3D letters.

The [[Draft Text]] tool is a simpler alternative that does not produce a closed shape.


[[Image:Draft_ShapeString_Example400.png]]
[[Image:Draft_ShapeString_Example400.png]]
Line 40: Line 43:
==Scripting==
==Scripting==


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


{{Code|code=
{{Code|code=
makeShapeString(String,FontFile,[Size],[Tracking])
ShapeString = makeShapeString(String, FontFile, Size=100, Tracking=0)
}}
}}
* Turns a text string into a Compound Shape using a specified font.
* Creates a <code>ShapeString</code> compound shape using the specified <code>String</code>
* <code>FontFile</code> is mandatory and must be the full path of a supported font file
* <code>Size</code> is the height of the resulting text in millimeters
* <code>Tracking</code> is the additional inter-character spacing in millimeters


Example:
Example:
{{Code|code=
{{Code|code=
import FreeCAD,Draft
import FreeCAD, Draft
Draft.makeShapeString("This is a sample text",
Draft.makeShapeString("This is a sample text",
"/usr/share/fonts/truetype/msttcorefonts/Arial.ttf",
"/usr/share/fonts/truetype/msttcorefonts/Arial.ttf",
200.0,10)
200.0, 10)
}}
}}

==Selecting A Font==
==Selecting A Font==
[[Image:SSFontSelect.png]]
[[Image:SSFontSelect.png]]


ShapeString uses the internal geometry of a font to make FreeCAD shapes. To do this it must read the actual font file (*.tff, etc). If the Font Selection box is empty, you must type the full path to the font file or use {{KEY|...}} to select a font file.
ShapeString uses the internal geometry of a font to make FreeCAD shapes. To do this it must read the actual font file (*.tff, etc). If the Font Selection box is empty, you must type the full path to the font file or use {{KEY|...}} to select a font file.

==Limitations==
==Limitations==
* This tool is not available in FreeCAD versions anterior to 0.14
* This tool is not available in FreeCAD versions anterior to 0.14

Revision as of 19:38, 27 October 2018

Draft ShapeString

Menüeintrag
Draft -> ShapeString
Arbeitsbereich
Draft, Arch
Standardtastenkürzel
S S
Eingeführt in Version
-
Siehe auch
Keiner

Description

The ShapeString tool inserts a compound shape that represents a text string. Text height, tracking and font can be specified. The resulting shape can be used with the Part Extrude tool to create 3D letters.

The Draft Text tool is a simpler alternative that does not produce a closed shape.

How to use

  1. Press the Draft Shape from text ... 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 file, 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.
  • You can set a default font file in Draft/Prefences.

Properties

  • DatenPosition: The base point of the compound shape
  • DatenString: The contents of the text string
  • DatenSize: The height of the letters in FC units
  • DatenTracking: The inter-character spacing in FC units
  • DatenFont File: The font definition file used to draw the string

Scripting

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

ShapeString = makeShapeString(String, FontFile, Size=100, Tracking=0)
  • Creates a ShapeString compound shape using the specified String
  • FontFile is mandatory and must be the full path of a supported font file
  • Size is the height of the resulting text in millimeters
  • Tracking is the additional inter-character spacing in millimeters

Example:

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

Selecting A Font

ShapeString uses the internal geometry of a font to make FreeCAD shapes. To do this it must read the actual font file (*.tff, etc). If the Font Selection box is empty, you must type the full path to the font file or use ... to select a font file.

Limitations

  • This tool is not available in FreeCAD versions anterior to 0.14
  • TrueType(*.ttf), OpenType(*.otf) and Type1(*.pfb) font files are supported.
  • Very small text heights may result in deformed character glyphs due to loss of detail in scaling.
  • The current version is limited to left-to-right layouts on a horizontal baseline.
  • For creating curved text you can use the macro Circular Text

Tutorials