CAD 2D Shapes
25 nodes
On this page 25
Area
FunctionA shape's area, in square model units.
Area(shape: Cad Shape) -> Number
double Area(CadShape shape)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — |
Returns
| result | Number |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Bounds
FunctionThe box round a shape, flat at Z = 0.
Bounds(shape: Cad Shape) -> Bounding Box
BoundingBox Bounds(CadShape shape)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — |
Returns
| result | Bounding Box |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Circle
FunctionA disk centred on the origin, an exact circle; or, given three or more segments, OpenSCAD's regular polygon of that many corners on the circle, the first on +X: circle(r, $fn = segments).
Circle(radius: Number, segments: Integer) -> Cad Shape
CadShape Circle(double radius, int segments = 0)
Parameters
| name | type | default | description |
|---|---|---|---|
| radius | Number | — | Its radius: the corners' distance from the middle when it has segments. |
| segments | Integer | 0 | Zero for an exact circle, or the number of a polygon's corners (at least three). |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Difference
FunctionA shape with every cutter taken away, OpenSCAD's difference() of 2D children: the first child less the others.
Difference -> Cad Shape
shape: Cad Shape
cutters: Cad Shape Array
tolerance: NumberCadShape Difference(
CadShape shape,
CadShape[] cutters,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | What is cut. |
| cutters | Cad Shape Array | — | What cuts it. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Fill
FunctionA shape without its holes, OpenSCAD's fill(): each region's outer boundary filled, islands in former holes merged in.
Fill(shape: Cad Shape, tolerance: Number) -> Cad Shape
CadShape Fill(CadShape shape, double tolerance = 1E-06)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Fragments
FunctionHow many segments OpenSCAD cuts a circle of a radius into, from its special variables: $fn when it is set, else as many as keep each segment's angle at least Minimum Angle and its length at least Minimum Size, and never fewer than five. Give the count to Cad2D.Circle, Cad.Frustum and the other round operations to reproduce a model that relies on OpenSCAD's facets; leave it out for exact circles.
Fragments -> Integer
radius: Number
fn: Integer
minimumAngle: Number
minimumSize: Numberint Fragments(
double radius,
int fn = 0,
double minimumAngle = 0.20943951023931953,
double minimumSize = 2)Parameters
| name | type | default | description |
|---|---|---|---|
| radius | Number | — | The circle's radius. |
| fn | Integer | 0 | OpenSCAD's $fn: zero when not set. |
| minimumAngle | Number | 0.20943951023931953 | OpenSCAD's $fa, in radians: 12° unless set. |
| minimumSize | Number | 2 | OpenSCAD's $fs, in model units: 2 unless set. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
From Curves
FunctionThe shape closed curves in the XY plane enclose: even-odd by default, as polygon paths are, so curves inside others are holes; nonzero reads which way each curve runs, as font outlines and most SVG paths do; any fills everything inside any curve.
FromCurves -> Cad Shape
boundaries: Curve Array
fill: Curve Fill Rule
tolerance: NumberCadShape FromCurves(
Curve[] boundaries,
CurveFillRule fill = CurveFillRule.EvenOdd,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| boundaries | Curve Array | — | Closed curves lying in the XY plane. |
| fill | Curve Fill Rule | Even odd | Which points they enclose. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
From Regions
FunctionThe shape of planar regions in the XY plane - what CadCurves.BooleanRegions and CadText.Regions give - merged where they overlap.
FromRegions -> Cad Shape
regions: Curve Region Array
tolerance: NumberCadShape FromRegions(
CurveRegion[] regions,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| regions | Curve Region Array | — | The regions, each an outer boundary with holes. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Hull
FunctionThe convex hull of flat shapes, OpenSCAD's hull() of 2D children: the smallest convex shape holding them all. Exact for lines and arcs - the hull of circles is their arcs and the lines tangent to two of them - and within the tolerance for other curves, which are first followed by tangent arcs.
Hull(shapes: Cad Shape Array, tolerance: Number) -> Cad Shape
CadShape Hull(CadShape[] shapes, double tolerance = 1E-06)
Parameters
| name | type | default | description |
|---|---|---|---|
| shapes | Cad Shape Array | — | The shapes. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
Remarks
Built by turning a direction once round and following, for each, the piece of the shapes furthest along it: a corner, or a stretch of an arc whose outward normal it is; where the furthest piece changes, the hull runs straight from one to the next along the line touching both.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Hull Of Points
FunctionThe convex hull of points in the XY plane, as a flat shape; their Z is ignored. Fewer than three points not in a line hold no area and give an empty shape.
HullOfPoints -> Cad Shape
points: Point3d Array
tolerance: NumberCadShape HullOfPoints(
Point3d[] points,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| points | Point3d Array | — | The points. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Intersection
FunctionWhat every shape has in common, OpenSCAD's intersection() of 2D children. An empty list gives an empty shape.
Intersection -> Cad Shape
shapes: Cad Shape Array
tolerance: NumberCadShape Intersection(
CadShape[] shapes,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| shapes | Cad Shape Array | — | The shapes. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Minkowski
FunctionThe Minkowski sum of flat shapes, OpenSCAD's minkowski() of 2D children: every point of one added to every point of the next. Exact where one of two shapes is a circle (the other offset by its radius, as OpenSCAD's rounded rectangle is), or one is made of lines and the other is convex; otherwise the shapes' arcs are followed by lines within the tolerance first.
Minkowski -> Cad Shape
shapes: Cad Shape Array
tolerance: NumberCadShape Minkowski(CadShape[] shapes, double tolerance = 1E-06)
Parameters
| name | type | default | description |
|---|---|---|---|
| shapes | Cad Shape Array | — | The shapes, summed in turn. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
Remarks
A shape of lines A plus a convex shape B is A moved by a point of B together with, for each line of A's boundary, the hull of B at its two ends; a shape of lines that is not convex is cut into trapezoids, which are.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Mirror
FunctionA shape mirrored in the line through the origin square to a direction, OpenSCAD's mirror([x, y]): (1, 0) mirrors left to right.
Mirror -> Cad Shape
shape: Cad Shape
normalX: Number
normalY: NumberCadShape Mirror(CadShape shape, double normalX, double normalY)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| normalX | Number | — | The mirror line's normal, along X. |
| normalY | Number | — | The mirror line's normal, along Y. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Offset
FunctionA shape grown or shrunk by a distance with round corners, OpenSCAD's offset(r): growing, every point within the radius of the shape joins it (its Minkowski sum with a disk); shrinking, every point within the radius of its outside leaves it. Boundaries of lines and arcs give exact lines and arcs; other curves are first followed within the tolerance by tangent-continuous arcs.
Offset -> Cad Shape
shape: Cad Shape
radius: Number
tolerance: NumberCadShape Offset(
CadShape shape,
double radius,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| radius | Number | — | How far, in model units: positive grows, negative shrinks. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
Remarks
Every boundary is offset whole, exactly: each line and arc moved out (or in) by the distance - an arc tighter than that through its middle and out the other side - with an arc round each corner. Those curves hold every edge of the result but may cross themselves and each other; the plane they cut up is kept face by face where a point inside the face is in the shape or within the distance of it (growing), or in the shape and no nearer its edge than the distance (shrinking). Narrow gaps close and thin parts vanish as they should.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Offset Delta
FunctionA shape grown or shrunk by a distance with sharp corners, OpenSCAD's offset(delta, chamfer): every boundary moves out (or in) square to itself, and corners are carried out to where the moved sides meet, or with Chamfer cut straight across. Sides of lines and arcs stay exact; at a corner of an arc the moved sides are met along their tangents.
OffsetDelta -> Cad Shape
shape: Cad Shape
delta: Number
chamfer: Truth
tolerance: NumberCadShape OffsetDelta(
CadShape shape,
double delta,
bool chamfer = false,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| delta | Number | — | How far, in model units: positive grows, negative shrinks. |
| chamfer | Truth | False | Cut the corners across rather than carrying them to a point. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
Remarks
Every boundary is offset whole, its corners carried out (or cut) on the side the offset opens and joined straight across where the offset sides cross; the plane those curves cut up is kept face by face where they wind round it positively, as Clipper fills a mitred offset, so the loops a concave corner throws out of a growing shape, and the reversed ones of a shrinking shape's vanished parts, are left out.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Outlines
FunctionCopies of every boundary of a shape: each region's outer boundary, then its holes.
Outlines(shape: Cad Shape) -> Curve Array
Curve[] Outlines(CadShape shape)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — |
Returns
| result | Curve Array |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Polygon
FunctionA polygon through points, OpenSCAD's polygon(points, paths): with no paths, one boundary through every point in order; with paths, one boundary through each list of point indices. The boundaries are filled even-odd, so a path inside another is a hole, and one inside that an island, whichever way each runs; a boundary that crosses itself fills alternately.
Polygon -> Cad Shape
points: Point3d Array
paths: Integer Array Array
tolerance: NumberCadShape Polygon(
Point3d[] points,
int[][] paths,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| points | Point3d Array | — | The points; only X and Y are read. |
| paths | Integer Array Array | — | Lists of indices into Points, one a boundary; null for one boundary through every point. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Resize
FunctionA shape scaled about the origin to a width and height, OpenSCAD's resize([x, y], auto): a size of zero keeps that direction as it is, or, with Auto, scales it by the largest factor of the sizes given, keeping the proportions.
Resize -> Cad Shape
shape: Cad Shape
width: Number
height: Number
auto: TruthCadShape Resize(
CadShape shape,
double width,
double height,
bool auto = false)Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| width | Number | — | The new width along X; zero to leave it. |
| height | Number | — | The new height along Y; zero to leave it. |
| auto | Truth | False | Scale the directions given zero with the others. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Rotate
FunctionA shape turned about a point, counter-clockwise seen from +Z, OpenSCAD's rotate(a) about the origin (whose angle is in degrees).
Rotate -> Cad Shape
shape: Cad Shape
angle: Number
centerX: Number
centerY: NumberCadShape Rotate(
CadShape shape,
double angle,
double centerX = 0,
double centerY = 0)Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| angle | Number | — | How far, in radians. |
| centerX | Number | 0 | The point it turns about, along X. |
| centerY | Number | 0 | The point it turns about, along Y. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Scale
FunctionA shape scaled about the origin, OpenSCAD's scale([x, y]). A negative factor mirrors it.
Scale(shape: Cad Shape, x: Number, y: Number) -> Cad Shape
CadShape Scale(CadShape shape, double x, double y)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| x | Number | — | The factor along X. |
| y | Number | — | The factor along Y. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Square
FunctionA rectangle with a corner at the origin, or centred on it: OpenSCAD's square([width, height], center).
Square -> Cad Shape
width: Number
height: Number
centered: TruthCadShape Square(
double width,
double height,
bool centered = false)Parameters
| name | type | default | description |
|---|---|---|---|
| width | Number | — | Along X. |
| height | Number | — | Along Y. |
| centered | Truth | False | Centred on the origin rather than cornered on it. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Text
FunctionText as a flat shape, OpenSCAD's text(text, size, font, halign, valign): the font's exact outlines, counters as holes, laid out from the origin along +X with lines going down. Size is the em height in model units (OpenSCAD's size is close to the cap height instead). The alignments stand the outline's box on the origin; laid out as is, the text starts at the origin on its first baseline.
Text -> Cad Shape
text: Text
font: Cad Font
size: Number
horizontal: Cad Text Horizontal
vertical: Cad Text Vertical
tolerance: NumberCadShape Text(
string text,
CadFont font,
double size,
CadTextHorizontal horizontal = CadTextHorizontal.Left,
CadTextVertical vertical = CadTextVertical.Baseline,
double tolerance = 1E-06)Parameters
| name | type | default | description |
|---|---|---|---|
| text | Text | — | The text; newlines start new lines. |
| font | Cad Font | — | The font, captured beforehand (Parametric.CadFonts). |
| size | Number | — | The em height, in model units. |
| horizontal | Cad Text Horizontal | Left | Where the text stands across the origin. |
| vertical | Cad Text Vertical | Baseline | Where the text stands up and down the origin. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Transformed
FunctionA shape under a transform that keeps the XY plane where it is, OpenSCAD's multmatrix of a 2D child: any invertible mix of moves, turns, scales, mirrors and shears within the plane.
Transformed(shape: Cad Shape, transform: Transform) -> Cad Shape
CadShape Transformed(CadShape shape, Transform transform)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| transform | Transform | — | The transform; it must take the XY plane to itself. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Translate
FunctionA shape moved, OpenSCAD's translate([x, y]).
Translate(shape: Cad Shape, x: Number, y: Number) -> Cad Shape
CadShape Translate(CadShape shape, double x, double y)
Parameters
| name | type | default | description |
|---|---|---|---|
| shape | Cad Shape | — | The shape. |
| x | Number | — | How far along X. |
| y | Number | — | How far along Y. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD
Union
FunctionEverything in any of the shapes, OpenSCAD's union() of 2D children. An empty list gives an empty shape.
Union(shapes: Cad Shape Array, tolerance: Number) -> Cad Shape
CadShape Union(CadShape[] shapes, double tolerance = 1E-06)
Parameters
| name | type | default | description |
|---|---|---|---|
| shapes | Cad Shape Array | — | The shapes. |
| tolerance | Number | 1E-06 | The model's tolerance, in its units. |
Returns
| result | Cad Shape |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- CAD 2D Shapes
- Package
- CAD