trimesh.path.exchange.svg_io¶
Functions:
|
Export a Path2D object into an SVG file. |
|
Load an SVG file into a Path2D object. |
|
Convert an SVG transform string to an array of matrices. |
-
trimesh.path.exchange.svg_io.
export_svg
(drawing, return_path=False, layers=None, **kwargs)¶ Export a Path2D object into an SVG file.
- Parameters
drawing (Path2D) – Source geometry
return_path (bool) – If True return only path string not wrapped in XML
layers (None, or [str]) – Only export specified layers
- Returns
as_svg – XML formatted SVG, or path string
- Return type
str
-
trimesh.path.exchange.svg_io.
svg_to_path
(file_obj, file_type=None)¶ Load an SVG file into a Path2D object.
- Parameters
file_obj (open file object) – Contains SVG data
file_type (None) – Not used
- Returns
loaded – With kwargs for Path2D constructor
- Return type
dict
-
trimesh.path.exchange.svg_io.
transform_to_matrices
(transform)¶ Convert an SVG transform string to an array of matrices.
- i.e. “rotate(-10 50 100)
translate(-36 45.5) skewX(40) scale(1 0.5)”
- Parameters
transform (str) – Contains transformation information in SVG form
- Returns
matrices – Multiple transformation matrices from input transform string
- Return type
(n, 3, 3) float