Author: Brendon Collecutt
Contact: 1976016983@qq.com
This file is part of Stemfie_OpenSCAD.
Stemfie_OpenSCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Stemfie_OpenSCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Stemfie_OpenSCAD. If not, see https://www.gnu.org/licenses/.
Please check https://stemfie.org/license for more information or before using stemfie commercially.
OpenSCAD script for creating Stemife.org parts.
Feel free to adapt and improve and share your OpenSCAD script (please contact Paulo Kiefe)
Contact: paulo.kiefe@stemfie.org (https://stemfie.org)
To use, add the following lines to the beginning of your file:
include <stemfie.scad>Description:
Universal voxel block unit (mm) in Stemfie (BlockUnit)
Description:
Universal radius (mm) of the connection hole
Description:
Universal tesselation value of curved surfaces
Description:
Chamfer size adjustment value for all edges
Description:
Width of the top section of beveled edges. Must be less or equal to twice printer nozzle diameter to ensure level top surface.
Description:
Distance between hole and shafts and other parts that need to move relatively to each other.
Description:
Universal radius (mm) of the connection shaft
Description:
Universal radius (mm) of the connection pin
Description:
Universal distance (mm) between two flat sides of the shafts.
Description:
Universal distance (mm) between two flat sides of pin and screw fasteners.
Description:
Universal pitch (mm) for Stemfie threaded fasteners
Usage:
- beam_block(size, holes, center);
Description:
Creates a Stemfie beam with holes.
Arguments:
| By Position | What it does |
|---|---|
size |
Size of block to create in block units. |
holes |
Array of booleans in xyz order for which directions to create holes or a single boolean for all directions. |
Example 1: Standard Stemfie beam
include <stemfie.scad>
beam_block(3);Example 2: Stemfie beam with vertical holes only.
include <stemfie.scad>
beam_block(3, holes = [false, false, true], center = false);Example 3: Stemfie 3D "beam"
include <stemfie.scad>
beam_block([3, 2, 2]);Usage:
- beam_threaded(length);
Description:
Creates a stemfie beam with threaded ends.
Example 1:
include <stemfie.scad>
beam_threaded(4);Usage:
- beam_cross(lengths);
Description:
Overlaps two Stemfie beams. It can be used to create 'V', 'L', 'T' and 'X' shapes.
Arguments:
| By Position | What it does |
|---|---|
lengths |
Array of 2, 3 or 4 integers. Lengths extending from intersection block with clockwise ordering. |
Example 1: 'V' beam
include <stemfie.scad>
beam_cross([3,3]);Example 2: 'L' beam
include <stemfie.scad>
beam_cross([5,3]);Example 3: 'T' beam
include <stemfie.scad>
beam_cross([2,3,2]);Example 4: 'X' beam
include <stemfie.scad>
beam_cross([2,2,2,2]);Usage:
- brace(size, <h=>, <holes=>);
Description:
Creates a Stemfie brace with holes.
Arguments:
| By Position | What it does |
|---|---|
size |
Length of brace to create in block units. |
h |
height of brace |
holes |
Set to false to create blank brace. |
Example 1: Standard Stemfie brace
include <stemfie.scad>
brace(3);Example 2: Double thickness blank brace
include <stemfie.scad>
brace(3, h = 0.5, holes = false);Usage:
- brace_cross(lengths, <h>);
Description:
Overlaps two Stemfie brace. It can be used to create 'V', 'L', 'T' and 'X' shapes.
Arguments:
| By Position | What it does |
|---|---|
lengths |
Array of 2, 3 or 4 integers. Lengths extending from intersection block with clockwise ordering. |
h |
Height of brace, default = 0.25BU |
Example 1: 'V' brace
include <stemfie.scad>
brace_cross([3,3]);Example 2: 'L' brace
include <stemfie.scad>
brace_cross([5,3]);Example 3: 'T' brace
include <stemfie.scad>
brace_cross([2,3,2]);Example 4: Double thickness 'X' brace
include <stemfie.scad>
brace_cross([1, 1, 1, 1], 0.5);Usage:
- brace_arc(r, angle, h = 0.25, holes = 2);
Description:
Creates a circular arc brace. Detects when hole spacing is less than 1 block unit and reduces the number of holes as necessary. If the angle is too big and the end point overlaps the start point then the angle is set to 360 and a circular brace is created.
Arguments:
| By Position | What it does |
|---|---|
r |
Radius in block units to the center of the brace. |
angle |
Angle between start and end points. |
Example 1: Holes with 60 degree spacing have 1 radius spacing.
include <stemfie.scad>
brace_arc(2, 120, holes = 3);Example 2: Number of holes are reduced to fit of brace.
include <stemfie.scad>
brace_arc(3, 360, holes = 100);Example 3: Angle adjusted to 360 to prevent overlap.
include <stemfie.scad>
brace_arc(3, 350, holes = 12);Usage:
- screw(thread_length, shaft_length = 0.125, screw_head = true);
Description:
Creates a stemfie screw.
Example 1: Add 0.125 BU of unthreaded shaft to get that standard look.
include <stemfie.scad>
screw(1.375, 0.125);Example 2:
include <stemfie.scad>
screw(0.5, 3);Example 3:
include <stemfie.scad>
screw(1.5, screw_head = false);Usage:
- pin(length, head = true);
Description:
Creates an almost standard stemfie pin.
Example 1:
include <stemfie.scad>
pin(length = 1, head = true);Usage:
- nut_open(length = 5/BU, center = true);
Description:
Creates a threaded open nut.
Example 1: Standard 5mm open nut
include <stemfie.scad>
nut_open();Example 2: 1 block unit threaded nut.
include <stemfie.scad>
nut_open(1);Usage:
- module spacer(length = 0.25, center = true);
Description:
Creates a free spacer to fit over a shaft or fastener.
Example 1:
include <stemfie.scad>
spacer(length = 0.5, center = false);Usage:
- fixed_washer(length = 0.25, center = true);
Description:
Creates a fixed washer to fit a fastener.
Example 1: Standard 0.25 block unit fixed washer
include <stemfie.scad>
fixed_washer();Example 2: 10mm fixed washer
include <stemfie.scad>
fixed_washer(10 / BU);Usage:
- hole(depth = 1, neg = true, bevel = [true,true]);
Description:
Create a circular standard sized hole with beveled top and bottom.
Arguments:
| By Position | What it does |
|---|---|
depth |
The depth of the hole in base units. |
neg |
true to create hole cavity, false to create sleeve and bevel. |
bevel |
[bevel on top, bevel on bottom] |
Example 1:
include <stemfie.scad>
difference()
{
BU_cube();
hole(depth = 1, neg = true);
}Example 2:
include <stemfie.scad>
hole(depth = 1, neg = false);Example 3:
include <stemfie.scad>
difference()
{
hole(depth = 1, neg = false);
hole(depth = 1, neg = true);
}Usage:
- cutout(depth, neg = true, bevel = [true,true]);
Description:
Create an irregular sized hole with beveled top and bottom. Children should be a convex 2D shape.
Arguments:
| By Position | What it does |
|---|---|
depth |
The depth of the cutout in base units. |
neg |
true to create cutout cavity, false to create sleeve and top bevel. |
bevel |
[bevel on top, bevel on bottom] |
Example 1: Create a brace with a slot down most of the length.
include <stemfie.scad>
difference()
{
union()
{
brace(4, holes = false);
cutout(depth = 0.25, neg = false)
BU_Tx(1)
hole_slot(length = 3);
}
cutout(depth = 0.25, neg = true)
BU_Tx(1)
hole_slot(length = 3);
}Example 2: Shaft shaped hole in brace.
include <stemfie.scad>
difference()
{
union()
{
brace(4, holes = false);
cutout(depth = 0.25, neg = false)
offset(r=Clearance)
shaft_profile();
}
cutout(depth = 0.25, neg = true)
offset(r=Clearance)
shaft_profile();
}Usage:
- hole_grid(size, <l=1>, <neg=true>);
Description:
Creates a rectangular array of holes centered on the origin with block unit spacing.
Arguments:
| By Position | What it does |
|---|---|
size |
List with number of holes in X and Y directions. |
l |
See hole() |
neg |
See hole() |
Example 1: Create a 4x5 block with vertical holes.
include <stemfie.scad>
difference()
{
BU_cube([4,5,1]);
hole_grid([4,5]);
}Example 2: Create a 4x5x0.25 block unit plate with holes.
include <stemfie.scad>
difference()
{
union()
{
bevel_plate(h = 0.25)
offset(r = BU/2)
square([3 * BU, 4 * BU], center = true);
hole_grid([4,5], l = 0.25, neg = false);
}
hole_grid([4,5], l = 0.25);
}Usage:
- hole_list(list, <l=1>, <neg=true>);
Description:
Creates a rectangular array of holes centered on the origin with block unit spacing.
Arguments:
| By Position | What it does |
|---|---|
list |
List with location of holes by X,Y co-ordinates in block units. |
l |
See hole() |
neg |
See hole() |
Example 1: Create brace with custom hole locations
include <stemfie.scad>
difference()
{
union()
{
brace(5, holes = false);
hole_list([[0,0],[4,0]], l = 0.25, neg = false);
}
hole_list([[0,0],[4,0]], l = 0.25);
}Usage:
- hole_slot(length);
Description:
Create a 2D slot profile with radius equal to HoleRadius and length l.
Arguments:
| By Position | What it does |
|---|---|
l |
Length of slot in block units. |
Example 1:
include <stemfie.scad>
hole_slot(2);Usage:
- BU_slot(length);
Description:
Create a 2D slot profile with radius BU/2
Arguments:
| By Position | What it does |
|---|---|
l |
Length of slot in block units. |
Example 1:
include <stemfie.scad>
BU_slot(2);Usage:
- slot(length, r);
Description:
Create a 2D slot profile.
Arguments:
| By Position | What it does |
|---|---|
length |
Length of slot in block units. |
Example 1:
include <stemfie.scad>
slot(2, r = 2 + Clearance);Usage:
- thread(length, internal = false, bevel = false, center = true);
- thread(length, internal = false, bevel = [false, false], center = true);
Example 1:
include <stemfie.scad>
difference()
{
BU_cube([1,1,1]);
thread(2, internal = true, center = true, bevel = [true,false]);
}Usage:
- bevel(offs = 0, neg = true);
Description:
Creates a bevel from a convex 2D profile using Chamfer.
Figure 1: Calling bevel() on a concave shape results in a convex bevel.
Figure 2: Instead break shape into convex shapes call bevel on each shape.
Example 1:
include <stemfie.scad>
bevel(neg = false)
circle(r = HoleRadius);Usage:
- shaft_profile();
Description:
Creates a stemfie 2D profile for creating shafts and screws.
Example 1:
include <stemfie.scad>
shaft_profile();Usage:
- fastener_profile();
Description:
Creates a stemfie 2D profile for creating pins and screws.
Example 1:
include <stemfie.scad>
fastener_profile();Usage:
- pin_profile();
Description:
Creates a stemfie 2D profile for creating pins.
Example 1:
include <stemfie.scad>
pin_profile();Usage:
- fastener_head_profile()
Description:
Creates a stemfie 2D profile for creating shafts and screw heads.
Example 1:
include <stemfie.scad>
fastener_head_profile();Usage:
- fastener_head()
Description:
Creates a stemfie fastener head for creating pins and screws.
Example 1:
include <stemfie.scad>
fastener_head();Usage:
- shaft(length, beveled_ends)
Description:
Creates a stemfie blank shaft for creating shafts and screws.
Arguments:
| By Position | What it does |
|---|---|
length |
The length of the shaft in base units. |
beveled_ends |
Bevel ends of shaft using the global Chamfer setting. |
Example 1: Shaft with beveled ends
include <stemfie.scad>
shaft(4, true);Example 2: Shaft without beveled ends
include <stemfie.scad>
shaft(4, false);Usage:
- nut_blank(length = 0.25, center = true)
Description:
Creates a nut template with solid interior that can be used to create nuts and washers.
Example 1:
include <stemfie.scad>
nut_blank(0.5);Usage:
- BU_cube(size = [1,1,1]);
Description:
Create a beveled cube of given size in block units.
Arguments:
| By Position | What it does |
|---|---|
BU_cube |
Size of cube |
Example 1:
include <stemfie.scad>
BU_cube();Example 2:
include <stemfie.scad>
BU_cube([3,1,1]);Modified from Rudolf Huttary's shortcuts.scad
Usage:
- BU_T(x, y, z);
- BU_T([x, y, z]);
Description:
Shortcut for translate([x * BU, y * BU, z * BU])
Usage:
- BU_TK(x, y, z);
- BU_TK([x, y, z]);
Description:
Children at origin and translation.
Example 1: One block unit cube centered at origin and one at [3 * BU, 0, 0]
include <stemfie.scad>
BU_TK(3, 0 , 0) BU_cube();Usage: BU\_Tx(x)
Description:
Shortcut for translate([x * BU, 0, 0])
Usage: BU\_Ty(y)
Description:
Shortcut for translate([0, y * BU, 0])
Usage: BU\_Tz(z)
Description:
Shortcut for translate([0, 0, z * BU])
Usage: BU\_TKx(x)
Description:
Alternative for BU_TK(x=x)
Usage: BU\_TKy(z)
Description:
Alternative for BU_TK(y=y)
Usage: BU\_TKz(z)
Description:
Alternative for BU_TK(z=z)



















































