Divooka Reference

CAD Builder

32 nodes

On this page 32

Make CAD Builder

Function

Creates an empty session with a fixed, positive modeling tolerance.

Signature
CadBuilder(tolerance: Number) -> Cad Builder
CadBuilder CadBuilder(double tolerance = 1E-06)

Parameters

nametypedefaultdescription
toleranceNumber1E-06

Returns

CAD BuilderCad Builder
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Add

Function

Adds a model by set union, applying the current placement first. Throws on failure without changing the current model.

Signature
Add(Cad Builder: Cad Builder, model: Cad Model)
void Add(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Append

Function

Adds a model as separate bodies without fusing them.

Signature
Append(Cad Builder: Cad Builder, model: Cad Model)
void Append(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Build

Function

Returns the current immutable snapshot with no copying or regeneration.

Signature
Build(Cad Builder: Cad Builder) -> Cad Model
CadModel Build(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—

Returns

resultCad Model
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Clear

Function

Removes all bodies, retaining the placement stack.

Signature
Clear(Cad Builder: Cad Builder)
void Clear(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Color

Function

Overload 1 of 2

Signature
Color
    Cad Builder: Cad Builder
    color: Color
    children: Action<Cad Builder>
void Color(
    CadBuilder Cad Builder,
    ColorElement color,
    Action<CadBuilder> children)

Adds everything a block builds, painted: OpenSCAD's color(c) { ... } (Cad.Color). A colour painted over another replaces it, as OpenSCAD's outer color() does.

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
colorColor—The colour, its alpha how opaque.
childrenAction<Cad Builder>—The block, given a session of its own.

Overload 2 of 2

Signature
Color
    Cad Builder: Cad Builder
    color: Text
    alpha: Number
    children: Action<Cad Builder>
void Color(
    CadBuilder Cad Builder,
    string color,
    double alpha,
    Action<CadBuilder> children)

Adds everything a block builds, painted a colour written as OpenSCAD writes one: color("red") { ... }, color("#ff8000", 0.5) { ... } (Cad.ColorOf).

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
colorText—A colour's name, as CSS and OpenSCAD name colours, or "#rgb", "#rgba", "#rrggbb" or "#rrggbbaa".
alphaNumber—How opaque, from 0 to 1, times any alpha the text gives.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Cut

Function

Subtracts a model after applying the current placement.

Signature
Cut(Cad Builder: Cad Builder, model: Cad Model)
void Cut(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Difference

Function

Adds the first child of a block less every other: OpenSCAD's difference() { ... }. A block that adds nothing adds nothing.

Signature
Difference
    Cad Builder: Cad Builder
    children: Action<Cad Builder>
void Difference(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Difference Group

Function

Runs a nested construction in an independent session, then subtracts its completed union as one atomic edit.

Signature
DifferenceGroup
    Cad Builder: Cad Builder
    action: Action<Cad Builder>
void DifferenceGroup(
    CadBuilder Cad Builder,
    Action<CadBuilder> action)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
actionAction<Cad Builder>—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Children

Function

The children added so far, in order, each placed: what a scoped operation given this session's block works on.

Signature
Children(Cad Builder: Cad Builder) -> Cad Model Array
CadModel[] Children(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—

Returns

resultCad Model Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Current

Function

The current immutable evaluated snapshot.

Signature
Current(Cad Builder: Cad Builder) -> Cad Model
CadModel Current(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—

Returns

resultCad Model
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Tolerance

Function

The tolerance used by builder boolean edits, in model units.

Signature
Tolerance(Cad Builder: Cad Builder) -> Number
double Tolerance(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Hull

Function

Adds the convex hull of everything a block builds: OpenSCAD's hull() { ... } (Cad.Hull: exact for solids of flat faces and for solids standing upright between two heights, the hull of their tessellation otherwise).

Signature
Hull(Cad Builder: Cad Builder, children: Action<Cad Builder>)
void Hull(CadBuilder Cad Builder, Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Intersect

Function

Keeps the intersection with a model after applying the current placement.

Signature
Intersect(Cad Builder: Cad Builder, model: Cad Model)
void Intersect(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Intersection

Function

Adds what every child of a block has in common: OpenSCAD's intersection() { ... }.

Signature
Intersection
    Cad Builder: Cad Builder
    children: Action<Cad Builder>
void Intersection(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Linear Extrude

Function

Overload 1 of 2

Signature
LinearExtrude
    Cad Builder: Cad Builder
    height: Number
    children: Action<Cad Shape Builder>
void LinearExtrude(
    CadBuilder Cad Builder,
    double height,
    Action<CadShapeBuilder> children)

Adds a flat shape a block draws, carried up the Z axis: OpenSCAD's linear_extrude(height) { ... }.

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
heightNumber—How high, in model units.
childrenAction<Cad Shape Builder>—The block, drawing in a flat session of its own.

Overload 2 of 2

Signature
LinearExtrude
    Cad Builder: Cad Builder
    height: Number
    centered: Truth
    twist: Number
    scaleX: Number
    scaleY: Number
    children: Action<Cad Shape Builder>
void LinearExtrude(
    CadBuilder Cad Builder,
    double height,
    bool centered,
    double twist,
    double scaleX,
    double scaleY,
    Action<CadShapeBuilder> children)

Adds a flat shape a block draws, carried up the Z axis turning and scaling: OpenSCAD's linear_extrude(height, center, twist, scale) { ... } (Cad.LinearExtrude; the twist is in radians, counter-clockwise).

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
heightNumber—How high, in model units.
centeredTruth—Centred on Z = 0 in height.
twistNumber—How far the top is turned, in radians, counter-clockwise seen from +Z.
scaleXNumber—The top's scale along X.
scaleYNumber—The top's scale along Y.
childrenAction<Cad Shape Builder>—The block, drawing in a flat session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Minkowski

Function

Adds the Minkowski sum of everything a block builds, each child added to the next: OpenSCAD's minkowski() { ... } (Cad.Minkowski: exact for a solid and a ball, for solids standing upright, and for polyhedra; the sum of a tessellation otherwise).

Signature
Minkowski
    Cad Builder: Cad Builder
    children: Action<Cad Builder>
void Minkowski(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Mirror

Function

Adds what a block builds, mirrored in the plane through the origin square to a direction: OpenSCAD's mirror([x, y, z]) { ... }.

Signature
Mirror
    Cad Builder: Cad Builder
    x: Number
    y: Number
    z: Number
    children: Action<Cad Builder>
void Mirror(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
xNumber—The mirror plane's normal, along X.
yNumber—Along Y.
zNumber—Along Z.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Mult Matrix

Function

Adds what a block builds under a transform: OpenSCAD's multmatrix(m) { ... }.

Signature
MultMatrix
    Cad Builder: Cad Builder
    transform: Transform
    children: Action<Cad Builder>
void MultMatrix(
    CadBuilder Cad Builder,
    Transform transform,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
transformTransform—An invertible affine transform.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Pop Transform

Function

Restores the preceding placement; throws if the stack is empty.

Signature
PopTransform(Cad Builder: Cad Builder)
void PopTransform(CadBuilder Cad Builder)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Push Transform

Function

Pushes a local placement. Nested placements compose parent*local; PopTransform restores the parent.

Signature
PushTransform(Cad Builder: Cad Builder, local: Transform)
void PushTransform(CadBuilder Cad Builder, Transform local)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
localTransform—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Resize

Function

Adds what a block builds, scaled about the origin to a size: OpenSCAD's resize([x, y, z], auto) { ... }.

Signature
Resize
    Cad Builder: Cad Builder
    x: Number
    y: Number
    z: Number
    auto: Truth
    children: Action<Cad Builder>
void Resize(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    bool auto,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
xNumber—The new size along X; zero to leave it.
yNumber—The new size along Y; zero to leave it.
zNumber—The new size along Z; zero to leave it.
autoTruth—Scale the directions given zero with the others.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Rotate

Function

Overload 1 of 2

Signature
Rotate
    Cad Builder: Cad Builder
    x: Number
    y: Number
    z: Number
    children: Action<Cad Builder>
void Rotate(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

Adds what a block builds, turned about the X, Y and Z axes in that order: OpenSCAD's rotate([x, y, z]) { ... }, in radians.

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
xNumber—The turn about X, first.
yNumber—The turn about Y, second.
zNumber—The turn about Z, last.
childrenAction<Cad Builder>—The block, given a session of its own.

Overload 2 of 2

Signature
Rotate
    Cad Builder: Cad Builder
    angle: Number
    axis: Vector3d
    children: Action<Cad Builder>
void Rotate(
    CadBuilder Cad Builder,
    double angle,
    Vector3d axis,
    Action<CadBuilder> children)

Adds what a block builds, turned about an axis through the origin: OpenSCAD's rotate(a, [x, y, z]) { ... }, in radians.

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
angleNumber—How far, in radians, right-handed about the axis.
axisVector3d—The axis's direction.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Rotate Extrude

Function

Adds a flat shape a block draws, turned about the Z axis: OpenSCAD's rotate_extrude(angle) { ... } (Cad.RotateExtrude; the angle is in radians).

Signature
RotateExtrude
    Cad Builder: Cad Builder
    angle: Number
    children: Action<Cad Shape Builder>
void RotateExtrude(
    CadBuilder Cad Builder,
    double angle,
    Action<CadShapeBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
angleNumber—How far round, in radians.
childrenAction<Cad Shape Builder>—The block, drawing in a flat session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Scale

Function

Adds what a block builds, scaled about the origin: OpenSCAD's scale([x, y, z]) { ... }.

Signature
Scale
    Cad Builder: Cad Builder
    x: Number
    y: Number
    z: Number
    children: Action<Cad Builder>
void Scale(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
xNumber—The factor along X.
yNumber—The factor along Y.
zNumber—The factor along Z.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Set

Function

Replaces the current model on success. Ignores placement; useful for fillets, shells, undo and restoring snapshots.

Signature
Set(Cad Builder: Cad Builder, model: Cad Model)
void Set(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Transform Current

Function

Transforms all current geometry; does not change the placement used for subsequent additions.

Signature
TransformCurrent(Cad Builder: Cad Builder, transform: Transform)
void TransformCurrent(
    CadBuilder Cad Builder,
    Transform transform)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
transformTransform—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Translate

Function

Adds what a block builds, moved: OpenSCAD's translate([x, y, z]) { ... }. The block's children are one child here.

Signature
Translate
    Cad Builder: Cad Builder
    x: Number
    y: Number
    z: Number
    children: Action<Cad Builder>
void Translate(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
xNumber—How far along X.
yNumber—How far along Y.
zNumber—How far along Z.
childrenAction<Cad Builder>—The block, given a session of its own.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Try Set

Function

Attempts to replace Current without throwing for a geometric failure. Argument errors still throw. No state changes on failure.

Signature
TrySet -> Cad Evaluation
    Cad Builder: Cad Builder
    model: Cad Model
CadEvaluation TrySet(CadBuilder Cad Builder, CadModel model)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
modelCad Model—

Returns

resultCad Evaluation
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Union Group

Function

Runs a nested construction in an independent session, then unions the completed model as one atomic edit. Exceptions leave the parent unchanged.

Signature
UnionGroup
    Cad Builder: Cad Builder
    action: Action<Cad Builder>
void UnionGroup(
    CadBuilder Cad Builder,
    Action<CadBuilder> action)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
actionAction<Cad Builder>—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

With Transform

Function

Executes a placement scope and restores placement even if the action throws. Successful individual edits remain committed, each a child of this session.

Signature
WithTransform
    Cad Builder: Cad Builder
    local: Transform
    action: Action<Cad Builder>
void WithTransform(
    CadBuilder Cad Builder,
    Transform local,
    Action<CadBuilder> action)

Parameters

nametypedefaultdescription
Cad BuilderCad Builder—
localTransform—
actionAction<Cad Builder>—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD

Begin

Function

Creates an empty session from a graph node.

Signature
Begin(tolerance: Number) -> Cad Builder
CadBuilder Begin(double tolerance = 1E-06)

Parameters

nametypedefaultdescription
toleranceNumber1E-06

Returns

resultCad Builder
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
CAD Builder
Package
CAD