TechDraw PageDefault: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 22: Line 22:


<!--T:9-->
<!--T:9-->
The New Default tool creates a new Page object using the the template file specified in the [[TechDraw_Preferences|TechDraw Preferences]].
The '''New Default''' tool creates a new Page object using the the template file specified in the [[TechDraw_Preferences|TechDraw Preferences]].


</translate>
</translate>
Line 38: Line 38:


<!--T:12-->
<!--T:12-->
* If a Page is marked as "do not keep updated" either through the KeepUpdated Property or by the setting in Preferences, it will ignore changes in the 3D model. You may notice anomalies (missing geometry, missing Dimension values, etc) in the appearance of the Page. These will correct themselves once the Page is updated with the [[TechDraw_RedrawPage|Redraw Page]] tool. The Page will have this icon [[Image:TechDraw_Tree_Page_Unsync.svg|24px]] in the tree while updating is suspended. This setting also affects the startup process. If the Page is marked "do not keep updated" it will not be drawn at program start.
* If a Page is marked as "do not keep updated" either through the KeepUpdated Property or by the setting in Preferences, it will ignore changes in the 3D model. You may notice anomalies (missing geometry, missing Dimension values, etc) in the appearance of the Page. These will correct themselves once the Page is updated with the [[TechDraw_RedrawPage|Redraw Page]] tool. The Page will have this icon [[Image:TechDraw_Tree_Page_Unsync.svg|24px]] in the tree while updating is suspended. This setting also affects the startup process. If the Page is marked "do not keep updated" it will not be drawn at program start.


<!--T:13-->
<!--T:13-->
* If the default template is not specified in your user configuration file {{incode|user.cfg}}, the tool will try:
* If the default template is not specified in your user configuration file {{incode|user.cfg}}, the tool will try:

</translate>
</translate>
: {{Code|code=
: {{Code|code=
Line 50: Line 51:
<!--T:14-->
<!--T:14-->
: Where {{incode|$INSTALL_DIR}} is the directory where FreeCAD was installed, for example:
: Where {{incode|$INSTALL_DIR}} is the directory where FreeCAD was installed, for example:

</translate>
</translate>
: {{Code|code=
: {{Code|code=
Line 70: Line 72:


<!--T:15-->
<!--T:15-->
* {{PropertyData|Keep Updated}}: If false, the Page is not updated with changes to the 3D model. Useful for complicated/slow drawings. See Notes.
* {{PropertyData|Keep Updated}}: If false, the Page is not updated with changes to the 3D model. Useful for complicated/slow drawings. See [[#Notes|Notes]].
* {{PropertyData|Template}}: A link to this Page's [[TechDraw_Templates|Template]] object.
* {{PropertyData|Template}}: A link to this Page's [[TechDraw_Templates|Template]] object.
* {{PropertyData|Views}}: A list of links to the Views on this Page.
* {{PropertyData|Views}}: A list of links to the Views on this Page.
Line 92: Line 94:
<!--T:17-->
<!--T:17-->
The New Default tool can be used in [[Macros|macros]] and from the [[Python|Python]] console by using the following functions:
The New Default tool can be used in [[Macros|macros]] and from the [[Python|Python]] console by using the following functions:

</translate>
</translate>
{{Code|code=
{{Code|code=
Line 100: Line 103:
}}
}}
<translate>
<translate>

<!--T:7-->
<!--T:7-->
* Creates a new Page in the current document
* Creates a new Page in the current document

Revision as of 10:14, 19 February 2023

TechDraw PageDefault

Menu location
TechDraw → Insert Default Page
Workbenches
TechDraw
Default shortcut
None
Introduced in version
-
See also
TechDraw PageTemplate, TechDraw Templates

Description

The New Default tool creates a new Page object using the the template file specified in the TechDraw Preferences.

Default template that comes with TechDraw: A4 page in landscape orientation, with editable text fields

Usage

Notes

  • If a Page is marked as "do not keep updated" either through the KeepUpdated Property or by the setting in Preferences, it will ignore changes in the 3D model. You may notice anomalies (missing geometry, missing Dimension values, etc) in the appearance of the Page. These will correct themselves once the Page is updated with the Redraw Page tool. The Page will have this icon in the tree while updating is suspended. This setting also affects the startup process. If the Page is marked "do not keep updated" it will not be drawn at program start.
  • If the default template is not specified in your user configuration file user.cfg, the tool will try:
$INSTALL_DIR/Mod/TechDraw/Templates/A4_LandscapeTD.svg
Where $INSTALL_DIR is the directory where FreeCAD was installed, for example:
/usr/share/freecad/Mod/TechDraw/Templates/A4_LandscapeTD.svg

Properties

Data

Base

  • DataProjection Type: Default projection type (First or Third Angle) for this Page.

Page

  • DataKeep Updated: If false, the Page is not updated with changes to the 3D model. Useful for complicated/slow drawings. See Notes.
  • DataTemplate: A link to this Page's Template object.
  • DataViews: A list of links to the Views on this Page.
  • DataScale: Default scale for Views in this Page.
  • DataNext Balloon Index: Auto-numbering for Balloons.

View

Grid

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

The New Default tool can be used in macros and from the Python console by using the following functions:

page = FreeCAD.ActiveDocument.addObject('TechDraw::DrawPage','Page')
template = FreeCAD.ActiveDocument.addObject('TechDraw::DrawSVGTemplate','Template')
template.Template = templateFileSpec
page.Template = FreeCAD.ActiveDocument.Template
  • Creates a new Page in the current document

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