Api - exporter Namespace
Index
Interfaces
- IDXFLayer
Options - IDXFRender
Options - IFlow
Annotation - IJscad
Cag Options - IJscad
Csg Options - IJscad
Extrude Options - IJscad
Script Options - IJson
Export Options - IOpen
JsCad Options - IOpen
JsCad Options Map - IPDFRender
Options - IPath
Data ByLayer Map - ISVGElement
Render Options - ISVGPath
Data Render Options - ISVGRender
Options - IStatus
Callback - svg
Unit Conversion
Variables
Functions
Object literals
Variables
svgUnit
Functions
chainToSVGPathData
pathToSVGPathData
-
Export a path to SVG path data.
Parameters
-
pathToExport: IPath
IPath to export.
-
pathOffset: IPoint
IPoint relative offset of the path object.
-
exportOffset: IPoint
IPoint relative offset point of the export.
-
Optional accuracy: number
Optional accuracy of SVG path data.
-
Optional clockwiseCircle: boolean
Optional flag to use clockwise winding for circles.
Returns string
String of SVG path data.
-
toDXF
-
Renders an item in AutoDesk DFX file format.
Parameters
-
modelToExport: IModel
-
Optional options: IDXFRenderOptions
Rendering options object.
Returns string
String of DXF content.
-
-
Renders an item in AutoDesk DFX file format.
Parameters
-
pathsToExport: IPath[]
-
Optional options: IDXFRenderOptions
Returns string
String of DXF content.
-
-
Renders an item in AutoDesk DFX file format.
Parameters
-
pathToExport: IPath
-
Optional options: IDXFRenderOptions
Returns string
String of DXF content.
-
toJscadCAG
-
Converts a model to a @jscad/csg CAG object - 2D to 2D. See https://en.wikibooks.org/wiki/OpenJSCAD_User_Guide#2D_Paths
Example:
//First, use npm install @jscad/csg from the command line in your jscad project //Create a CAG instance from a model. var { CAG } = require('@jscad/csg'); var model = new makerjs.models.Ellipse(70, 40); var cag = makerjs.exporter.toJscadCAG(CAG, model, {maxArcFacet: 1});
Parameters
-
jscadCAG: typeof CAG
@jscad/csg CAG engine, see https://www.npmjs.com/package/@jscad/csg
-
modelToExport: IModel
Model object to export.
-
Optional jsCadCagOptions: IJscadCagOptions
Returns CAG | object
jscad CAG object in 2D, or a map (keyed by layer id) of jscad CAG objects - if options.byLayers is true.
-
toJscadCSG
-
Converts a model to a @jscad/csg CSG object - 2D to 3D.
Example:
//First, use npm install @jscad/csg from the command line in your jscad project //Create a CSG instance from a model. var { CAG } = require('@jscad/csg'); var model = new makerjs.models.Ellipse(70, 40); var csg = makerjs.exporter.toJscadCSG(CAG, model, {maxArcFacet: 1, extrude: 10});
Parameters
-
jscadCAG: typeof CAG
@jscad/csg CAG engine, see https://www.npmjs.com/package/@jscad/csg
-
modelToExport: IModel
Model object to export.
-
Optional options: IJscadCsgOptions
Optional options object.
Returns CSG
jscad CAG object in 2D, or a map (keyed by layer id) of jscad CAG objects - if options.byLayers is true.
-
toJscadSTL
-
Exports a model in STL format - 2D to 3D.
Parameters
-
CAG: typeof CAG
-
stlSerializer: StlSerializer
@jscad/stl-serializer, see https://www.npmjs.com/package/@jscad/stl-serializer
-
modelToExport: IModel
Model object to export.
-
Optional options: IJscadCsgOptions
Optional options object.
Returns string | ArrayBuffer[]
String in STL ASCII format.
-
toJscadScript
-
Creates a string of JavaScript code for execution with a Jscad environment.
Parameters
-
modelToExport: IModel
Model object to export.
-
Default value options: IJscadScriptOptions = {}
Export options object.
Returns string
String of JavaScript containing a main() function for Jscad.
-
toJson
-
Renders an item in JSON.
Parameters
-
itemToExport: any
Item to render: may be a path, an array of paths, or a model object.
-
Default value options: IJsonExportOptions = {}
Rendering options object.
Returns string
String of DXF content.
-
toPDF
-
Injects drawing into a PDFKit document.
Parameters
-
doc: PDFDocument
PDFKit.PDFDocument object. See https://pdfkit.org/
-
modelToExport: IModel
Model object to export.
-
Optional options: IPDFRenderOptions
Export options object.
Returns void
String of PDF file contents.
-
toSVG
-
Renders an item in SVG markup.
Parameters
-
modelToExport: IModel
-
Optional options: ISVGRenderOptions
Rendering options object.
Returns string
String of XML / SVG content.
-
-
Renders an item in SVG markup.
Parameters
-
pathsToExport: IPath[]
-
Optional options: ISVGRenderOptions
Returns string
String of XML / SVG content.
-
-
Renders an item in SVG markup.
Parameters
-
pathToExport: IPath
-
Optional options: ISVGRenderOptions
Returns string
String of XML / SVG content.
-
toSVGPathData
-
Convert a model to SVG path data.
Parameters
-
modelToExport: IModel
Model to export.
-
Optional options: ISVGPathDataRenderOptions
Optional ISVGPathDataRenderOptions object.
Returns IPathDataByLayerMap | string
String of SVG path data (if options.byLayers is false) or an object map of path data by layer .
-
-
Convert a model to SVG path data.
Parameters
-
modelToExport: IModel
Model to export.
-
Optional byLayers: boolean
Optional boolean flag to return a map of path data by layer.
-
Optional origin: IPoint
Optional origin. Default x = 0, y = topmost y point in the model. Use [0, 0] to use the same origin as Maker.js, which will translate to negative Y values in SVG.
-
Optional accuracy: number
Optional accuracy of SVG decimals.
Returns IPathDataByLayerMap | string
String of SVG path data (if byLayers is false) or an object map of path data by layer .
-
Object literals
colors
Named colors, safe for CSS and DXF 17 colors from https://www.w3.org/TR/CSS21/syndata.html#value-def-color mapped to DXF equivalent AutoDesk Color Index
aqua
black
blue
fuchsia
gray
green
lime
maroon
navy
olive
orange
purple
red
silver
teal
white
yellow
Generated using TypeDoc
Map of MakerJs unit system to SVG unit system