Difference between revisions of "Draft SVG"
(Marked this version for translation)
(Removed Std_Import.svg and Std_Export.svg)
|Line 22:||Line 22:|
Draft SVG is a software module used by the [[File:Std_Open.svg|24px]] [[Std_Open|Std Open]],
Draft SVG is a software module used by the [[File:Std_Open.svg|24px]] [[Std_Open|Std Open]], [[Std_Import|Std Import]] and [[Std_Export|Std Export]] commands to handle the [[SVG]] file format.
Revision as of 10:48, 6 April 2020
|Introduced in version|
Inkscape drawing exported to SVG, which is subsequently opened in FreeCAD
The following SVG objects can be imported:
- PATH objects
- LINE objects
- RECT objects
- CIRCLE objects
- ELLIPSE objects
- POLYGON objects
- POLYLINE objects
FreeCAD will not import path objects that have only one point (forum discussion).
The following FreeCAD objects can be exported:
- Lines and wires (polylines)
- Arcs and circles
SVG is a 2D format, so all Z information will be disregarded (all objects will be flattened).
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 Inkscape SVG Editor 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.
For more information see: Import Export Preferences.
You can export elements to SVG by using the following function:
import Draft, importSVG Polygon1 = Draft.makePolygon(3, radius=500) Polygon2 = Draft.makePolygon(5, radius=1500) objects = [Polygon1, Polygon2] importSVG.export(objects, "/home/user/Pictures/myfile.svg")