Files
modeling-app/docs/kcl/std.md
Adam Chalmers 9d40f282a8 Remove just one enum (#1096)
# Problem

This is my proposal for fixing #1107 . I've only done it for one stdlib function, `tangentialArcTo` -- if y'all like it, I'll apply this idea to the rest of the stdlib.

Previously, if users want to put a tag on the arc, the function's parameters change type.

```
// Tag missing: first param is array
tangentialArcTo([x, y], %)
// Tag present: first param is object
tangentialArcTo({to: [x, y], tag: "myTag"}, %)
```

# Solution

My proposal in #1006 is that KCL should have optional values. This means we can change the stdlib `tangentialArcTo` function to use them. In this PR, the calls are now like

```
// Tag missing: first param is array
tangentialArcTo([x, y], %)
// Tag present: first param is array still, but we now pass a tag at the end.
tangentialArcTo([x, y], %, "myTag")
```

This adds an "option" type to KCL typesystem, but it's not really revealed to users (no KCL types are revealed to users right now, they write untyped code and only interact with types when they get type errors upon executing programs). Also adds a None type, which is the default case of the Optional enum.
2023-12-18 23:49:32 -06:00

77 KiB
Raw Blame History

KCL Standard Library

Table of Contents

Functions

abs

Computes the absolute value of a number.

abs(num: number) -> number

Arguments

  • num: number

Returns

  • number

acos

Computes the arccosine of a number (in radians).

acos(num: number) -> number

Arguments

  • num: number

Returns

  • number

angleToMatchLengthX

Returns the angle to match the given length for x.

angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • to: number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

angleToMatchLengthY

Returns the angle to match the given length for y.

angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • to: number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

angledLine

Draw an angled line.

angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineData - Data to draw an angled line.
{
	// The angle of the line.
	angle: number,
	// The length of the line.
	length: number,
	// The tag.
	tag: string,
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

angledLineOfXLength

Draw an angled line of a given x length.

angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineData - Data to draw an angled line.
{
	// The angle of the line.
	angle: number,
	// The length of the line.
	length: number,
	// The tag.
	tag: string,
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

angledLineOfYLength

Draw an angled line of a given y length.

angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineData - Data to draw an angled line.
{
	// The angle of the line.
	angle: number,
	// The length of the line.
	length: number,
	// The tag.
	tag: string,
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

angledLineThatIntersects

Draw an angled line that intersects with a given line.

angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineThatIntersectsData - Data for drawing an angled line that intersects with a given line.
{
	// The angle of the line.
	angle: number,
	// The tag of the line to intersect with.
	intersectTag: string,
	// The offset from the intersecting line.
	offset: number,
	// The tag.
	tag: string,
}
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

angledLineToX

Draw an angled line to a given x coordinate.

angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineToData - Data to draw an angled line to a point.
{
	// The angle of the line.
	angle: number,
	// The tag.
	tag: string,
	// The point to draw to.
	to: number,
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

angledLineToY

Draw an angled line to a given y coordinate.

angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AngledLineToData - Data to draw an angled line to a point.
{
	// The angle of the line.
	angle: number,
	// The tag.
	tag: string,
	// The point to draw to.
	to: number,
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

arc

Draw an arc.

arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: ArcData - Data to draw an arc.
{
	// The end angle.
	angle_end: number,
	// The start angle.
	angle_start: number,
	// The radius.
	radius: number,
	// The tag.
	tag: string,
} |
{
	// The end angle.
	angle_end: number,
	// The start angle.
	angle_start: number,
	// The radius.
	radius: number,
} |
{
	// The center.
	center: [number, number],
	// The radius.
	radius: number,
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
{
	// The center.
	center: [number, number],
	// The radius.
	radius: number,
	// The to point.
	to: [number, number],
}
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

asin

Computes the arcsine of a number (in radians).

asin(num: number) -> number

Arguments

  • num: number

Returns

  • number

atan

Computes the arctangent of a number (in radians).

atan(num: number) -> number

Arguments

  • num: number

Returns

  • number

bezierCurve

Draw a bezier curve.

bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: BezierData - Data to draw a bezier curve.
{
	// The first control point.
	control1: [number, number],
	// The second control point.
	control2: [number, number],
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
{
	// The first control point.
	control1: [number, number],
	// The second control point.
	control2: [number, number],
	// The to point.
	to: [number, number],
}
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

ceil

Computes the smallest integer greater than or equal to a number.

ceil(num: number) -> number

Arguments

  • num: number

Returns

  • number

close

Close the current sketch.

close(sketch_group: SketchGroup) -> SketchGroup

Arguments

  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

cos

Computes the sine of a number (in radians).

cos(num: number) -> number

Arguments

  • num: number

Returns

  • number

e

Return the value of Eulers number e.

e() -> number

Arguments

Returns

  • number

extrude

Extrudes by a given amount.

extrude(length: number, sketch_group: SketchGroup) -> ExtrudeGroup

Arguments

  • length: number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • ExtrudeGroup - An extrude group is a collection of extrude surfaces.
{
	// The height of the extrude group.
	height: number,
	// The id of the extrude group.
	id: uuid,
	// The position of the extrude group.
	position: [number, number, number],
	// The rotation of the extrude group.
	rotation: [number, number, number, number],
	// The extrude surfaces.
	value: [{
	// The id of the geometry.
	id: uuid,
	// The name.
	name: string,
	// The position.
	position: [number, number, number],
	// The rotation.
	rotation: [number, number, number, number],
	// The source range.
	sourceRange: [number, number],
	type: string,
}],
}

floor

Computes the largest integer less than or equal to a number.

floor(num: number) -> number

Arguments

  • num: number

Returns

  • number

getExtrudeWallTransform

Returns the extrude wall transform.

getExtrudeWallTransform(surface_name: string, extrude_group: ExtrudeGroup) -> ExtrudeTransform

Arguments

  • surface_name: string
  • extrude_group: ExtrudeGroup - An extrude group is a collection of extrude surfaces.
{
	// The height of the extrude group.
	height: number,
	// The id of the extrude group.
	id: uuid,
	// The position of the extrude group.
	position: [number, number, number],
	// The rotation of the extrude group.
	rotation: [number, number, number, number],
	// The extrude surfaces.
	value: [{
	// The id of the geometry.
	id: uuid,
	// The name.
	name: string,
	// The position.
	position: [number, number, number],
	// The rotation.
	rotation: [number, number, number, number],
	// The source range.
	sourceRange: [number, number],
	type: string,
}],
}

Returns

  • ExtrudeTransform
{
	position: [number, number, number],
	rotation: [number, number, number, number],
}

hole

Use a sketch to cut a hole in another sketch.

hole(hole_sketch_group: SketchGroup, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • hole_sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

lastSegX

Returns the last segment of x.

lastSegX(sketch_group: SketchGroup) -> number

Arguments

  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

lastSegY

Returns the last segment of y.

lastSegY(sketch_group: SketchGroup) -> number

Arguments

  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

legAngX

Returns the angle of the given leg for x.

legAngX(hypotenuse: number, leg: number) -> number

Arguments

  • hypotenuse: number
  • leg: number

Returns

  • number

legAngY

Returns the angle of the given leg for y.

legAngY(hypotenuse: number, leg: number) -> number

Arguments

  • hypotenuse: number
  • leg: number

Returns

  • number

legLen

Returns the length of the given leg.

legLen(hypotenuse: number, leg: number) -> number

Arguments

  • hypotenuse: number
  • leg: number

Returns

  • number

line

Draw a line.

line(data: LineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: LineData - Data to draw a line.
{
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

lineTo

Draw a line to a point.

lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: LineToData - Data to draw a line to a point.
{
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

ln

Computes the natural logarithm of the number.

ln(num: number) -> number

Arguments

  • num: number

Returns

  • number

log

Computes the logarithm of the number with respect to an arbitrary base.

The result might not be correctly rounded owing to implementation details; log2() can produce more accurate results for base 2, and log10() can produce more accurate results for base 10.

log(num: number, base: number) -> number

Arguments

  • num: number
  • base: number

Returns

  • number

log10

Computes the base 10 logarithm of the number.

log10(num: number) -> number

Arguments

  • num: number

Returns

  • number

log2

Computes the base 2 logarithm of the number.

log2(num: number) -> number

Arguments

  • num: number

Returns

  • number

max

Computes the maximum of the given arguments.

max(args: [number]) -> number

Arguments

  • args: [number]

Returns

  • number

min

Computes the minimum of the given arguments.

min(args: [number]) -> number

Arguments

  • args: [number]

Returns

  • number

pi

Return the value of pi. Archimedes constant (π).

pi() -> number

Arguments

Returns

  • number

pow

Computes the number to a power.

pow(num: number, pow: number) -> number

Arguments

  • num: number
  • pow: number

Returns

  • number

segAng

Returns the angle of the segment.

segAng(segment_name: string, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

segEndX

Returns the segment end of x.

segEndX(segment_name: string, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

segEndY

Returns the segment end of y.

segEndY(segment_name: string, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

segLen

Returns the length of the segment.

segLen(segment_name: string, sketch_group: SketchGroup) -> number

Arguments

  • segment_name: string
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • number

show

Render a model.

show(sketch: SketchGroup)

Arguments

  • sketch: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

sin

Computes the sine of a number (in radians).

sin(num: number) -> number

Arguments

  • num: number

Returns

  • number

sqrt

Computes the square root of a number.

sqrt(num: number) -> number

Arguments

  • num: number

Returns

  • number

startProfileAt

Start a profile at a given point.

startProfileAt(data: LineData, plane: Plane) -> SketchGroup

Arguments

  • data: LineData - Data to draw a line.
{
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
[number, number]
  • plane: Plane - A plane.
{
	// The id of the plane.
	id: uuid,
	// Origin of the plane.
	origin: {
	x: number,
	y: number,
	z: number,
},
	// Type for a plane.
	value: string |
string,
	// What should the planes X axis be?
	xAxis: {
	x: number,
	y: number,
	z: number,
},
	// What should the planes Y axis be?
	yAxis: {
	x: number,
	y: number,
	z: number,
},
	// The z-axis (normal).
	zAxis: {
	x: number,
	y: number,
	z: number,
},
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

startSketchAt

Start a sketch at a given point on the 'XY' plane.

startSketchAt(data: LineData) -> SketchGroup

Arguments

  • data: LineData - Data to draw a line.
{
	// The tag.
	tag: string,
	// The to point.
	to: [number, number],
} |
[number, number]

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

startSketchOn

Start a sketch at a given point.

startSketchOn(data: PlaneData) -> Plane

Arguments

  • data: PlaneData - Data for a plane.
string |
string |
string |
string |
string |
string |
{
	plane: {
	// Origin of the plane.
	origin: {
	x: number,
	y: number,
	z: number,
},
	// What should the planes X axis be?
	x_axis: {
	x: number,
	y: number,
	z: number,
},
	// What should the planes Y axis be?
	y_axis: {
	x: number,
	y: number,
	z: number,
},
	// The z-axis (normal).
	z_axis: {
	x: number,
	y: number,
	z: number,
},
},
}

Returns

  • Plane - A plane.
{
	// The id of the plane.
	id: uuid,
	// Origin of the plane.
	origin: {
	x: number,
	y: number,
	z: number,
},
	// Type for a plane.
	value: string |
string,
	// What should the planes X axis be?
	xAxis: {
	x: number,
	y: number,
	z: number,
},
	// What should the planes Y axis be?
	yAxis: {
	x: number,
	y: number,
	z: number,
},
	// The z-axis (normal).
	zAxis: {
	x: number,
	y: number,
	z: number,
},
}

tan

Computes the tangent of a number (in radians).

tan(num: number) -> number

Arguments

  • num: number

Returns

  • number

tangentialArc

Draw an arc.

tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: TangentialArcData - Data to draw a tangential arc.
{
	// Offset of the arc, in degrees.
	offset: number,
	// Radius of the arc. Not to be confused with Raiders of the Lost Ark.
	radius: number,
} |
{
	// The tag.
	tag: string,
	// Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position.
	to: [number, number],
} |
[number, number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

tangentialArcTo

Draw an arc.

tangentialArcTo(to: [number], sketch_group: SketchGroup, tag: String) -> SketchGroup

Arguments

  • to: [number]
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}
  • tag: String

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

tau

Return the value of tau. The full circle constant (τ). Equal to 2π.

tau() -> number

Arguments

Returns

  • number

xLine

Draw a line on the x-axis.

xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AxisLineData - Data to draw a line on an axis.
{
	// The length of the line.
	length: number,
	// The tag.
	tag: string,
} |
number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

xLineTo

Draw a line to a point on the x-axis.

xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AxisLineToData - Data to draw a line to a point on an axis.
{
	// The tag.
	tag: string,
	// The to point.
	to: number,
} |
number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

yLine

Draw a line on the y-axis.

yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AxisLineData - Data to draw a line on an axis.
{
	// The length of the line.
	length: number,
	// The tag.
	tag: string,
} |
number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

yLineTo

Draw a line to a point on the y-axis.

yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup

Arguments

  • data: AxisLineToData - Data to draw a line to a point on an axis.
{
	// The tag.
	tag: string,
	// The to point.
	to: number,
} |
number
  • sketch_group: SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}

Returns

  • SketchGroup - A sketch group is a collection of paths.
{
	// The id of the sketch group.
	id: uuid,
	// The plane id of the sketch group.
	planeId: uuid,
	// The position of the sketch group.
	position: [number, number, number],
	// The rotation of the sketch group.
	rotation: [number, number, number, number],
	// The starting path.
	start: {
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
},
	// The paths in the sketch group.
	value: [{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
	// The x coordinate.
	x: number,
	// The y coordinate.
	y: number,
} |
{
	// The from point.
	from: [number, number],
	// The name of the path.
	name: string,
	// The to point.
	to: [number, number],
	type: string,
}],
}