Skip to content

Instantly share code, notes, and snippets.

@Stemer114
Stemer114 / screw_countersunk.scad
Created February 16, 2015 21:22
openscad module to model countersunk screw (with head), useful for subtracting when constructing attachment bores
// model countersunk screw for 3d printing
// useful for creating attachement bores
// which fit these screws
// default values are for 3mm x 20mm screw with 6mm head (3.2mm bore for tolerance)
module screw_countersunk(
l=20, //length
dh = 6, //head dia
lh = 3, //head length
ds = 3.2, //shaft dia
)
@Stemer114
Stemer114 / ring.scad
Created February 16, 2015 21:25
openscad ring (with cutout)
// ring with cutout
// default values are for 1mm height, 10mm outside diameter and 5mm cutout
// de is epsilon environment to make cutouts non-manifold
module ring(
h=1,
od = 10,
id = 5,
de = 0.1
)
{
@Stemer114
Stemer114 / beams.scad
Last active August 29, 2015 14:15
modules for beams (just long cubes, really, but axis-centered and parametric, therefore easy to use)
// beam with length in x direction
// it is centered along its central axis at the x axis
module beam_x(
wy = 10, //width
wz = 10, //height
l = 100 //length
)
{
translate([0, -wy/2, -wz/2])
cube([l, wy, wz]);
@Stemer114
Stemer114 / tribeam.scad
Created February 22, 2015 19:55
openscad modules for tribeams (rectangular beams with triangular support underneath, for overhanging printing)
/* beam with triangular support underneath,
* length direction is x
* beam dimensions are w, h1
* support (triangle) height is h2
* the beam is centered around the center of the rectangle
*/
module tribeam_x(
w = 10, //width
h1 = 10, //height of rectangular sub-beam
h2 = 5, //height of triangular sub-beam
@Stemer114
Stemer114 / nut_trap.scad
Last active February 1, 2023 22:07
openscad nut trap module
//nut trap
//default values are for M3 nut
//if you use this module as a nut trap cutout, you need to add +de (ie 0.1mm or similiar) to height
//in order to get non-manifold cutouts
module nut_trap (
w = 5.5,
h = 3
)
{
cylinder(r = w / 2 / cos(180 / 6) + 0.05, h=h, $fn=6);
module slot_hole(
width = 5, //width/dia at ends
length = 20, //length
thickness = 5 //thickness
)
{
hull() {
translate([-length/2+width/2, 0, 0]) polyhole(h=thickness, d=width);
translate([length/2-width/2, 0, 0]) polyhole(h=thickness, d=width);
}
@Stemer114
Stemer114 / right_triangle.scad
Created July 16, 2015 21:19
right triangle
// right triangle
// side a oriented in x direction
// side b oriented in y direction
// height is in z direction
module right_triangle(
a = 10, //side a (x direction)
b = 10, //side b (y direction)
thickness = 5 //thickness (z-direction)
)
{
@Stemer114
Stemer114 / hexhead_screw.scad
Last active August 29, 2015 14:26
screw with hex head
// screw with hex head
// useful for modelling attachment bores
// with nut trap
// default values are for M3 (5.5mm head) screw 20mm (3.2mm bore for tolerance)
// param membrane thickness is for additional layer between head and shaft,
// for upside down printing, usually set this to your layer thickness
module hexhead_screw(
length=20, //per definition, excluding head
head_wrenchsize = 5.6,
head_thickness = 3,
@Stemer114
Stemer114 / template_simple.scad
Created August 9, 2015 10:15
template simple (without params or flags)
/*-----------------------------------------------------------------------------------
simple template for scad models without flags or params
(c) 2015 by Stemer114 (stemer114@gmail.com)
http://www.thingiverse.com/Stemer114/designs
License: licensed under the
Creative Commons - Attribution - Share Alike license.
http://creativecommons.org/licenses/by-sa/3.0/
Credits:
@Stemer114
Stemer114 / difference_of_unions.scad
Created August 10, 2015 21:29
difference of unions
/*
* module template for creating complex structures in openscad
* uses a difference of two unions
* the first union contains all openscad entities that make up the
* outline of the object
* the second union is for shaping by cutting away
*/
module foo()
{
difference()