GuiCommand: Name: Std TextDocument MenuLocation: Tools , Add text document Workbenches: All Version: 0.19 SeeAlso: Draft ShapeString, Draft Text
Std TextDocument
Description
The Std TextDocument command creates an object capable of holding arbitrary text. This element can be used to write general information or documentation about the model.
Usage
- Select the Tools →
Add text document option from the menu.
- Double-click the newly created object in the Tree view to open a tab in which to write text.
- Add text.
- Close the tab and save the file when asked.
Properties
View
{{TitleProperty|Editor}}
-
Font Name|Font: a font name, for example, {{Value|Ubuntu Mono}}.
-
Font Size|Float: a font size in points, for example, {{Value|11}}.
-
Read Only|Bool: it defaults to
False
. If set toTrue
the text cannot be edited. -
Syntax Highlighter|Enumeration: it defaults to {{Value|None}}. If set to {{Value|Python}}, the text will be highlighted like the Python console.
Scripting
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
See Part Feature for the general information on adding objects to a document.
An App::TextDocument
object is created with the addObject()
method of the document. Once a TextDocument exists, its textual information is stored in its Text
attribute. This attribute can be used in other objects, for example, as the string in a Draft ShapeString.
import FreeCAD as App
import Draft
doc = App.newDocument()
obj = doc.addObject("App::TextDocument", "Text_document")
obj.Text = "textual information"
doc.recompute()
obj2 = Draft.makeShapeString(obj.Text, "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10)
doc.recompute()
⏵ documentation index > Std TextDocument
This page is retrieved from https://github.com/FreeCAD/FreeCAD-documentation/blob/main/wiki/Std_TextDocument.md