Draft SVG

Description
This function imports SVG files as workable Draft Workbench objects.



Opening
The following SVG objects get imported at the moment:
 * PATH objects
 * LINE objects
 * RECT objects
 * CIRCLE objects
 * ELLIPSE objects
 * POLYGON objects
 * POLYLINE objects

Importing
Works the same way as opening but creates the objects in the active document instead of creating a new one.

Exporting
The following objects can be exported in an SVG file:
 * Lines and wires (polylines)
 * Arcs and circles
 * Faces
 * Texts
 * Dimensions

Limitations
Important Note: Keep in mind that SVG is a 2D format, so all Z information will be disregarded (all objects will be flattened).

Preferences
For more information see: Import Export Preferences.

Unit Handling
When exporting, a User Unit (px) equals one millimeter.

When importing, the width, height and viewBox attributes are respected. All elements are scaled to their size in millimeter, which is FreeCAD internal unit. If the SVG does not contain information on its physical size, it is assumed to have 90 DPI resolution. Using absoulte units in attributes inside the SVG should be avoided. Relative units like em,ex and % are currently not supported.

The SVG Editor, Inkscape currently works only with 90 DPI documents. No matter which unit is selected in Inkscape. All the output has to be considered converted to 90 DPI and rounded to 6 decimal places. As FreeCAD (and the SVG standard) is agnostic to the precision of rounding done in Inkscape these values will not be rounded on input. And odd values in millimeter will remain. If you need the SVG import not to be rounded, work on User Units (px) in Inkscape. Scaling can be done after the import to FreeCAD or by changing the width, height and viewbox attributes.

Scripting
Draft API and FreeCAD Scripting Basics.

You can export elements to SVG by using the following function:

Example: