TechDraw PageTemplate: Difference between revisions
('TechDraw Insert Default Page' is an over-correction.) |
mNo edit summary |
||
(23 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
<!--T:17--> |
<!--T:17--> |
||
{{Docnav |
{{Docnav |
||
|[[TechDraw_PageDefault|DefaultPage]] |
|||
|[[TechDraw PageDefault|Insert Default Page]] |
|||
|[[TechDraw_RedrawPage| |
|[[TechDraw_RedrawPage|RedrawPage]] |
||
|[[ |
|[[TechDraw_Workbench|TechDraw]] |
||
|IconL=TechDraw_PageDefault.svg |
|IconL=TechDraw_PageDefault.svg |
||
⚫ | |||
|IconR=TechDraw_RedrawPage.svg |
|IconR=TechDraw_RedrawPage.svg |
||
⚫ | |||
}} |
}} |
||
Line 14: | Line 14: | ||
{{GuiCommand |
{{GuiCommand |
||
|Name=TechDraw PageTemplate |
|Name=TechDraw PageTemplate |
||
|MenuLocation=TechDraw → Insert Page using Template |
|MenuLocation=TechDraw → Page → Insert Page using Template |
||
|Workbenches=[[ |
|Workbenches=[[TechDraw_Workbench|TechDraw]] |
||
|SeeAlso=[[TechDraw_PageDefault| |
|SeeAlso=[[TechDraw_PageDefault|TechDraw PageDefault]], [[TechDraw_Templates|TechDraw Templates]] |
||
}} |
}} |
||
Line 22: | Line 22: | ||
<!--T:8--> |
<!--T:8--> |
||
The |
The '''TechDraw PageTemplate''' tool creates a new Page object using the template file selected from a dialog. |
||
<!--T:9--> |
<!--T:9--> |
||
The starting directory for the dialog can be specified in the [[ |
The starting directory for the dialog can be specified in the [[TechDraw_Preferences|TechDraw Preferences]]. |
||
</translate> |
</translate> |
||
[[Image:A4_Landscape_ISO7200_Pep.svg|400px]] |
[[Image:A4_Landscape_ISO7200_Pep.svg|400px]] |
||
<translate> |
<translate> |
||
<!--T:10--> |
<!--T:10--> |
||
{{Caption|One of the templates that comes with TechDraw: |
{{Caption|One of the templates that comes with TechDraw: A4_Landscape_ISO7200_Pep.svg}} |
||
==Usage== <!--T:3--> |
==Usage== <!--T:3--> |
||
<!--T:11--> |
<!--T:11--> |
||
# An active document must exist. |
|||
⚫ | |||
# There are several ways to invoke the tool: |
|||
⚫ | |||
#* Select the {{MenuCommand|TechDraw → Page → [[Image:TechDraw_PageTemplate.svg|16px]] Insert Page using Template}} option from the menu. |
|||
==Properties== <!--T:5--> |
==Properties== <!--T:5--> |
||
<!--T: |
<!--T:22--> |
||
See [[TechDraw_PageDefault#Properties|TechDraw PageDefault]]. |
|||
* {{PropertyData|Projection Type}}: Default projection type (First or Third Angle) for this Page. |
|||
* {{PropertyData|Scale}}: Default scale for Views in this Page. |
|||
==Scripting== <!--T:6--> |
==Scripting== <!--T:6--> |
||
<!--T:13--> |
<!--T:13--> |
||
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]]. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</translate> |
</translate> |
||
{{Code|code= |
{{Code|code= |
||
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) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
"Select a Template File", |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
page.Template = template |
|||
doc.recompute() |
|||
}} |
}} |
||
<translate> |
<translate> |
||
⚫ | |||
* Creates a new Page in the current document |
|||
=== Editable text fields === <!--T:19--> |
=== Editable text fields === <!--T:19--> |
||
<!--T:20--> |
<!--T:20--> |
||
{{Emphasis|See also:}} [[ |
{{Emphasis|See also:}} [[TechDraw_Templates|TechDraw Templates]] for more information on creating templates. |
||
⚫ | |||
Once a new page has been created, its {{incode|Template}} attribute holds an {{incode|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 {{incode|EditableTexts}} attribute to see the changes. |
|||
</translate> |
|||
{{Code|code= |
|||
⚫ | |||
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 |
|||
}} |
|||
<translate> |
|||
<!--T:21--> |
|||
See the information in [[TechDraw_PageDefault|Insert Default Page]] to programmatically change the editable text fields in a page template. |
|||
<!--T:18--> |
<!--T:18--> |
||
{{Docnav |
{{Docnav |
||
|[[TechDraw_PageDefault| |
|[[TechDraw_PageDefault|DefaultPage]] |
||
|[[TechDraw_RedrawPage| |
|[[TechDraw_RedrawPage|RedrawPage]] |
||
|[[ |
|[[TechDraw_Workbench|TechDraw]] |
||
|IconL=TechDraw_PageDefault.svg |
|IconL=TechDraw_PageDefault.svg |
||
⚫ | |||
|IconR=TechDraw_RedrawPage.svg |
|IconR=TechDraw_RedrawPage.svg |
||
⚫ | |||
}} |
}} |
||
Latest revision as of 18:26, 24 July 2023
TechDraw PageTemplate |
Menu location |
---|
TechDraw → Page → Insert Page using Template |
Workbenches |
TechDraw |
Default shortcut |
None |
Introduced in version |
- |
See also |
TechDraw PageDefault, TechDraw Templates |
Description
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
Usage
- An active document must exist.
- There are several ways to invoke the tool:
- Press the Insert Page using Template button.
- Select the TechDraw → Page → Insert Page using Template option from the menu.
Properties
See TechDraw PageDefault.
Scripting
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
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
- Pages: Insert Default Page, Insert Page using Template, Redraw Page, Print All Pages
- Views: Insert View, Insert Active View, Insert Projection Group, Insert Section View, Insert Complex Section View, Insert Detail View, Insert Draft Workbench Object, Insert Arch Workbench Object, Insert Spreadsheet View, Insert Clip Group, Share View, Project Shape
- Stacking: Move view to top of stack, Move view to bottom of stack, Move view up one level, Move view down one level
- Decorations: Hatch Face using Image File, Apply Geometric Hatch to Face, Insert SVG Symbol, Insert Bitmap Image, Turn View Frames On/Off
- Dimensions: Insert Length Dimension, Insert Horizontal Dimension, Insert Vertical Dimension, Insert Radius Dimension, Insert Diameter Dimension, Insert Angle Dimension, Insert 3-Point Angle Dimension, Insert Horizontal Extent Dimension, Insert Vertical Extent Dimension, Link Dimension to 3D Geometry, Insert Balloon Annotation, Insert Axonometric Length Dimension, Insert Landmark Dimension, Adjust Geometric References of Dimension
- Annotations: Insert Annotation, Add Leaderline to View, Insert Rich Text Annotation, Add Cosmetic Vertex, Add Midpoint Vertices, Add Quadrant Vertices, Add Centerline to Faces, Add Centerline between 2 Lines, Add Centerline between 2 Points, Add Cosmetic Line Through 2 points, Add Cosmetic Circle, Change Appearance of Lines, Show/Hide Invisible Edges, Add Welding Information to Leader, Add Surface Finish Symbol, Add Hole or Shaft Tolerances
- Extensions:
- Attributes and modifications: Select Line Attributes, Cascade Spacing and Delta Distance, Change Line Attributes, Extend Line, Shorten Line, Lock/Unlock View, Position Section View, Position Horizontal Chain Dimensions, Position Vertical Chain Dimensions, Position Oblique Chain Dimensions, Cascade Horizontal Dimensions, Cascade Vertical Dimensions, Cascade Oblique Dimensions, Calculate the area of selected faces, Calculate the arc length of selected edges, Customize format label
- Centerlines and threading: Add Circle Centerlines, Add Bolt Circle Centerlines, Add Cosmetic Thread Hole Side View, Add Cosmetic Thread Hole Bottom View, Add Cosmetic Thread Bolt Side View, Add Cosmetic Thread Bolt Bottom View, Add Cosmetic Intersection Vertex(es), Add an offset vertex, Add Cosmetic Circle, Add Cosmetic Arc, Add Cosmetic Circle 3 Points, Add Cosmetic Parallel Line, Add Cosmetic Perpendicular Line
- Dimensions: Create Horizontal Chain Dimensions, Create Vertical Chain Dimensions, Create Oblique Chain Dimensions, Create Horizontal Coordinate Dimensions, Create Vertical Coordinate Dimensions, Create Oblique Coordinate Dimensions, Create Horizontal Chamfer Dimension, Create Vertical Chamfer Dimension, Create Arc Length Dimension, Insert '⌀' Prefix, Insert '〼' Prefix, Remove Prefix, Increase Decimal Places, Decrease Decimal Places
- Export: Export Page as SVG, Export Page as DXF
- Additional: Line Groups, Templates, Hatching, Geometric dimensioning and tolerancing, Preferences
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web
- Hubs: User hub, Power users hub, Developer hub