SVGMeshReader

From K-3D

Jump to: navigation, search

Description

Reader that loads external Scalable Vector Graphics (.svg) files into the document by reference
Plugin Status:Experimental
Categories:All Plugins, Experimental Plugins, MeshReader Plugins

Metadata

Name Value

Properties

Label Description Type Script Name
File Input file path. k3d::filesystem::path file
Center on Origin Center the output mesh around the origin. k3d::bool_t center
Scale to Size Scale the output mesh to fit within a fixed-size bounding-box. k3d::bool_t scale_to_size
Size Output mesh size when "Scale to Size" is enabled. k3d::double_t size
Output Mesh Output mesh k3d::mesh* output_mesh
Surface Material Surface material k3d::inode* material


Description

MeshReader plug-in which is able to load the basic geometry of a Scalable Vector Graphics(SVG) file.

What this plug-in support

Note that supported primitives don't take into account material nor style.

  • Groups: Traverse the tree collecting data from nodes maintaining proper hierarchy (even if they don't have geometry).
  • Transformations: Object transformations and nested transformations using groups (rotation, translation, scaling, skewing, custom matrix).
  • Rectangles and rounded corner rectangles. <rectange />
  • Ellipses and circles <ellipse /> <circle />
  • Simple lines <line />
  • Polylines <polyline />
  • Paths <path /> which encloses:
    • line segments
    • Cubic Bezier curves
    • Quadratic Bezier curves
    • Arcs (still buggy and on development)
    • Closing path

What this plug-in don't support yet

The list below presents some of the main features we didn't incorporate into the plug-in, and the main reason most of them are not included is that probably they don't need to be implemented for the purpose of the plug-in yet and other features will be implemented on a second iteration:

  • Styles
  • Text
  • Painting (Filling, stroking, etc...)
  • Color
  • Filter effects
  • Animation
  • Scripting

How to use it

This is a document plug-in type. It can be loaded from the Create submenu on the top menubar. To load a SVG simply create a SVGMeshReader node

Create->MeshReader->SVGMeshReader

On the node properties panel there is a property called File, click on the browse button on the right and browse for the SVG file you want to load. Once this is done the file should be seen on the Viewport. Please note that due to differences in the coordinate systems, the geometry might not be seen at first, this might be because either the geometry is too small or too big so try zooming in or out until you see the loaded geometry.

Pointer to test

Pending...

Link to further reading

SVG documentation

ToDo

  • Fix the arc routine.
  • Add an automatic scaling mechanism to adjust geometry to k3d dimensions.
  • Eliminate path cross-over error shown here.