Sandbox:TechDraw template creation tutorial
Topic |
---|
Drafting |
Level |
Beginner |
Time to complete |
(needs assessment) |
Authors |
ThanklessLiving wandererfan |
FreeCAD version |
0.19 |
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 is intended to be a parallel version for wandererfan's template tutorial and because I personally found the guide to be a bit too bare-bones from a beginner standpoint, so the aim of my version is to make a version intended for beginners that includes more information and guidance.
This tutorial assumes you are moderately familiar with Inkscape and SVG, as well as FreeCAD and the TechDraw Workbench.
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/HowToExample.svg
Create base document
1. Open a new document in Inkscape.
2. In Document Properties
- Select page size "US Letter" or "A4" and orientation "landscape".
- Set default units to "mm", and the page size to width "279.4" and height "215.9". For DIN-A4 you would use "210" and "297".
![](/images/thumb/8/87/InkDocProp.png/800px-InkDocProp.png)
Inkscape: document with page size and orientation
3. Use the XML Editor to add a "freecad" namespace clause to the <svg>
item.
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"
Note that your editable texts will not work if you use "https://...", even though the wiki is reached via https these days. Since SVG is a human readable format you could also enter the line above into the file with a text editor.
![](/images/thumb/6/6b/InkXMLNameSpace.png/800px-InkXMLNameSpace.png)
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:
![](/images/thumb/b/b7/InkFinishedArt.png/800px-InkFinishedArt.png)
Inkscape: tentative template layout
Create editable fields
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.
![](/images/thumb/b/b2/InkXMLeditableTag.png/800px-InkXMLeditableTag.png)
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"
![](/images/thumb/a/a9/InkXMLviewBox.png/800px-InkXMLviewBox.png)
Inkscape: XML Editor adjusting the viewbox to match the page size in millimeters
11. Your template will now appear much bigger than desired.
![](/images/thumb/6/6e/InkMuchTooBig.png/800px-InkMuchTooBig.png)
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 W: and H: spinboxes to match your artwork's size in millimeters.
- Set it to the page size less any applicable margins, for example, W: 250, and H: 200.
13. Use "Align and Distribute" or the X: and Y: 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 Shift+Ctrl+g.
16. Select everything on your page, Edit → Select All, and then Edit → Copy (Ctrl+c).
17. Then delete the current layer, Layer → Delete Current Layer.
- Note: if you deleted the layer already (in your layer panel is no layer listed) this step is not required. In that case you should select all (Ctrl+a), cut the selection (Ctrl+x) and paste it with the command in the next step.
18. Then paste, Edit → Paste in Place.
- Note: This command prevents that the text positions are stored in transform tags. It's important that you do not use the normal paste command!
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.
![](/images/d/d8/FCTemplateHow.png)
FreeCAD: finished template with an editable text field being modified
Notes
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.
If you do not see the green boxes for your editable texts, there might be something wrong with your document scale. Open your file in Inkscape again and confirm the values of the viewBox and the sizes are matching.
- 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
![](/images/thumb/9/94/User_hub.png/24px-User_hub.png)
- 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, Assembly, BIM, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub