|Time to complete|
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 is the directory where FreeCAD was installed, for example
Create base document
1. Open a new document in Inkscape.
2. In Document Properties
- Select page size "US Letter" and orientation "landscape".
- Set default units to "mm", and the page size to width "279.4" and height "215.9".
Inskcape: document with page size and orientation
3. Use the XML Editor to add a "freecad" namespace clause to the
Inkscape: XML Editor adding the "freecad" namespace clause to the <svg> item
Create template drawing
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:
Inkscape: tentative template layout
Create editable fields
9. Use the XML Editor to add a
freecad:editable tag to each editable
- Assign a meaningful field name to each editable text.
Inkscape: XML Editor adding the "freecad:editable" property to the desired <text> item
Adjust size of the SVG
10. Use the XML editor to adjust the
viewBox attribute to match your page size in millimeters.
- It is four values, in the format
"0 0 width height"
Inkscape: XML Editor adjusting the viewbox to match the page size in millimeters
11. Your template will now appear much bigger than desired.
Inkscape: tentative template layout exceeding the page size
12. We need to shrink it.
- Edit → Select All in All Layers, or box select and select all.
- Adjust the and spinboxes to match your artwork's size in millimeters.
- Set it to the page size less any applicable margins, for example, , and .
13. Use "Align and Distribute" or theand spinboxes to position the artwork within the limits of the page if required.
14. Your template should now look right, just like it did in the finished artwork picture above.
Remove transformans on the SVG
15. Ensure that all your editable texts are "ungrouped" with+ + .
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.
FreeCAD: finished template with an editable text field being modified
Don't use Layers in Inkscape until you've mastered template creation without them. Layers and Groups can automatically insert unwanted transforms into your SVG file.
As a final step before using your new template, make sure to remove any transform clauses from the Svg code. Transform clauses will cause problems.
See a Stackoverflow discussion on removing transform clauses in SVG files.