--- layout: posts title: Api - model Namespace ---
Add a model as a child. This is basically equivalent to:
parentModel.models[childModelId] = childModel;
with additional checks to make it safe for cascading.
The model to add to.
The model to add.
The id of the child model.
Optional flag to overwrite any model referenced by childModelId. Default is false, which will create an id similar to childModelId.
The original model (for cascading).
Add a path as a child. This is basically equivalent to:
parentModel.paths[childPathId] = childPath;
with additional checks to make it safe for cascading.
The model to add to.
The path to add.
The id of the path.
Optional flag to overwrite any path referenced by pathId. Default is false, which will create an id similar to pathId.
The original model (for cascading).
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.
The model to add.
The model to add to.
The id of the child model.
Optional flag to overwrite any model referenced by childModelId. Default is false, which will create an id similar to childModelId.
The original model (for cascading).
DEPRECATED Break a model's paths everywhere they intersect with another path.
The model containing paths to be broken.
Optional model containing paths to look for intersection, or else the modelToBreak will be used.
The original model (for cascading).
Center a model at [0, 0].
The model to center.
Boolean to center on the x axis. Default is true.
Boolean to center on the y axis. Default is true.
The original model (for cascading).
Combine 2 models. Each model will be modified accordingly.
First model to combine.
Second model to combine.
Flag to include paths from modelA which are inside of modelB.
Flag to include paths from modelA which are outside of modelB.
Flag to include paths from modelB which are inside of modelA.
Flag to include paths from modelB which are outside of modelA.
Optional ICombineOptions object.
A new model containing both of the input models as "a" and "b".
Count the number of child models within a given model.
The model containing other models.
Number of child models.
Create a distorted copy of a model - scale x and y individually.
The model to distort.
The amount of x scaling.
The amount of y scaling.
Optional boolean to scale the origin point. Typically false for the root model.
Optional accuracy of Bezier curves.
New model (for cascading).
Expand all paths in a model, then combine the resulting expansions.
Model to expand.
Distance to expand.
Number of points at a joint between paths. Use 0 for round joints, 1 for pointed joints, 2 for beveled joints.
Optional object containing combine options.
Model which surrounds the paths of the original model.
Find paths that have common endpoints and form chains.
The model to search for chains.
Optional options object.
An array of chains, or a map (keyed by layer id) of arrays of chains - if options.byLayers is true.
Find paths that have common endpoints and form chains.
The model to search for chains.
Callback function when chains are found.
Optional options object.
An array of chains, or a map (keyed by layer id) of arrays of chains - if options.byLayers is true.
Gets all Caption objects, in absolute position, in this model and its children.
The model to search for Caption objects.
Array of Caption objects.
Get an unused id in the models map with the same prefix.
The model containing the models map.
The id to use directly (if unused), or as a prefix.
Get an unused id in the paths map with the same prefix.
The model containing the paths map.
The id to use directly (if unused), or as a prefix.
DEPRECATED - use measure.isPointInsideModel instead. Check to see if a path is inside of a model.
The path to check.
The model to check against.
Optional point of reference which is outside the bounds of the modelContext.
Boolean true if the path is inside of the modelContext.
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.
The model to originate.
Optional offset reference point.
The original model (for cascading).
Outline a model by a specified distance. Useful for accommodating for kerf.
Model to outline.
Distance to outline.
Number of points at a joint between paths. Use 0 for round joints, 1 for pointed joints, 2 for beveled joints.
Optional boolean to draw lines inside the model instead of outside.
Options to send to combine() function.
Model which surrounds the paths outside of the original model.
Remove paths from a model which have endpoints that do not connect to other paths.
The model to search for dead ends.
Optional max distance to consider two points as the same.
Optional callback function (which should return a boolean) to decide if a dead end path should be kept instead.
Optional callback function which will log discarded paths and the reason they were discarded.
The input model (for cascading).
Simplify a model's paths by reducing redundancy: combine multiple overlapping paths into a single path. The model must be originated.
Optional options object.
The simplified model (for cascading).
Recursively walk through all child models and paths for a given model.
The model to walk.
Object containing callbacks.
The original model (for cascading).
DEPRECATED - use model.walk instead. Recursively walk through all paths for a given model.
The model to walk.
Callback for each path.
Move a model so its bounding box begins at [0, 0].
The model to zero.
Boolean to zero on the x axis. Default is true.
Boolean to zero on the y axis. Default is true.
The original model (for cascading).
Generated using TypeDoc
Add a Caption object to a model.