Strumenti: Aggiungi un documento di testo

From FreeCAD Documentation
Revision as of 22:20, 16 December 2019 by Renatorivo (talk | contribs) (Created page with "{{Emphasis|Vedere anche:}} Script di base per FreeCAD, e script di oggetti.")

Documento di testo

Posizione nel menu
Strumenti → Aggiungi un documento di testo
Ambiente
Tutti
Avvio veloce
Nessuno
Introdotto nella versione
0.19
Vedere anche
Draft Forma da testo, Draft Testo

Descrizione

Std TextDocument crea un oggetto in grado di contenere testo arbitrario. Questo elemento può essere utilizzato per scrivere delle informazioni generali o della documentazione sul modello.

Utilizzo

  1. Andare nel menu Strumenti → Aggiungi un documento di testo.
  2. Fare doppio clic sul nuovo oggetto creato nella vista ad albero per aprire una scheda in cui scrivere il testo.
  3. Aggiungere il testo.
  4. Chiudere la scheda e salvare il file quando viene richiesto.

Script

Vedere anche: Script di base per FreeCAD, e script di oggetti.

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 = 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()