Exporting
SVG
DXF
Simple export
Call makerjs.exporter.toDXF(model)
passing your model. This function returns a string of DXF.
If your drawing has layers with names that match the following reserved color names,
paths on that layer will have a stroke color automatically:
aqua, black, blue, fuchsia, green, gray, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow
Captions
A caption will inherit the layerOptions
that are applied to its model's layer name unless overridden by the anchor layer.
Advanced options
You may override the default export behavior by calling makerjs.exporter.toDXF(model, options)
and passing an options object.
The options object has these properties:
property | values / effects | ||||||
---|---|---|---|---|---|---|---|
units | Maker.js unit type - unit system (default: extracted from drawing. If unit system is not in drawing or not passed, it will use DXF default of inches) | ||||||
fontSize |
number - font size of captions (default: 9). The font size is in the same unit system as the units property.
|
||||||
layerOptions |
object map - keys are the layer names, values are an object with these properties:
|
OpenJScad
Simple export
Call makerjs.exporter.toOpenJsCad(model)
passing your model.
This function returns a string of JavaScript code executable within an OpenJsCad environment.
Advanced options
Call makerjs.exporter.toOpenJsCad(model, options)
passing your model and an options object.
Simple export
Call
makerjs.exporter.toSVG(model)
passing your model. This function returns a string of SVG.If your drawing has layers with names that match the following reserved color names, paths on that layer will have a stroke color automatically:
aqua, black, blue, fuchsia, green, gray, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow
Captions
Captions are added to an SVG group with a layer name of "captions". This layer name may be used to apply
layerOptions
that are common to all captions. In addition, a caption will inherit thelayerOptions
that are applied to its model's layer name unless overridden by the anchor layer.Advanced options
There are two main modes of SVG export: Path-only mode and Separate mode. Path-only mode is the default.
In Path-only mode, the SVG structure will have only one SVG
<path>
element per layer. (If you do not specify layers then you have one "null" layer). This SVG<path>
element will contain all of your model's path data. If your drawing contained any closed geometries from endless chains, you will be able to use SVG fill on these shapes.In Separate mode, every model in your heirarchy is exported as an SVG
<g>
element containing that model's paths, each exported as an individual SVG element. Lines will export as an SVG<line>
element, circles will export as an SVG<circle>
element, and arcs will export as an SVG<path>
element. Child models will become nested<g>
elements. You will not be able to use SVG fill in any satisfactory way.You may override the default export behavior by calling
makerjs.exporter.toSVG(model, options)
and passing an options object. The options object has these properties:<text>
elements with the path id