These commands are ReDo.Core's own. Code that uses them will not run in OpenSCAD. The table at the end of this page is drawn from the compiler's own list.

Chamfers

A chamfer cuts a small slope along an edge, as a printed or machined part has. Put the chamfer round the solid before drilling it, so the holes keep sharp edges:

difference() {
    chamfer(0.5) cube([30, 20, 10]);
    translate([15, 10, 0]) cylinder(h = 10, d = 3);
}

chamfer_z, chamfer_r and chamfer_upright break only some edges: the ones in one plane, the circles of one radius, or the upright ones. Each refuses a plane or radius no edge sits on, so a typo does not pass silently.

Rounded edges, hollows, lofts and sweeps

fillet(r) rounds every edge the way chamfer(d) breaks them. Both take edges = with a selector that picks some edges by what they are: ">Z" the ones highest up, "|Z" the upright ones, "on >Z" the rim of the top face, "r=5" circles of that radius, "%CIRCLE" by kind, joined with and. A selector that names no edge is refused, as a typo should be, and the refusal says what the shape has. Two values do more: fillet([1, 3], …) runs the radius from 1 to 3 along each edge, and chamfer([1, 3], …) cuts 1 on one of the edge's faces and 3 on the other. from = names the face the first value belongs to: fillet([1, 3], edges = "|Z", from = "<Z") starts at 1 where the edges meet the bottom, chamfer([1, 3], edges = "on >Z", from = ">Z") cuts 1 down the top face and 3 into the sides. Without it, the first value takes the edge's own start, or its lower-numbered face as the face listing numbers them.

fillet(2, edges = "|Z") cube([30, 20, 10]);
chamfer(0.5, edges = "on >Z") cube([30, 20, 10]);

shell(t, faces = ">Z") hollows a solid to a wall t thick with the named faces open, so a box becomes a tray; without faces it is a closed hollow. loft() runs a solid through 2D children, each translated to its height (ruled = true keeps the sides straight between them). sweep(path = [[x, y, z], ...]) runs a 2D child, drawn about the origin, along the path: straight between the points, or smooth = true along one curve through them.

shell(2, faces = ">Z") cube([40, 30, 20]);
loft() { circle(10); translate([0, 0, 30]) square(8, center = true); }
sweep(path = [[0, 0, 0], [0, 0, 30], [30, 0, 30]]) circle(3);

Building on a face

on_face(selector) { base; children } draws the later children on each face of the base the selector names: their origin sits on the face, their Z points out of it. A boss stands on the top face as on_face(">Z") { base; cylinder(d = 8, h = 5); }, a peg on a cylinder's side as on_face("%CYLINDER") (there the frame's X runs along the cylinder's axis), and cut = true subtracts them instead, so a hole drilled 6 deep from the top face is translate([0, 0, -6]) cylinder(d = 3, h = 6) in that frame. draft(a, faces = "|Z") tilts the named faces by a degrees so the solid narrows upwards (pull = [0, 0, -1] for downwards), the mould's release taper.

on_face(">Z", cut = true) { fillet(1, edges = "|Z") cube([30, 20, 10]); translate([0, 0, -10]) cylinder(d = 3, h = 10); }
draft(3, faces = "|Z") cube([30, 20, 10]);

Many holes at once

difference() cuts its holes one at a time, and each costs more than the last. Gather the holes in disjoint() and they are cut in one pass: a hundred holes take a fraction of the time.

difference() {
    cube([100, 100, 5]);
    disjoint() for (x = [5 : 10 : 95], y = [5 : 10 : 95]) translate([x, y, -1]) cylinder(h = 7, d = 3);
}

It only works when its children do not overlap, and it refuses ones that do. Keep overlapping cutters in the difference() itself.

Short moves

up(5) is translate([0, 0, 5]), zrot(90) is rotate([0, 0, 90]), and xflip() mirrors across X. They read better in a long part.

Paint and finish

  • color("red") paints a piece in a colour that never changes, such as a metal pin.
  • stock("body", "#ffffff") paints the piece a person may repaint in the Material panel. A part has one.
  • material("brass") gives a piece a finish from ReDo's materials library, or a finish of its own: material(color = "teal", metalness = 0.8).

Joins

feature(), port() and face() build nothing. They tell the Playground where a part's holes, pins, sockets and flat faces are, so it can join them to other parts. Holes, pins and sockets explains them.

Real threads

helix_extrude(height, pitch) turns a 2D profile about Z as rotate_extrude() does, and raises it pitch with every turn, so one tooth drawn in X and Y becomes a thread's ridge. iso_thread(d, pitch, length) uses it to build a real ISO metric thread; subtract it to cut a tapped bore instead. A real thread is far heavier to build and draw than a drawn one, so use it where the flanks matter, such as a part you mean to print or send as a CAD file.

