Api  ICascadeModel Interface
Hierarchy

ICascade
 ICascadeModel
Index
Properties
Methods
Properties
$initial
$reset
Use the $original as the $result.
Type declaration


Returns this

$result
The current final value of the cascade.
Methods
addCaption

Add a Caption object to a model.
Parameters

text: string
Text to add.

Optional leftAnchorPoint: IPoint
Optional Point on left side middle of text.

Optional rightAnchorPoint: IPoint
Optional Point on right side middle of text.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

addModel

Add a model as a child. This is basically equivalent to:
parentModel.models[childModelId] = childModel;
with additional checks to make it safe for cascading.
Parameters

childModel: IModel
The model to add.

childModelId: string
The id of the child model.

Optional overWrite: boolean
(default false) Optional flag to overwrite any model referenced by childModelId. Default is false, which will create an id similar to childModelId.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

addPath

Add a path as a child. This is basically equivalent to:
parentModel.paths[childPathId] = childPath;
with additional checks to make it safe for cascading.
Parameters

pathContext: IPath
The path to add.

pathId: string
The id of the path.

Optional overWrite: boolean
(default false) Optional flag to overwrite any path referenced by pathId. Default is false, which will create an id similar to pathId.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

addTo

Add a model as a child of another model. This is basically equivalent to:
parentModel.models[childModelId] = childModel;
with additional checks to make it safe for cascading.
Parameters

parentModel: IModel
The model to add to.

childModelId: string
The id of the child model.

Optional overWrite: boolean
(default false) Optional flag to overwrite any model referenced by childModelId. Default is false, which will create an id similar to childModelId.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

breakPathsAtIntersections

DEPRECATED Break a model's paths everywhere they intersect with another path.
Parameters

Optional modelToIntersect: IModel
Optional model containing paths to look for intersection, or else the modelToBreak will be used.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

center

Center a model at [0, 0].
Parameters

Optional centerX: boolean
(default true) Boolean to center on the x axis. Default is true.

Optional centerY: boolean
(default true) Boolean to center on the y axis. Default is true.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

clone

Clone a model. Alias of makerjs.cloneObject(modelToClone)
Returns ICascadeModel
this cascade container, this.$result will be A clone of the model you passed.
combine

Combine 2 models. Each model will be modified accordingly.
Parameters

modelB: IModel
Second model to combine.

Optional includeAInsideB: boolean
(default false) Flag to include paths from modelA which are inside of modelB.

Optional includeAOutsideB: boolean
(default true) Flag to include paths from modelA which are outside of modelB.

Optional includeBInsideA: boolean
(default false) Flag to include paths from modelB which are inside of modelA.

Optional includeBOutsideA: boolean
(default true) Flag to include paths from modelB which are outside of modelA.

Optional options: ICombineOptions
Optional ICombineOptions object.
Returns ICascadeModel
this cascade container, this.$result will be A new model containing both of the input models as "a" and "b".

combineIntersection

Combine 2 models, resulting in a intersection. Each model will be modified accordingly.
Parameters

modelB: IModel
Second model to combine.
Returns ICascadeModel
this cascade container, this.$result will be A new model containing both of the input models as "a" and "b".

combineSubtraction

Combine 2 models, resulting in a subtraction of B from A. Each model will be modified accordingly.
Parameters

modelB: IModel
Second model to combine.
Returns ICascadeModel
this cascade container, this.$result will be A new model containing both of the input models as "a" and "b".

combineUnion

Combine 2 models, resulting in a union. Each model will be modified accordingly.
Parameters

modelB: IModel
Second model to combine.
Returns ICascadeModel
this cascade container, this.$result will be A new model containing both of the input models as "a" and "b".

convertUnits

Convert a model to match a different unit system.
Parameters

destUnitType: string
The unit system.
Returns ICascadeModel
this cascade container, this.$result will be The scaled model (for cascading).

distort

Create a distorted copy of a model  scale x and y individually.
Parameters

