--- layout: posts title: Api - MakerJs Namespace ---
Current execution environment type, should be one of environmentTypes.
Version info
Create a container to cascade a series of functions upon a model. This allows JQuery-style method chaining, e.g.:
makerjs.$(shape).center().rotate(45).$result
The output of each function call becomes the first parameter input to the next function call.
The returned value of the last function call is available via the .$result property.
The initial model to execute functions upon.
A new cascade container with ICascadeModel methods.
Create a container to cascade a series of functions upon a path. This allows JQuery-style method chaining, e.g.:
makerjs.$(path).center().rotate(90).$result
The output of each function call becomes the first parameter input to the next function call.
The returned value of the last function call is available via the .$result property.
The initial path to execute functions upon.
A new cascade container with ICascadePath methods.
Create a container to cascade a series of functions upon a point. This allows JQuery-style method chaining, e.g.:
makerjs.$([1,0]).scale(5).rotate(60).$result
The output of each function call becomes the first parameter input to the next function call.
The returned value of the last function call is available via the .$result property.
The initial point to execute functions upon.
A new cascade container with ICascadePoint methods.
Clone an object.
The object to clone.
A new clone of the original object.
Create a string representation of a route array.
Array of strings which are segments of a route.
String of the flattened array.
Copy the properties from one object to another object.
Example:
makerjs.extendObject({ abc: 123 }, { xyz: 789 }); //returns { abc: 123, xyz: 789 }
The object to extend. It will receive the new properties.
An object containing properties to merge in.
The original object after merging.
Test to see if an object implements the required properties of a chain.
The item to test.
Test to see if a variable is a function.
The object to test.
True if the object is a function type.
Test to see if an object implements the required properties of a model.
Test to see if a variable is a number.
The object to test.
True if the object is a number type.
Test to see if a variable is an object.
The object to test.
True if the object is an object type.
Test to see if an object implements the required properties of a path.
The item to test.
Test to see if an object implements the required properties of an arc.
The item to test.
Test to see if an object implements the required properties of an arc in a bezier curve.
The item to test.
Test to see if an object implements the required properties of a circle.
The item to test.
Test to see if an object implements the required properties of a line.
The item to test.
Test to see if an object implements the required properties of a point.
The item to test.
Numeric rounding
Example: round to 3 decimal places
makerjs.round(3.14159, .001); //returns 3.142
The number to round off.
Optional exemplar of number of decimal places.
Rounded number.
Split a decimal into its whole and fractional parts as strings.
Example: get whole and fractional parts of 42.056
makerjs.splitDecimal(42.056); //returns ["42", "056"]
The number to split.
Array of 2 strings when n contains a decimal point, or an array of one string when n is an integer.
Travel along a route inside of a model to extract a specific node in its tree.
Model to travel within.
String of a flattened route, or a string array of route segments.
Model or Path object within the modelContext tree.
Enumeration of environment types.
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
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!
Generated using TypeDoc
Root module for Maker.js.
Example: get a reference to Maker.js
var makerjs = require('makerjs');