Std TextDocument/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "# Allez dans le menu {{MenuCommand/fr|Tools → Add text document}}. # Double-cliquez sur le nouvel objet créé dans la vue en arborescence pour ouvrir un on...")
(Created page with "== Script ==")
Line 21: Line 21:
# Fermez l'onglet et enregistrez le fichier lorsque vous y êtes invité.
# Fermez l'onglet et enregistrez le fichier lorsque vous y êtes invité.


== Scripting ==
== Script ==


{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].

Revision as of 07:56, 26 December 2019

Std Ajout texte au document

Emplacement du menu
Tools → Add text document
Ateliers
Tous
Raccourci par défaut
Aucun
Introduit dans la version
0.19
Voir aussi
Draft Formes à partir texte, Draft Texte

Description

Std Ajout texte au document crée un objet capable de contenir du texte arbitraire. Cet élément peut être utilisé pour écrire des informations générales ou de la documentation sur le modèle.

Utilisation

  1. Allez dans le menu Template:MenuCommand/fr.
  2. Double-cliquez sur le nouvel objet créé dans la vue en arborescence pour ouvrir un onglet où écrire du texte.
  3. Ajouter du texte.
  4. Fermez l'onglet et enregistrez le fichier lorsque vous y êtes invité.

Script

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.

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