include <redo_constants.scad>
iso_thread(3, 0.5, 12);

Drawn lines

thread_edge() draws a thread as lines over a screw or a bore, rather than cutting it, which would cost far more to draw. drawn_line() draws any other line on a part, such as a logo on a stud. Lines add nothing to the solid.

union() {
    cylinder(h = 12, d = 3);
    thread_edge(3, 12, 0.5);
}

Every addition

Combining

CallArgumentsWhat it does
disjoint()noneGathers children that may touch but not overlap, without fusing them: as the cutter in a difference(), a field of holes cut in one pass. Refuses children that overlap.
exclusive_or()noneKeeps what lies in some of its children but not in all of them.

Drawn outlines

CallArgumentsWhat it does
svg_path()dDraws SVG path data d as a 2D shape, a millimetre a user unit and Y turned up: lines, Béziers and arcs as exact curves, subpaths filled even-odd. Refuses outlines that cross.

Chamfers

CallArgumentsWhat it does
chamfer()d; by name also edges, fromBreaks every edge of its children by d mm.
chamfer_z()d, zBreaks only the edges lying in the plane at height z.
chamfer_r()d, r, zBreaks only the circles of radius r about Z, those at height z if given.
chamfer_upright()dBreaks only the edges running straight up Z: an octagon from above, a rectangle from the side.

Rounds, hollows, lofts and sweeps

CallArgumentsWhat it does
fillet()r; by name also edges, fromRounds every edge of its children by r mm, or those edges = names with a selector (">Z", `"Z", "on >Z", "r=5", joined with and); chamfer takes the same edges`. Refuses a radius that does not fit.
shell()t; by name also facesHollows its children to a wall t thick, the faces faces = names left open (">Z" for a tray); none named, a closed hollow.
draft()a, faces, pullTilts the faces faces = names by a degrees so the solid narrows along pull (up unless given), the outline where it starts kept: a mould's release taper.
on_face()faces, cutDraws its later children on each face of its first child the selector names, their origin on the face and Z pointing out of it, then adds them, or with cut = true cuts them: a boss on the top, a hole drilled from it.
loft()ruledRuns a solid through its 2D children in order, each where its translate put it; ruled = true keeps the sides straight between them.
sweep()path, frenet, smoothRuns its 2D child, drawn about the origin, along path = [[x, y, z], …]: straight between the points with rounded corners, or smooth = true along one curve through them; frenet = true keeps the profile from turning about the path.

Short moves

CallArgumentsWhat it does
move()vtranslate(v) by a shorter name.
left()xMoves by x towards -X.
right()xMoves by x towards +X.
fwd()yMoves by y towards -Y.
back()yMoves by y towards +Y.
down()zMoves by z towards -Z.
up()zMoves by z towards +Z.
xrot()aTurns by a degrees about X.
yrot()aTurns by a degrees about Y.
zrot()aTurns by a degrees about Z.
xflip()noneMirrors across the plane X = 0.
yflip()noneMirrors across the plane Y = 0.
zflip()noneMirrors across the plane Z = 0.

Paint and finish

CallArgumentsWhat it does
stock()name, cPaints its children colour c and names them name: the one region a person may repaint. One per part.
material()name, color, roughness, metalness, texture, scale, reliefGives its children a finish: a library material by name, or its own colour, roughness, metalness and texture.
moving()noneMarks its children as the piece the part's motion turns or slides: a motor's shaft, a servo's horn.

Holes, pins, sockets and faces

CallArgumentsWhat it does
feature()name, sex, d, from, to, threaded, role, blind, tag, label, key, flat, flats, gear_teeth, gear_module, gear_face, seat, slot, gear_tooth, terminal, gear_apex, thread_pitch, thread_starts, gear_cone, self_tapping, centred, bead, splined, spline_teeth, gear_back, thread_crest, gear_rack, drives, gear_wormDeclares a hole or a pin the Playground can join, from from to to, d across. No geometry.
port()name, connector, from, to, across, size, ways, pitch, lead, label, pinsDeclares a socket a connector cable plugs into. No geometry.
face()name, at, normal, across, size, labelDeclares a flat face another part's face can sit flush against. No geometry.

Drawn lines

CallArgumentsWhat it does
thread_edge()d, length, pitch, side, segmentsDraws a thread as a helix of lines over a shank or a bore, side "male" or "female". No geometry.
drawn_line()pointsDraws a line through points over the part. No geometry.