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 - MakerJs Module

Root module for Maker.js.

Example: get a reference to Maker.js

var makerjs = require('makerjs');

Index

Variables

Private clone

clone: any

version

version: string

Version info

Private x

Functions

cloneObject

  • cloneObject<T>(objectToClone: T): T
  • Clone an object.

    Type parameters

    • T

    Parameters

    • objectToClone: T

      The object to clone.

    Returns T

    A new clone of the original object.

createRouteKey

  • createRouteKey(route: string[]): string
  • Create a string representation of a route array.

    Parameters

    • route: string[]

      Array of strings which are segments of a route.

    Returns string

    String of the flattened array.

extendObject

  • extendObject(target: Object, other: Object): Object
  • Copy the properties from one object to another object.

    Example:

    makerjs.extendObject({ abc: 123 }, { xyz: 789 }); //returns { abc: 123, xyz: 789 }
    

    Parameters

    • target: Object

      The object to extend. It will receive the new properties.

    • other: Object

      An object containing properties to merge in.

    Returns Object

    The original object after merging.

Private hasNamedProperty

  • hasNamedProperty(p: IPath, value: any): boolean

isFunction

  • isFunction(value: any): boolean
  • Test to see if a variable is a function.

    Parameters

    • value: any

      The object to test.

    Returns boolean

    True if the object is a function type.

isModel

  • isModel(item: any): boolean
  • Test to see if an object implements the required properties of a model.

    Parameters

    • item: any

    Returns boolean

isNumber

  • isNumber(value: any): boolean
  • Test to see if a variable is a number.

    Parameters

    • value: any

      The object to test.

    Returns boolean

    True if the object is a number type.

isObject

  • isObject(value: any): boolean
  • Test to see if a variable is an object.

    Parameters

    • value: any

      The object to test.

    Returns boolean

    True if the object is an object type.

isPath

  • isPath(item: any): boolean
  • Test to see if an object implements the required properties of a path.

    Parameters

    • item: any

      The item to test.

    Returns boolean

isPathArc

  • isPathArc(item: any): boolean
  • Test to see if an object implements the required properties of an arc.

    Parameters

    • item: any

      The item to test.

    Returns boolean

isPathArcInBezierCurve

  • isPathArcInBezierCurve(item: any): boolean
  • Test to see if an object implements the required properties of an arc in a bezier curve.

    Parameters

    • item: any

      The item to test.

    Returns boolean

isPathCircle

  • isPathCircle(item: any): boolean
  • Test to see if an object implements the required properties of a circle.

    Parameters

    • item: any

      The item to test.

    Returns boolean

isPathLine

  • isPathLine(item: any): boolean
  • Test to see if an object implements the required properties of a line.

    Parameters

    • item: any

      The item to test.

    Returns boolean

isPoint

  • isPoint(item: any): boolean
  • Test to see if an object implements the required properties of a point.

    Parameters

    • item: any

      The item to test.

    Returns boolean

Private reflectName

  • reflectName(value?: any): any

round

  • round(n: number, accuracy?: number): number
  • Numeric rounding

    Example: round to 3 decimal places

    makerjs.round(3.14159, .001); //returns 3.142
    

    Parameters

    • n: number

      The number to round off.

    • Default value accuracy: number = 1e-7

      Optional exemplar of number of decimal places.

    Returns number

Object literals

pathType

pathType: object

String-based enumeration of all paths types.

Examples: use pathType instead of string literal when creating a circle.

var circle: IPathCircle = { type: pathType.Circle, origin: [0, 0], radius: 7 };   //typescript
var circle = { type: pathType.Circle, origin: [0, 0], radius: 7 };   //javascript

Arc

Arc: string

BezierSeed

BezierSeed: string

Circle

Circle: string

Line

Line: string

unitType

unitType: object

String-based enumeration of unit types: imperial, metric or otherwise. A model may specify the unit system it is using, if any. When importing a model, it may have different units. Unit conversion function is makerjs.units.conversionScale(). Important: If you add to this, you must also add a corresponding conversion ratio in the unit.ts file!

Centimeter

Centimeter: string

Foot

Foot: string

Inch

Inch: string

Meter

Meter: string

Millimeter

Millimeter: string

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