TechDraw TemplateHowTo: Difference between revisions

From FreeCAD Documentation
m (→‎Introduction: spelling background)
(Numbered steps with captions for the figures)
Line 20: Line 20:


<!--T:22-->
<!--T:22-->
We're going to make a simple template for US Letter size paper in landscape orientation. A copy of the result of this HowTo is available in your FreeCAD Template directory (HowToExample.svg).
We're going to make a simple template for US Letter size paper in landscape orientation.

A copy of the result of this tutorial is available in
{{Code|code=
$INSTALL_DIR/Mod/TechDraw/Templates/HowToExample.svg
}}

Where {{incode|$INSTALL_DIR}} is the directory where FreeCAD was installed, for example
{{Code|code=
/usr/share/freecad/Mod/TechDraw/Templates/A4_LandscapeTD.svg
}}


<!--T:23-->
<!--T:23-->
*open a new document in Inkscape
1. Open a new document in Inkscape.

*in Document Properties
2. In Document Properties
**select a page size (US Letter) & orientation (landscape)
**set default units and page size units to mm (279.4 x 215.9)
* Select page size "US Letter" and orientation "landscape".
* Set default units and page size units to mm, 279.4 x 215.9.
[[File:InkDocProp.png|800px|center]]
[[Image:InkDocProp.png|800px|center]]
{{CaptionCenter|Inskcape document with page size and orientation}}
{{clear}}
{{clear}}


