Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - exporter Namespace

Index

Variables

svgUnit

Map of MakerJs unit system to SVG unit system

Functions

chainToSVGPathData

  • chainToSVGPathData(chain: IChain, offset: IPoint, accuracy?: number): string
  • Convert a chain to SVG path data.

    Parameters

    • chain: IChain

      Chain to convert.

    • offset: IPoint

      IPoint relative offset point.

    • Optional accuracy: number

      Optional accuracy of SVG path data.

    Returns string

    String of SVG path data.

pathToSVGPathData

  • pathToSVGPathData(pathToExport: IPath, pathOffset: IPoint, exportOffset: IPoint, accuracy?: number, clockwiseCircle?: boolean): string
  • 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

toJscadCAG

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

    Returns CSG

    jscad CAG object in 2D, or a map (keyed by layer id) of jscad CAG objects - if options.byLayers is true.

toJscadSTL

  • toJscadSTL(CAG: typeof CAG, stlSerializer: StlSerializer, modelToExport: IModel, options?: IJscadCsgOptions): string | ArrayBuffer[]

toJscadScript

toJson

toPDF

toSVG

toSVGPathData

  • Convert a model to SVG path data.

    Parameters

    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

colors: object

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

aqua: number

black

black: number

blue

blue: number

fuchsia

fuchsia: number

gray

gray: number

green

green: number

lime

lime: number

maroon

maroon: number

navy

navy: number

olive

olive: number

orange

orange: number

purple

purple: number

red

red: number

silver

silver: number

teal

teal: number

white

white: number

yellow

yellow: number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc