TechDraw PageDefault: Difference between revisions

From FreeCAD Documentation
No edit summary
(Notes)
 
(8 intermediate revisions by the same user not shown)
Line 14: Line 14:
{{GuiCommand
{{GuiCommand
|Name=TechDraw PageDefault
|Name=TechDraw PageDefault
|MenuLocation=TechDraw → Insert Default Page
|MenuLocation=TechDraw → Page → Insert Default Page
|Workbenches=[[TechDraw_Workbench|TechDraw]]
|Workbenches=[[TechDraw_Workbench|TechDraw]]
|SeeAlso=[[TechDraw_PageTemplate|TechDraw PageTemplate]], [[TechDraw_Templates|TechDraw Templates]]
|SeeAlso=[[TechDraw_PageTemplate|TechDraw PageTemplate]], [[TechDraw_Templates|TechDraw Templates]]
Line 28: Line 28:
<translate>
<translate>
<!--T:10-->
<!--T:10-->
{{Caption|Default template that comes with TechDraw: A4 page in landscape orientation, with editable text fields}}
{{Caption|Default template that comes with TechDraw: A4_LandscapeTD.svg}}


==Usage== <!--T:3-->
==Usage== <!--T:3-->


<!--T:11-->
<!--T:11-->
* Press the {{Button|[[Image:TechDraw_PageDefault.svg|16px]] [[TechDraw_PageDefault|Insert Default Page]]}} button. (An active document must exist.)
# An active document must exist.
# There are several ways to invoke the tool:
#* Press the {{Button|[[Image:TechDraw_PageDefault.svg|16px]] [[TechDraw_PageDefault|Insert Default Page]]}} button.
#* Select the {{MenuCommand|TechDraw → Page → [[Image:TechDraw_PageDefault.svg|16px]] Insert Default Page}} option from the menu.


== Notes == <!--T:8-->
== Notes == <!--T:8-->


<!--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 its {{PropertyData|Keep Updated}} property, through the {{MenuCommand|Toggle Keep Updated}} option from its window context menu, or by the setting in the 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_view|Tree view]] while updating is suspended. This setting also affects the startup process. If a Page is marked as "do not keep updated" it will not be drawn at program start.


<!--T:13-->
<!--T:13-->
Line 85: Line 88:
<!--T:31-->
<!--T:31-->
* {{PropertyView|Show Grid}}: Show a grid over this Page. {{Version|0.20}}
* {{PropertyView|Show Grid}}: Show a grid over this Page. {{Version|0.20}}
* {{PropertyView|Grid Spacing}}: Distance between grid lines in mm. {{Version|0.20}}
* {{PropertyView|Grid Spacing}}: Distance between grid lines. {{Version|0.20}}


==Scripting== <!--T:6-->
==Scripting== <!--T:6-->


<!--T:16-->
<!--T:32-->
See [[TechDraw_PageTemplate#Scripting|TechDraw PageTemplate]].
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:17-->
The New Default tool can be used in [[Macros|macros]] and from the [[Python|Python]] console by using the following functions:

</translate>
{{Code|code=
page = FreeCAD.ActiveDocument.addObject('TechDraw::DrawPage','Page')
template = FreeCAD.ActiveDocument.addObject('TechDraw::DrawSVGTemplate','Template')
template.Template = templateFileSpec
page.Template = FreeCAD.ActiveDocument.Template
}}
<translate>

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

=== Editable text fields === <!--T:22-->

<!--T:23-->
{{Emphasis|See also:}} [[TechDraw_Templates|TechDraw Templates]] for more information on creating templates.

<!--T:24-->
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=
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
}}
<translate>


<!--T:21-->
<!--T:21-->
Line 141: Line 109:
{{TechDraw Tools navi{{#translation:}}}}
{{TechDraw Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 22:07, 24 July 2023

TechDraw PageDefault

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

Description

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

Default template that comes with TechDraw: A4_LandscapeTD.svg

Usage

  1. An active document must exist.
  2. There are several ways to invoke the tool:
    • Press the Insert Default Page button.
    • Select the TechDraw → Page → Insert Default Page option from the menu.

Notes

  • If a Page is marked as "do not keep updated" either through its DataKeep Updated property, through the Toggle Keep Updated option from its window context menu, or by the setting in the 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 view while updating is suspended. This setting also affects the startup process. If a Page is marked as "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 TechDraw PageTemplate.