Api - path Namespace
Index
Functions
addTo
-
Parameters
-
childPath: IPath
The path to add.
-
parentModel: IModel
The model to add to.
-
pathId: string
The id of the path.
-
Default value overwrite: boolean = false
Optional flag to overwrite any path referenced by pathId. Default is false, which will create an id similar to pathId.
Returns IPath
The original path (for cascading).
-
alterLength
-
Alter a path by lengthening or shortening it.
Parameters
-
pathToAlter: IPath
Path to alter.
-
distance: number
Numeric amount of length to add or remove from the path. Use a positive number to lengthen, negative to shorten. When shortening: this function will not alter the path and will return null if the resulting path length is less than or equal to zero.
-
Default value useOrigin: boolean = false
Optional flag to alter from the origin instead of the end of the path.
Returns IPath
The original path (for cascading), or null if the path could not be altered.
-
breakAtPoint
-
Breaks a path in two. The supplied path will end at the supplied pointOfBreak, a new path is returned which begins at the pointOfBreak and ends at the supplied path's initial end point. For Circle, the original path will be converted in place to an Arc, and null is returned.
Parameters
Returns IPath
A new path of the same type, when path type is line or arc. Returns null for circle.
center
clone
converge
-
Connect 2 lines at their slope intersection point.
Parameters
-
lineA: IPathLine
First line to converge.
-
lineB: IPathLine
Second line to converge.
-
Optional useOriginA: boolean
Optional flag to converge the origin point of lineA instead of the end point.
-
Optional useOriginB: boolean
Optional flag to converge the origin point of lineB instead of the end point.
Returns IPoint
point of convergence.
-
copyProps
distort
dogbone
-
Adds a round corner to the outside angle between 2 lines. The lines must meet at one point.
Parameters
-
lineA: IPathLine
First line to fillet, which will be modified to fit the fillet.
-
lineB: IPathLine
Second line to fillet, which will be modified to fit the fillet.
-
filletRadius: number
-
Optional options: IPointMatchOptions
Returns IPathArc
Arc path object of the new fillet.
-
expand
fillet
-
Adds a round corner to the inside angle between 2 paths. The paths must meet at one point.
Parameters
-
pathA: IPath
First path to fillet, which will be modified to fit the fillet.
-
pathB: IPath
Second path to fillet, which will be modified to fit the fillet.
-
filletRadius: number
Radius of the fillet.
-
Optional options: IPointMatchOptions
Optional IPointMatchOptions object to specify pointMatchingDistance.
Returns IPathArc
Arc path object of the new fillet.
-
intersection
-
Find the point(s) where 2 paths intersect.
Parameters
-
path1: IPath
First path to find intersection.
-
path2: IPath
Second path to find intersection.
-
Default value options: IPathIntersectionOptions = {}
Optional IPathIntersectionOptions.
Returns IPathIntersection
IPathIntersection object, with points(s) of intersection (and angles, when a path is an arc or circle); or null if the paths did not intersect.
-
layer
mirror
move
moveRelative
moveTemporary
-
Move some paths relatively during a task execution, then unmove them.
Parameters
-
pathsToMove: IPath[]
The paths to move.
-
deltas: IPoint[]
The x & y adjustments as a point object array.
-
task: Function
The function to call while the paths are temporarily moved.
Returns void
-
rotate
scale
straighten
-
Represent an arc using straight lines.
Parameters
-
arc: IPathArc
Arc to straighten.
-
Optional bevel: boolean
Optional flag to bevel the angle to prevent it from being too sharp.
-
Optional prefix: string
Optional string prefix to apply to path ids.
-
Optional close: boolean
Optional flag to make a closed geometry by connecting the endpoints.
Returns IModel
Model of straight lines with same endpoints as the arc.
-
toKeyPoints
-
Get key points (a minimal a number of points) along a path.
Parameters
-
pathContext: IPath
Path to get points from.
-
Optional maxArcFacet: number
Optional maximum length between points on an arc or circle.
Returns IPoint[]
Array of points which are on the path.
-
toPoints
-
Get points along a path.
Parameters
-
pathContext: IPath
Path to get points from.
-
numberOfPoints: number
Number of points to divide the path.
Returns IPoint[]
Array of points which are on the path spread at a uniform interval.
-
zero
Generated using TypeDoc
Add a path to a model. This is basically equivalent to:
parentModel.paths[pathId] = childPath;
with additional checks to make it safe for cascading.