Команда "Добавить текстовый документ"

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Std TextDocument and the translation is 44% complete.
Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎polski • ‎русский

Std TextDocument.svg Std TextDocument

Системное название
Std TextDocument
Расположение в меню
Инструменты → Add text document
Верстаки
All
Быстрые клавиши
Нет
Представлено в версии
0.19
См. также
Draft ShapeString, Draft Text

Описание

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.

Применение

  1. Select the Tools → Add text document option from the menu.
  2. Double-click the newly created object in the tree view to open a tab in which to write text.
  3. Add text.
  4. Close the tab and save the file when asked.

Свойства

View

Editor

  • ВидFont Name (Font): a font name, for example, Ubuntu Mono.
  • ВидFont Size (Float): a font size in points, for example, 11.
  • ВидRead Only (Bool): it defaults to false. If set to true the text cannot be edited.
  • ВидSyntax Highlighter (Enumeration): it defaults to None. If set to Python, the text will be highlighted like the Python console.

Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

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.svg Draft ShapeString.

import FreeCAD as App
import Draft

doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::TextDocument", "Text_document")
obj.Text = "textual information"
App.ActiveDocument.recompute()

obj2 = Draft.makeShapeString(obj.Text, "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10)
App.ActiveDocument.recompute()