Curve
arcBy3Points(param)
Creates one or multiple arcs defined by start-, end- and mid point.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | Array<object> | object or objects containing all the parameters |
param.id | string | real | id | id of the shape, which is the container of the created arc |
param.startPos | point | start position of the arc |
param.endPos | point | end position of the arc |
param.midPos | point | middle position on the arc |
Example
res = api.v1.curve.arcBy3Points({ id: xx, midPos: [0, 0, 0], startPos: [10, 0, 0], endPos: [0, 10, 0] })
arcByCenterRadAngle(param)
Creates one or multiple arcs defined by center, radius and angle
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created arc | |
param.centerPos | point | center of arc | |
[param.xAxis] | point | 0 | where the arc starts (default=0) |
[param.normal] | point | 1 | should be different to xAxis (default=1) |
param.startAngle | real | startAngle in radian | |
param.endAngle | real | endAngle in radian | |
param.radius | real | radius |
Example
res = api.v1.curve.arcByCenterRadAngle({ id: xx, centerPos: [0,0,0], startAngle: 0, endAngle: 90g, radius: 5 });
arcByCenter(param)
Creates one or multiple arcs defined by start-, end- and center point.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created arc | |
param.startPos | point | start position of the arc | |
param.endPos | point | end position of the arc | |
param.centerPos | point | center position of the arc | |
[param.isClockwise] | boolean | TRUE | flag to define whether the arc is clockwise from start- to end-point around center-point or not (default=TRUE) |
Example
res = api.v1.curve.arcByCenter({ id: xx, centerPos: [0, 0, 0], startPos: [10, 0, 0], endPos: [0, 10, 0] })
bezierCurve(param)
Creates one or multiple BezierCurves of degree n (number of points -1)
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | Array<object> | object or objects containing all the parameters |
param.id | string | real | id | id of the shape, which is the container of the created bezier curve |
param.points | Array<point> | The control points of the curve, n + 1 points are needed to create a curve of degree n |
Example
res = api.v1.curve.bezierCurve({
id: xx,
points: [
[0, 0, 0],
[0, 10, 0],
[10, 10, 0],
[10, 0, 0],
],
})
ellipticArc(param)
Creates one or multiple elliptic arc curves
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created elliptic arc | |
param.centerPos | point | center position of elliptic arc | |
[param.xAxis] | point | 0 | where the arc starts (default=0) |
[param.normal] | point | 1 | should be different to xAxis (default=1) |
param.startAngle | real | startAngle in radian | |
param.endAngle | real | endAngle in radian | |
param.radius1 | real | major radius | |
param.radius2 | real | minor radius |
Example
res = api.v1.curve.ellipticArc({ id: xx, centerPos: [0,0,0], startAngle: 0, endAngle: 90g, radius1: 5, radius2: 10 });
ellipse(param)
Creates one or multiple ellipse curves
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created ellipse | |
param.centerPos | point | Center of ellipse | |
[param.xAxis] | point | 0 | where the arc starts (default=0) |
[param.normal] | point | 1 | should be different to xAxis (default=1) |
param.radius1 | real | major radius | |
param.radius2 | real | minor radius |
Example
res = api.v1.curve.ellipse({ id: xx, centerPos: [0, 0, 0], radius1: 5, radius2: 10 })
interpolationCurve(param)
Creates an interpolation curve through given array of points
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the shape, which is the container of the created interpolation curve |
param.points | Array<point> | needs always degree + 1 points |
Example
res = api.v1.interpolationCurve({
id: xx,
points: [
[0, 0, 0],
[5, 15, 0],
[10, 0, 0],
],
})
line(param)
Creates one or multiple lines in a shape container
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | Array<object> | object or objects containing all the parameters |
param.id | string | real | id | id of the shape, which is the container of the created line |
param.startPos | point | start position of the line |
param.endPos | point | end position of the line |
Example
res = api.v1.curve.line({ id: xx, startPos: [0, 0, 0], endPos: [10, 10, 0] })
polyline2d(param)
Creates a single or multiple entity array of lines and arcs, given a polyline definition with array of points and bulges The points of the poyline must lying in the same plane. The bulge is tan(a/4), a is the included angle for the arc between the two points. A bulge is positive for arcs directed counterclockwise when looking in opposite direction of the normal. A semicircle has the bulge 1, a straight line the bulge 0.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created polyline2d | |
param.points | Array<point> | positions of the polyline defining the segments | |
param.bulges | Array<real> | bulge for each segment between two points, there must be as many bulges as points | |
[param.close] | boolean | FALSE | closes the polyline by connecting the start- and endpoint (default=FALSE) |
Example
res = api.v1.curve.polyline2d({
id: xx,
points: [
[0, 0, 0],
[10, 0, 0],
[10, 10, 0],
[0, 10, 0],
[0, 0, 0],
],
bulges: [0.3, -0.3, 0.3, -0.3, 0],
})
deleteShape(param)
Deletes shapes
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.ids | Array<(string|real|id)> | ids of the shapes to delete |
Example
res = api.v1.curve.deleteShape({ ids: [52, 25, 68] })
shape(param)
Creates a shape in a container
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: id|VOID // id of the created shape to use as container for curves
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the entity injection feature to create the shape in |
Example
res = api.v1.curve.shape({ id: 54 })
circle(param)
Creates one or multiple circles in a shape container
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | Array<object> | object or objects containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created circle | |
param.centerPos | point | center of arc | |
[param.normal] | point | 1 | defines orientation in 3d space (default=1) |
param.radius | real | radius |
Example
res = api.v1.curve.circle({ id: xx, centerPos: [0, 0, 0], radius: 5 })
translateShape(param)
Translates the given shape by the given vector. The vector is in coordinates of the part where the provided shape belongs to.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the shape to translate |
param.translation | point | translation vector along x, y and z-axis |
Example
res = api.v1.curve.translateShape({ id: 54, translation: [25, 0, 0] })
rotateShape(param)
Rotates the given shape by the given rotation vector. The vector is in coordinates of the part where the provided shape belongs to.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the shape to rotate |
param.rotation | point | rotation vector containing rotations around x, y, and z-axis |
Example
res = api.v1.curve.rotateShape({ id: 54, rotation: [C:PI,0,0] });
union2d(param)
Creates an union between two shapes
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | object containing all the parameters | |
param.target | string | real | id | id of the shape to use as base | |
param.tool | string | real | id | id of the shape to use as tool | |
[param.keepShape] | boolean | FALSE | flag to define whether the tool curves should be kept or not (default=FALSE) |
Example
res = api.v1.curve.union2d({ target: 58, tool: 89 })
subtraction2d(param)
Creates an subtraction between two shapes
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | object containing all the parameters | |
param.target | string | real | id | id of the shape to use as base | |
param.tool | string | real | id | id of the shape to use as tool to subtract | |
[param.keepShape] | boolean | FALSE | flag to define whether the tool curves should be kept or not (default=FALSE) |
Example
res = api.v1.curve.subtraction2d({ target: 58, tool: 89, keepShape: TRUE })
intersection2d(param)
Creates an intersection between two shapes
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Default | Description |
---|---|---|---|
param | object | object containing all the parameters | |
param.target | string | real | id | id of the shape to use as base | |
param.tool | string | real | id | id of the shape to use as tool for intersection | |
[param.keepShape] | boolean | FALSE | flag to define whether the tool curves should be kept or not(default=FALSE) |
Example
res = api.v1.curve.intersection2d({ target: 58, tool: 89, keepShape: TRUE })
advancedPolyline(param)
Creates an advanced polyline definition using an array of point-line definitions.
A polyline must start with an initial point-line definition (pld) using absolute coordinates:
{ xa: value, ya: value }
Subsequent points can be defined in multiple ways:
- Absolute coordinates:
{ xa: value, ya: value }
- Relative coordinates:
{ xr: value, yr: value }
- Mixed mode:
{ xa: value, yr: value }
or{ xr: value, ya: value }
A segment can also be defined using angle and length:
- Absolute angle and length:
{ l: value, a: angle }
- The angle is measured counterclockwise (CCW) from the x-axis.
- Relative angle and length:
{ l: value, ar: angle }
- The angle is measured CCW from the previous segments direction. A segment can also be defined using angle and an absolute or relative coordinates. Angle is defined as above and length is calculated internally:
- Examples of this:
{ xa: value, a: value }
,{ xr: value, a: value }
,{ yr: value, a: value }
,{ ya: value, ar: value }
Each point-line definition can optionally have a radius { r: value }
, which creates an arc that is tangent to both the previous and next segments. When a radius is specified:
- The defined point remains collinear with both adjacent segments but does not belong to the actual polyline.
- Cannot be applied with chamfer on the same point.
Each point-line definition can optionally have a chamfer { c: value }
, which creates a symmetric Chamfer of length { c: value }
also called edge distance, measured along the edge of the original part before the chamfer was applied.
- Cannot be applied with fillet on the same point.
The polyline can be closed (close: true
), which connects the last point back to the first point.
- If closed, the first point can also have a radius, forming a smooth transition.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, state: real, code: real, api: string }[]
}
Param | Type | Default | Description |
---|---|---|---|
param | object | object containing all the parameters | |
param.id | string | real | id | id of the shape, which is the container of the created advanced polyline | |
param.pld | Array<object> | array of PointLineDefinitions (PLDs) defining the polyline | |
[param.pld.xa] | real | absolute x-coordinate | |
[param.pld.xr] | real | relative x movement from the last point | |
[param.pld.ya] | real | absolute y-coordinate | |
[param.pld.yr] | real | relative y movement from the last point | |
[param.pld.a] | real | absolute angle (degrees, CCW from x-axis) | |
[param.pld.ar] | real | relative angle (degrees, CCW from the last segment's direction) | |
[param.pld.l] | real | length of the segment | |
[param.pld.r] | real | radius of a connecting arc. | |
[param.pld.c] | real | chamfer offset of a connecting line segment | |
[param.close] | boolean | false | whether to close the polyline by connecting the last point to the first |
Example
// Example 1: Simple rectangle, closed
api.v1.curve.advancedPolyline({
id: 'shape1',
pld: [
{ xa: 0, ya: 0 },
{ xa: 10, ya: 0 },
{ xa: 10, ya: 10 },
{ xa: 0, ya: 10 },
],
close: true,
})
Example
// Example 2: Polyline using relative movements
api.v1.curve.advancedPolyline({
id: 'shape2',
pld: [
{ xa: 0, ya: 0 },
{ xr: 10, yr: 0 },
{ xr: 0, yr: 10 },
{ xr: -10, yr: 0 },
],
close: true,
})
Example
// Example 3: Using angle and length definitions
api.v1.curve.advancedPolyline({
id: "shape3",
pld: [
{ xa: 0, ya: 0 },
{ l: 10, a: 0g }, // Move 10 units at 0 degrees
{ l: 10, a: 90g }, // Move 10 units at 90 degrees
{ l: 10, ar: 90g } // Move 10 units, turning 90 degrees CCW from last segment
],
close: true
});
Example
// Example 4: Using movement and angle definitions
api.v1.curve.advancedPolyline({
id: "shape4",
pld: [
{ xa: 0, ya: 0 },
{ ya: 10, a: 45g }, // Move at 45 degrees, reaching y=10
{ xr: 10, a: 0g }, // Move at 0 degrees, passing 10 units along x-axis
{ yr: -10, ar: -135g } // Turn 135 degrees CW from last segment and move, passing 10 units along negated y-axis
],
close: true
});
Example
// Example 5: Polyline with arcs (radius transitions)
api.v1.curve.advancedPolyline({
id: 'shape5',
pld: [
{ xa: 0, ya: 0 },
{ xa: 10, ya: 0, r: 2 }, // Arc transition to next segment
{ xa: 10, ya: 10 },
{ xa: 0, ya: 10, r: 3 }, // Arc transition back to start
],
close: true,
})
Example
// Example 6: Polyline with chamfer
api.v1.curve.advancedPolyline({
id: 'shape6',
pld: [
{ xa: 0, ya: 0 },
{ xa: 10, ya: 0, c: 5 }, // Cut away the angle, adding a line transition (chamfer) to next segment
{ xa: 10, ya: 10 },
{ xa: 0, ya: 10, c: 4 }, // Cut away the angle, adding a line transition (chamfer) to next segment
],
close: true,
})
transformShape(param)
Transforms the given shape with a 4x4 tranformation matrix. The matrix is in coordinates of the part where the provided shape belongs to.
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the shape to move |
param.matrix | point | matrix to translate the shape to; matrix = [[[xVec:x,yVec:x,zVec:x,pos:x], [xVec:y,yVec:y,zVec:y,pos:y], [xVec:z,yVec:z,zVec:z,pos:z], [0,0,0,1]] |
Example
res = api.v1.curve.transformShape({
id: 54,
matrix: [
[0.0, 1.0, 0.0, 120.0],
[-1.0, 0.0, 0.0, 40.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
],
})
scaleShape(param)
Scales the given shape with a factor
Kind: v1.curve function
Returns: object
- object containing result and optional messages
{
result: VOID
messages?: { message: string, level: real, code: real, api: string }[]
maxLevel?: real
}
Param | Type | Description |
---|---|---|
param | object | object containing all the parameters |
param.id | string | real | id | id of the shape to scale |
param.factor | real | scale factor of the shape |
Example
res = api.v1.curve.scaleShape({ id: 58, factor: 3.5 })