TechDraw PageTemplate/ru: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
{{Docnav/ru
{{Docnav/ru
|[[TechDraw_PageDefault/ru|Вставить страницу по умолчанию]]
|[[TechDraw_PageDefault/ru|Вставить страницу по умолчанию]]
Line 8: Line 9:
|IconC=Workbench_TechDraw.svg
|IconC=Workbench_TechDraw.svg
}}
}}
</div>


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 89: Line 91:




<div class="mw-translate-fuzzy">
{{Docnav
{{Docnav
|[[TechDraw_PageDefault/ru|Вставить страницу по умолчанию]]
|[[TechDraw_PageDefault/ru|Вставить страницу по умолчанию]]
Line 97: Line 100:
|IconC=Workbench_TechDraw.svg
|IconC=Workbench_TechDraw.svg
}}
}}
</div>


{{TechDraw Tools navi{{#translation:}}}}
{{TechDraw Tools navi{{#translation:}}}}

Latest revision as of 19:49, 7 June 2024

Other languages:

Вставить страницу используя шаблон

Системное название
TechDraw_PageTemplate
Расположение в меню
TechDraw → Вставить страницу используя шаблон
Верстаки
TechDraw
Быстрые клавиши
Нет
Представлено в версии
-
См. также
Вставить страницу по умолчанию, Шаблоны

Описание

The TechDraw PageTemplate tool creates a new Page object using the template file selected from a dialog.

The starting directory for the dialog can be specified in the TechDraw Preferences.

One of the templates that comes with TechDraw: A4_Landscape_ISO7200_Pep.svg

Применение

  1. An active document must exist.
  2. There are several ways to invoke the tool:

Свойства

See TechDraw PageDefault.

Программирование

См. так же: TechDraw API и Основы составления скриптов FreeCAD.

A Page based on a selected template can be created with macros and from the Python console by using the following functions:

import FreeCAD as App
from PySide import QtGui

doc = App.ActiveDocument
default_dir = App.getResourceDir() + "Mod/TechDraw/Templates"
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Files")
template_dir = param.GetString("TemplateDir", default_dir)

template_file = QtGui.QFileDialog.getOpenFileName(QtGui.QApplication.activeWindow(),
                                                  "Select a Template File", 
                                                  template_dir,
                                                  "Template (*.svg)")
                                                  
page = doc.addObject("TechDraw::DrawPage", "Page")
template = doc.addObject("TechDraw::DrawSVGTemplate", "Template")
template.Template = template_file[0]
page.Template = template

doc.recompute()

Editable text fields

See also: TechDraw Templates for more information on creating templates.

Once a new page has been created, its Template attribute holds an EditableTexts dictionary with the name of the editable fields (keys) and their textual values. Copy this dictionary to a variable, make changes, and then re-assign the dictionary to the EditableTexts attribute to see the changes.

page = FreeCAD.ActiveDocument.Page
texts = page.Template.EditableTexts

for key, value in texts.items():
    print("{0} = {1}".format(key, value))

texts["FC-Title"] = "The title of my page"
page.Template.EditableTexts = texts