Draft ShapeString/de: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
{{GuiCommand/de
{{GuiCommand/de
|Name=Draft ShapeString
|Name=Draft ShapeString
Line 8: Line 9:
|SeeAlso=[[Draft Text/de|Draft Text]], [[Part Extrude/de|Part Extrude]]
|SeeAlso=[[Draft Text/de|Draft Text]], [[Part Extrude/de|Part Extrude]]
}}
}}
</div>


==Description==
==Description==
Line 14: Line 16:
The resulting shape can be used with the [[Part Extrude]] tool to create 3D letters.
The resulting shape can be used with the [[Part Extrude]] tool to create 3D letters.


To insert a simpler text element without a closed shape use [[Draft Text]]. To create a text label with a lead and an arrow use [[Draft Label]].
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]]
{{Caption|Single point required to position the Shapestring}}


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


# Press the {{KEY|[[Image:Draft_ShapeString16.png]] [[Draft_ShapeString|Draft Shape from text ...]]}} button, or press {{KEY|S}} then {{KEY|S}} keys
# Press the {{Button|[[Image:Draft_ShapeString16.png]] [[Draft_ShapeString|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]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button.
# Enter the desired text, press {{KEY|ENTER}}
# Enter the desired text, and press {{KEY|Enter}}.
# Enter the desired size, press {{KEY|ENTER}}
# Enter the desired size, and press {{KEY|Enter}}.
# Enter the desired tracking, press {{KEY|ENTER}}
# Enter the desired tracking, and press {{KEY|Enter}}.
# Press {{KEY|ENTER}} to accept the displayed font file, or,
# Press {{KEY|Enter}} to accept the displayed font file, or press {{Button|...}} to select a font file.

# Press {{KEY|...}} to select a font file.
[[Image:SSFontSelect.png]]

The text, size, tracking, and font can be changed after creation, by modifying the shape properties.

Set the default font file in [[Draft Preferences]], in the {{Button|Texts and dimensions}} tab.
Supported fonts include TrueType (.ttf), OpenType (.otf), and Type 1 (.pfb).

===Limitations===
* Very small text heights may result in deformed character shapes due to loss of detail in scaling.
* The current version is limited to left-to-right writing.
* To create text arranged in a circular fashion use the {{Button|[[File:FCCircularTextButtom.png|24px]] [[Macro_Circular Text|Circular Text]]}} macro.


==Options==
==Options==


* To enter coordinates manually, simply enter the numbers, then press {{KEY|ENTER}} between each X, Y and Z component.
* 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.
* Pressing {{KEY|ESC}} will cancel the operation.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the current command.
* You can set a default font file in Draft/Prefences.


==Properties==
==Properties==


* {{PropertyData|Position}}: The base point of the compound shape
* {{PropertyData|Position}}: specifies the position of the base point of the compound shape.
* {{PropertyData|String}}: The contents of the text string
* {{PropertyData|Angle}}: specifies the rotation of the baseline of the shape.
* {{PropertyData|Size}}: The height of the letters in FC units
* {{PropertyData|Axis}}: specifies the axis to use for the rotation.
* {{PropertyData|String}}: specifies the text string to display; unlike the [[Draft Text]] tool, the [[Draft ShapeString]] can only display a single line.
* {{PropertyData|Tracking}}: The inter-character spacing in FC units
* {{PropertyData|Font File}}: The font definition file used to draw the string
* {{PropertyData|Size}}: specifies the general height of the letters.
* {{PropertyData|Tracking}}: specifies the additional inter-character spacing in the string.
* {{PropertyData|Font File}}: specifies the full path of the font file used to draw the string.


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


The ShapeString tool can be 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=
ShapeString = makeShapeString(String, FontFile, Size=100, Tracking=0)
ShapeString = makeShapeString(String, FontFile, Size=100, Tracking=0)
}}
}}
* 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


* Creates a {{incode|ShapeString}} compound shape using the specified {{incode|String}} and the full path of a supported {{incode|FontFile}}.
Example:
* {{incode|Size}} is the height of the resulting text in millimeters.
* {{incode|Tracking}} is the additional inter-character spacing in millimeters.

The placement of the ShapeString can be changed by overwriting its {{incode|Placement}} attribute, or by individually overwriting its {{incode|Placement.Base}} and {{incode|Placement.Rotation}} attributes.

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


