Api - MakerJs Namespace
Index
Namespaces
Classes
Interfaces
- IBezier
Range - IBounding
Hex - ICaption
- ICascade
- ICascade
Model - ICascade
Path - ICascade
Point - IChain
- IChain
Callback - IChain
Link - IChains
Map - ICollection
- ICollection
Key Comparer - ICombine
Options - IContain
Chains Options - IFind
Chains Options - IFind
Loops Options - IIs
Point OnPath Options - IKit
- IMeasure
- IMeasure
Map - IMeasure
Point Inside Options - IMeasure
With Center - IMeta
Parameter - IModel
- IModel
Map - IModel
Path Callback - IPath
- IPath
Arc - IPath
Arc InBezier Curve - IPath
Bezier Seed - IPath
Circle - IPath
Directional - IPath
Intersection - IPath
Intersection Base Options - IPath
Intersection Options - IPath
Line - IPath
Map - IPath
Removed - IPoint
- IPoint
Graph Index Element - IPoint
Match Options - IRef
Model InModel - IRef
Path IdIn Model - IRoute
Offset - ISimplify
Options - ISlope
- IWalk
Model - IWalk
Model Callback - IWalk
Model Cancellable Callback - IWalk
Options - IWalk
Path - IWalk
Path Boolean Callback - IWalk
Path Callback
Variables
Functions
Object literals
Variables
environment
Current execution environment type, should be one of environmentTypes.
version
Version info
Functions
$
-
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.Parameters
-
modelContext: IModel
The initial model to execute functions upon.
Returns ICascadeModel
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.Parameters
-
pathContext: IModel
The initial path to execute functions upon.
Returns ICascadePath
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.Parameters
-
pointContext: IPoint
The initial point to execute functions upon.
Returns ICascadePoint
A new cascade container with ICascadePoint methods.
-
cloneObject
-
Clone an object.
Type parameters
-
T
Parameters
-
objectToClone: T
The object to clone.
Returns T
A new clone of the original object.
-
createRouteKey
-
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
-
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.
-
isChain
-
Test to see if an object implements the required properties of a chain.
Parameters
-
item: any
The item to test.
Returns boolean
-
isFunction
-
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
-
Test to see if an object implements the required properties of a model.
Parameters
-
item: any
Returns boolean
-
isNumber
-
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
-
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
-
Test to see if an object implements the required properties of a path.
Parameters
-
item: any
The item to test.
Returns boolean
-
isPathArc
-
Test to see if an object implements the required properties of an arc.
Parameters
-
item: any
The item to test.
Returns boolean
-
isPathArcInBezierCurve
-
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
-
Test to see if an object implements the required properties of a circle.
Parameters
-
item: any
The item to test.
Returns boolean
-
isPathLine
-
Test to see if an object implements the required properties of a line.
Parameters
-
item: any
The item to test.
Returns boolean
-
isPoint
-
Test to see if an object implements the required properties of a point.
Parameters
-
item: any
The item to test.
Returns boolean
-
round
-
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
Rounded number.
-
splitDecimal
-
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"]
Parameters
-
n: number
The number to split.
Returns string[]
Array of 2 strings when n contains a decimal point, or an array of one string when n is an integer.
-
travel
-
Travel along a route inside of a model to extract a specific node in its tree.
Parameters
-
modelContext: IModel
Model to travel within.
-
route: string | string[]
String of a flattened route, or a string array of route segments.
Returns object
Model or Path object within the modelContext tree.
-
Object literals
environmentTypes
Enumeration of environment types.
BrowserUI
NodeJs
Unknown
WebWorker
pathType
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
BezierSeed
Circle
Line
unitType
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
Foot
Inch
Meter
Millimeter
Generated using TypeDoc
Root module for Maker.js.
Example: get a reference to Maker.js
var makerjs = require('makerjs');