Draft SVG is a software module used by the Std Open, Std Import and Std Export commands to handle the SVG file format.
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.
See also: Draft API and FreeCAD Scripting Basics.
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]
- Temeller: Koordinat, Kısıtlama, Yakalama (Yakın, Extension, Paralel, Izgara, Endpoint, Midpoint, Perpendicular, Angle, Center, Ortho, Intersection, Special, Dimensions, Working plane)
- Çizim: Çizgi, Tel, Çember, Yay, Elips, Çokgen, Dikdörtgen, Metin, Boyut, BSpline, Nokta, Şekil dizesi, Yüz kaplama, Bezier eğrisi, Etiket
- Değiştirme: Move, Rotate, Offset, Trimex, Upgrade, Downgrade, Scale, Edit, Wire to BSpline, Add point, Delete point, Shape 2D View, Draft to Sketch, Array, Path Array, Point Array, Clone, Drawing, Mirror, Stretch
- Araçlar: Set working plane, Finish line, Close line, Undo line, Toggle construction mode, Toggle continue mode, Apply style, Toggle display mode, Add to group, Select group contents, Toggle snap, Toggle grid, Show snap bar, Heal, Flip Dimension, VisGroup, Slope, AutoGroup, Set Working Plane Proxy, Add to Construction group
- Ek: Preferences, Import-Export Preferences (DXF/DWG, SVG, OCA, DAT); Draft API
- Kurulum: Unix, Windows, Mac; Başlamak
- Temeller: About FreeCAD, Workbenches, Preferences, Document structure, Interface Customization, Properties, Mouse Model; Tutorials
- Tezgahlar: Arch, Draft, FEM, Image, Inspection, Mesh, OpenSCAD, Part, PartDesign, Path, Plot, Points, Raytracing, Reverse Engineering, Robot, Ship, Sketcher, Spreadsheet, Start, TechDraw, Surface workbench, Test Framework, Web
- Scripting: Introduction to Python, FreeCAD scripting tutorial, FreeCAD Scripting Basics, How to install macros, Gui Command, Units Modules: Builtin modules, Workbench creation, Installing more workbenches Meshes: Mesh Scripting, Mesh Module Parts: The Part Module, Topological data scripting, PythonOCC, Mesh to Part Coin scenegraph: The Coin/Inventor scenegraph, Pivy Qt interface: PySide, Using the FreeCAD GUI, Dialog creation Parametric objects: Scripted objects Other: Code snippets, Line drawing function, Embedding FreeCAD, FreeCAD vector math library, Power users hub, Python, Macros, FreeCAD Scripting Basics, Topological data scripting