font1 = "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf"
==Selecting A Font==
font2 = "/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf"
[[Image:SSFontSelect.png]]
font3 = "/usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf"


S1 = Draft.makeShapeString("This is a sample text", font1, 200)
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.


S2 = Draft.makeShapeString("Inclined text", font2, 200, 10)
==Limitations==

* This tool is not available in FreeCAD versions anterior to 0.14
ZAxis = FreeCAD.Vector(0, 0, 1)
* TrueType(*.ttf), OpenType(*.otf) and Type1(*.pfb) font files are supported.
p2 = FreeCAD.Vector(-1000, 500, 0)
* Very small text heights may result in deformed character glyphs due to loss of detail in scaling.
place2 = FreeCAD.Placement(p2, FreeCAD.Rotation(ZAxis, 45))
* The current version is limited to left-to-right layouts on a horizontal baseline.
S2.Placement = place2
* For creating curved text you can use the macro [[File:FCCircularTextButtom.png|24px]][[Macro_Circular Text|Circular Text]]

S3 = Draft.makeShapeString("Upside-down text", font3, 200, 10)
S3.Placement.Base = FreeCAD.Vector(0, -1000, 0)
S3.Placement.Rotation = FreeCAD.Rotation(ZAxis, 180)
}}


==Tutorials==
==Tutorials==
* [[Draft_ShapeString_tutorial|Draft ShapeString tutorial]]
* [[Draft_ShapeString_tutorial|Draft ShapeString tutorial]]: extrude a ShapeString, position it in 3D space, and create an engraving in another body.

{{Draft Tools navi}}
{{Userdocnavi}}
{{clear}}

Revision as of 16:24, 7 January 2019

Draft ShapeString

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

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.

To insert a simpler text element without a closed shape use Draft Text. To create a text label with a lead and an arrow use Draft Label.

Single point required to position the Shapestring

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 and press the add point button.
  3. Enter the desired text, and press Enter.
  4. Enter the desired size, and press Enter.
  5. Enter the desired tracking, and press Enter.
  6. Press Enter to accept the displayed font file, or press ... to select a font file.

The text, size, tracking, and font can be changed after creation, by modifying the shape properties.

Set the default font file in Draft Preferences, in the Texts and dimensions tab. Supported fonts include TrueType (.ttf), OpenType (.otf), and Type 1 (.pfb).

Limitations

  • Very small text heights may result in deformed character shapes due to loss of detail in scaling.
  • The current version is limited to left-to-right writing.
  • To create text arranged in a circular fashion use the Circular Text macro.

Options

  • To enter coordinates manually, simply enter the numbers, then press Enter between each X, Y and Z component. You can press the add point button when you have the desired values to insert the point.
  • Press Esc or the Close button to abort the current command.

Properties

  • DatenPosition: specifies the position of the base point of the compound shape.
  • DatenAngle: specifies the rotation of the baseline of the shape.
  • DatenAxis: specifies the axis to use for the rotation.
  • DatenString: specifies the text string to display; unlike the Draft Text tool, the Draft ShapeString can only display a single line.
  • DatenSize: specifies the general height of the letters.
  • DatenTracking: specifies the additional inter-character spacing in the string.
  • DatenFont File: specifies the full path of the font file used to draw the string.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

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 and the full path of a supported FontFile.
  • Size is the height of the resulting text in millimeters.
  • Tracking is the additional inter-character spacing in millimeters.

The placement of the ShapeString can be changed by overwriting its Placement attribute, or by individually overwriting its Placement.Base and Placement.Rotation attributes.

Example:

import FreeCAD, Draft

font1 = "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf"
font2 = "/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf"
font3 = "/usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf"

S1 = Draft.makeShapeString("This is a sample text", font1, 200)

S2 = Draft.makeShapeString("Inclined text", font2, 200, 10)

ZAxis = FreeCAD.Vector(0, 0, 1)
p2 = FreeCAD.Vector(-1000, 500, 0)
place2 = FreeCAD.Placement(p2, FreeCAD.Rotation(ZAxis, 45))
S2.Placement = place2

S3 = Draft.makeShapeString("Upside-down text", font3, 200, 10)
S3.Placement.Base = FreeCAD.Vector(0, -1000, 0)
S3.Placement.Rotation = FreeCAD.Rotation(ZAxis, 180)

Tutorials