*use the XML Editor to add freecad namespace clause to the <svg> item
3. Use the XML Editor to add a "freecad" namespace clause to the {{incode|<svg>}} item.
**xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace "
* <code>xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"</code>.
[[File:InkXMLNameSpace.png|800px|center]]
[[File:InkXMLNameSpace.png|800px|center]]
{{CaptionCenter|Inkscape's XML Editor adding the "freecad" namespace clause to the <svg> item}}
{{clear}}
{{clear}}


*draw outlines, zone numbers, centerlines, etc
4. Draw outlines, zone numbers, center lines, and other geometry.

*draw the boxes and lines for the title block.
5. Draw the boxes and lines for the title block.
*add and position your static text

*add and position your editable text
6. Add and position your static text.
*you now have your finished artwork - something like this:

7. Add and position the text that will be editable.

8. You now have your finished artwork, that should look something like this:
[[File:InkFinishedArt.png|800px|center]]
[[File:InkFinishedArt.png|800px|center]]
{{CaptionCenter|Tentative template layout in Inkscape}}
{{clear}}
{{clear}}


*use the XML Editor to add "freecad:editable" tag to each editable <text> item
9. Use the XML Editor to add a {{incode|freecad:editable}} tag to each editable {{incode|<text>}} item.
**assign a meaningful field name to each editable text
* Assign a meaningful field name to each editable text.
[[File:InkXMLeditableTag.png|800px|center]]
[[File:InkXMLeditableTag.png|800px|center]]
{{CaptionCenter|Inkscape's XML Editor adding the "freecad:editable" property to an editable <text> item}}
{{clear}}
{{clear}}


*use XML editor to adjust viewbox to match your page size in mm
10. Use the XML editor to adjust the viewbox to match your page size in millimeters.
* It is four values, in the format {{incode|[0 0 length height]}}
[[File:InkXMLviewBox.png|800px|center]]
[[File:InkXMLviewBox.png|800px|center]]
{{CaptionCenter|Inkscape's XML Editor adjusting the viewbox to match the page size in millimeters}}
{{clear}}
{{clear}}


*your template will now appear much too big.
11. Your template will now appear much bigger than desired.
[[File:InkMuchTooBig.png|800px|center]]
[[File:InkMuchTooBig.png|800px|center]]
{{CaptionCenter|Tentative template layout in Inkscape exceeding the page size}}
{{clear}}
{{clear}}


*We need to shrink it.
12. We need to shrink it.
**Edit>Select All in All Layers (or box select. make sure you select everything)
* {{MenuCommand|EditSelect All in All Layers}}, or box select and select all.
**adjust the W: and H: spinboxes to match your artwork's size in mm
* Adjust the {{Button|W:}} and {{Button|H:}} spinboxes to match your artwork's size in millimeters.
***page-size less any applicable margins
** Set it to the page size less any applicable margins.

**use "Align and Distribute" or X/Y spinboxes to position artwork on page if required.
13. Use "Align and Distribute" or the {{Button|X:}} and {{Button|Y:}} spinboxes to position the artwork on page if required.
**your template should now look right, just like it did in the finished artwork picture above.

14. Your template should now look right, just like it did in the finished artwork picture above.

15. Ensure that all your editable texts are "ungrouped" with {{KEY|Shift}}+{{KEY|Ctrl}}+{{KEY|g}}.

16. Select everything on your page, {{MenuCommand|Edit → Select All}}, and then {{MenuCommand|Edit → Copy}}.

17. Then delete the current layer, {{MenuCommand|Layer → Delete Current Layer}}.

18. Then paste, {{MenuCommand|Edit → Paste in Place}}.


19. Your template should now look right and shouldn't have any unwanted transforms.
*ensure that all your editable texts are "ungrouped" (shift-ctl-g)
*select everything on your page (box select or Edit>SelectAll) and Edit>Copy
*Layer>Delete Current Layer
*Edit>Paste in Place


20. Save your template.


21. Try it in FreeCAD and [[TechDraw Workbench]] with [[TechDraw New Pick]].
*Your template should now look right and shouldn't have any unwanted transforms
*Save your template
*try it in FreeCAD.
[[File:FCTemplateHow.png|center]]
[[File:FCTemplateHow.png|center]]
{{CaptionCenter|Finished template in FreeCAD with an editable text field being modified}}
{{clear}}
{{clear}}



Revision as of 23:49, 24 November 2018

Tutorial
Topic
Drafting
Level
Intermediate
Time to complete
60 minutes
Authors
wandererfan
FreeCAD version
0.17
Example files
None
See also
None

Introduction

This tutorial shows you how to create an SVG file that can be used as the background template for the TechDraw Workbench pages.

This tutorial assumes you are moderately familiar with Inkscape and SVG, as well as FreeCAD and the TechDraw Workbench.

Steps

We're going to make a simple template for US Letter size paper in landscape orientation.

A copy of the result of this tutorial is available in

$INSTALL_DIR/Mod/TechDraw/Templates/HowToExample.svg

Where $INSTALL_DIR is the directory where FreeCAD was installed, for example

/usr/share/freecad/Mod/TechDraw/Templates/A4_LandscapeTD.svg

1. Open a new document in Inkscape.

2. In Document Properties

  • Select page size "US Letter" and orientation "landscape".
  • Set default units and page size units to mm, 279.4 x 215.9.

Template:CaptionCenter

3. Use the XML Editor to add a "freecad" namespace clause to the <svg> item.

Template:CaptionCenter

4. Draw outlines, zone numbers, center lines, and other geometry.

5. Draw the boxes and lines for the title block.

6. Add and position your static text.

7. Add and position the text that will be editable.

8. You now have your finished artwork, that should look something like this:

Template:CaptionCenter

9. Use the XML Editor to add a freecad:editable tag to each editable <text> item.

  • Assign a meaningful field name to each editable text.

Template:CaptionCenter

10. Use the XML editor to adjust the viewbox to match your page size in millimeters.

  • It is four values, in the format [0 0 length height]

Template:CaptionCenter

11. Your template will now appear much bigger than desired.

Template:CaptionCenter

12. We need to shrink it.

  • Edit → Select All in All Layers, or box select and select all.
  • Adjust the W: and H: spinboxes to match your artwork's size in millimeters.
    • Set it to the page size less any applicable margins.

13. Use "Align and Distribute" or the X: and Y: spinboxes to position the artwork on page if required.

14. Your template should now look right, just like it did in the finished artwork picture above.

15. Ensure that all your editable texts are "ungrouped" with Shift+Ctrl+g.

16. Select everything on your page, Edit → Select All, and then Edit → Copy.

17. Then delete the current layer, Layer → Delete Current Layer.

18. Then paste, Edit → Paste in Place.

19. Your template should now look right and shouldn't have any unwanted transforms.

20. Save your template.

21. Try it in FreeCAD and TechDraw Workbench with TechDraw New Pick.

Template:CaptionCenter

Notes

- Don't use Layers until you've mastered template creation without them. Layers (and Groups) can automatically insert unwanted transforms into your SVG.