scaleX: number
The amount of x scaling.

scaleY: number
The amount of y scaling.

Optional scaleOrigin: boolean
(default false) Optional boolean to scale the origin point. Typically false for the root model.

Optional bezierAccuracy: number
Optional accuracy of Bezier curves.
Returns ICascadeModel
this cascade container, this.$result will be New model (for cascading).

expandPaths

Expand all paths in a model, then combine the resulting expansions.
Parameters

distance: number
Distance to expand.

Optional joints: number
(default 0) Number of points at a joint between paths. Use 0 for round joints, 1 for pointed joints, 2 for beveled joints.

Optional combineOptions: ICombineOptions
(default {}) Optional object containing combine options.
Returns ICascadeModel
this cascade container, this.$result will be Model which surrounds the paths of the original model.

layer

Set the layer of a model. This is equivalent to:
modelContext.layer = layer;
Parameters

layer: string
The layer name.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

mirror

Create a clone of a model, mirrored on either or both x and y axes.
Parameters

mirrorX: boolean
Boolean to mirror on the x axis.

mirrorY: boolean
Boolean to mirror on the y axis.
Returns ICascadeModel
this cascade container, this.$result will be Mirrored model.

move

Move a model to an absolute point. Note that this is also accomplished by directly setting the origin property. This function exists for cascading.
Parameters

origin: IPoint
The new position of the model.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

moveRelative

Move a model's origin by a relative amount.
Parameters

delta: IPoint
The x & y adjustments as a point object.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

originate

Moves all of a model's children (models and paths, recursively) in reference to a single common origin. Useful when points between children need to connect to each other.
Parameters

Optional origin: IPoint
Optional offset reference point.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

outline

Outline a model by a specified distance. Useful for accommodating for kerf.
Parameters

distance: number
Distance to outline.

Optional joints: number
(default 0) Number of points at a joint between paths. Use 0 for round joints, 1 for pointed joints, 2 for beveled joints.

Optional inside: boolean
(default false) Optional boolean to draw lines inside the model instead of outside.

Optional options: ICombineOptions
(default {}) Options to send to combine() function.
Returns ICascadeModel
this cascade container, this.$result will be Model which surrounds the paths outside of the original model.

prefixPathIds

Prefix the ids of paths in a model.
Parameters

prefix: string
The prefix to prepend on paths ids.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

removeDeadEnds

Remove paths from a model which have endpoints that do not connect to other paths.
Parameters

Optional pointMatchingDistance: number
Optional max distance to consider two points as the same.

Optional keep: IWalkPathBooleanCallback
Optional callback function (which should return a boolean) to decide if a dead end path should be kept instead.

Optional trackDeleted: undefined
Optional callback function which will log discarded paths and the reason they were discarded.
Returns ICascadeModel
this cascade container, this.$result will be The input model (for cascading).

rotate

Rotate a model.
Parameters

angleInDegrees: number
The amount of rotation, in degrees.

Optional rotationOrigin: IPoint
(default [0, 0]) The center point of rotation.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

scale

Scale a model.
Parameters

scaleValue: number
The amount of scaling.

Optional scaleOrigin: boolean
(default false) Optional boolean to scale the origin point. Typically false for the root model.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

simplify

Simplify a model's paths by reducing redundancy: combine multiple overlapping paths into a single path. The model must be originated.
Parameters

Optional options: ISimplifyOptions
Optional options object.
Returns ICascadeModel
this cascade container, this.$result will be The simplified model (for cascading).

walk

Recursively walk through all child models and paths for a given model.
Parameters

options: IWalkOptions
Object containing callbacks.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

zero

Move a model so its bounding box begins at [0, 0].
Parameters

Optional zeroX: boolean
(default true) Boolean to zero on the x axis. Default is true.

Optional zeroY: boolean
(default true) Boolean to zero on the y axis. Default is true.
Returns ICascadeModel
this cascade container, this.$result will be The original model (for cascading).

Generated using TypeDoc
The initial context object of the cascade.