Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active September 16, 2024 14:28
Show Gist options
  • Save creationix/a2d81d756564fcfafb88 to your computer and use it in GitHub Desktop.
Save creationix/a2d81d756564fcfafb88 to your computer and use it in GitHub Desktop.
Shed design. Open in OpenScad to view 3d model.
windows = false; // show windows
stuff = false; // Show bikes, table, mower
l = 32; // Length of building in feet (16, 20, 24, 28, 32, ...)
h = 8*12-4.5+.5;
rl=6*12+1.375+.1; // cut to 73.5" long with 22.5 degree angles
tl = 68.7; // Used to tweak headers on top walls
// 2x6 concrete forms for foundation
// 10" wide grid
// rebarb reinforced. 3/8
module Foundation() {
color([.9,.9,.9]) {
cube([16*12,l*12,12]);
}
}
module FloorRafters(ll) {
color([.95,.8,.6]) {
translate([0, 0, 0])
cube([16*12, 1.5, 9.5]);
for (i = [1:ll*12/24-1]) {
translate([1.5, 24 * i - .75, 0])
cube([16*12-3, 1.5, 9.5]);
}
translate([0, ll*12-1.5, 0])
cube([16*12, 1.5, 9.5]);
translate([0, 1.5, 0])
cube([1.5, ll*12-3, 9.5]);
translate([16*12-1.5,1.5,0])
cube([1.5,ll*12-3,9.5]);
}
};
module LowerSubfloor() color([.9, .8, .7]) {
for (x = [0:4:16-4]) {
for (y = [0:8:l-8]) {
if (x % 8 == 0) {
translate([x*12,y*12,0])
cube([4*12, 8*12, .703]);
}
else {
if (y <= l - 12) {
translate([x*12,(y+4)*12,0])
cube([4*12, 8*12, .703]);
}
else {
translate([x*12,(y+4)*12,0])
cube([4*12, 4*12, .703]);
translate([x*12,0,0])
cube([4*12, 4*12, .703]);
}
}
}
}
}
module UpperSubFloor() color([.9, .8, .7]) {
for (x = [0:4:16-4]) {
for (y = [0:8:l-8]) {
difference() {
if (x % 8 == 0) {
translate([x*12,y*12,0])
cube([4*12, 8*12, .703]);
}
else {
if (y <= l - 12) {
translate([x*12,(y+4)*12,0])
cube([4*12, 8*12, .703]);
}
else {
translate([x*12,(y+4)*12,0])
cube([4*12, 4*12, .703]);
translate([x*12,0,0])
cube([4*12, 4*12, .703]);
}
}
translate([5.5,5.5,-.01]) {
cube([119.5-11.5,48,3]);
cube([48,113.75,3]);
}
}
}
}
}
module SideWall(w, ll, ac, e) {
// Window
if (windows && w) %translate([-1, w*24+.75+1.5, 34+12])
cube([5, 36, 36]);
// Air conditioner.
if (windows && ac) %translate([-1, ac*24+.75+1.5, 64])
cube([23, 23+7/8, 18]);
// Bottom Plate
cube([5.5,ll*12,1.5]);
// Top Double Plate
translate([0, 0, h+1.5])
cube([5.5, ll*12, 1.5]);
if (e) {
translate([0, 5.5, h+3])
cube([5.5, ll*12, 1.5]);
}
else {
translate([0, 5.5, h + 3])
cube([5.5, ll*12-11, 1.5]);
}
// Studs
translate([0,0,1.5])
cube([5.5, 1.5, h]);
if (e) translate([0,5.5,1.5])
cube([5.5, 1.5, h]);
if (w) {
if (w >= 1) for (i = [1:w]) {
if (i != ac + 1)
translate([0,24*i-.75,1.5])
cube([5.5, 1.5, h]);
}
translate([0, w*24, 0])
lowerWindow();
if (ll*12/24-1 >= w + 2) for (i = [w+2:ll*12/24-1]) {
if (i != ac)
translate([0,i*24-.75,1.5])
cube([5.5, 1.5, h]);
}
}
else for (i = [1:ll*12/24-1]) {
if (i!= ac + 1)
translate([0,24*i-.75,1.5])
cube([5.5, 1.5, h]);
}
if (ac) translate([0, ac*24, 0])
ac();
// Corner studs
translate([0,ll*12-1.5, 1.5])
cube([5.5, 1.5, h]);
if (!e) translate([0,ll*12-7, 1.5])
cube([5.5, 1.5, h]);
}
module UpperFloor() color([.95,.8,.6]) {
// First
cube([16*12, 1.5, 9.5]);
// Short
for (i = [1:2]) {
translate([126.5, 24 * i - .75, 0])
cube([64, 1.5, 9.5]);
}
// Medium
for (i = [3:4]) {
translate([55, 24 * i - .75, 0])
cube([135.5, 1.5, 9.5]);
}
// Full width
for (i = [5:7]) {
translate([1.5, 24 * i - .75, 0])
cube([16*12-3, 1.5, 9.5]);
}
// Last
translate([0, 16*12-1.5, 0])
cube([16*12, 1.5, 9.5]);
translate([5.5+48,53.5, 0]) // Medium cap
cube([1.5, 41.75+24, 9.5]);
translate([55,55-1.5, 0]) // med-to-small
cube([70.25, 1.5, 9.5]);
translate([125,1.5, 0]) // small cap
cube([1.5, 69.75, 9.5]);
translate([5.5,4, 0])
cube([119.75, 1.5, 9.5]);
translate([4, 1.5, 0])
cube([1.5, 93.75+24, 9.5]);
// Edges
translate([0,1.5, 0])
cube([1.5, 16*12-3, 9.5]);
translate([12*16-1.5,1.5, 0])
cube([1.5, 16*12-3, 9.5]);
}
module Back() {
// Bottom Plate
translate([5.5,0,0])
cube([16*12-11,5.5,1.5]);
// Back Wall
translate([5.5,0,1.5])
cube([1.5, 5.5, h]);
for (i = [1:7]) {
translate([24*i-.75,0,1.5])
cube([1.5, 5.5, h]);
}
translate([16*12-5.5-1.5,0,1.5])
cube([1.5, 5.5, h]);
// Top double plate
translate([5.5,0,h + 1.5])
cube([16*12-11,5.5,1.5]);
translate([0,0,h + 3])
cube([16*12,5.5,1.5]);
}
module lowerWindow() {
translate([0,.75,1.5]) // Jack Stud
cube([5.5, 1.5, 80.5]);
translate([0,.75,82]) // Header 0
cube([5.5, 36+3, 1.5]);
translate([0,.75,83.5]) // Header 1
cube([5.5, 36+3, 1.5]);
translate([0,2.25,32.5+12]) // Sill
cube([5.5, 36, 1.5]);
translate([0,24-.75,85]) // Upper Cripple
cube([5.5, 1.5, h-83.5]);
translate([0,24-.75,1.5]) // Lower Cripple
cube([5.5, 1.5, 34-3+12]);
translate([0,36+2.25,1.5]) // Jack Stud
cube([5.5, 1.5, 80.5]);
translate([0,36++3.75,1.5]) // King Stud
cube([5.5, 1.5, h]);
}
module ac() {
translate([0,.75,1.5]) // Jack Stud
cube([5.5, 1.5, 80.5]);
translate([0,.75,82]) // Header 0
cube([5.5, 23+7/8+3, 1.5]);
translate([0,.75,83.5]) // Header 0
cube([5.5, 23+7/8+3, 1.5]);
translate([0,2.25,62.5]) // Sill
cube([5.5, 23+7/8, 1.5]);
translate([0,24-.75,85]) // Upper Cripple
cube([5.5, 1.5, h-83.5]);
translate([0,24-.75,1.5]) // Lower Cripple
cube([5.5, 1.5, 61]);
translate([0,23+7/8+.75+1.5,1.5]) // Jack Stud
cube([5.5, 1.5, 80.5]);
translate([0,23+7/8+.75+3,1.5]) // King Stud
cube([5.5, 1.5, h]);
}
module Front() {
// Big Door
if (windows) %translate([58.5,-1,0])
cube([75,7,83.5]);
// Bottom Plate
translate([5.5,0,0])
cube([60-5.5-1.5,5.5,1.5]);
translate([133.5,0,0])
cube([60-5.5-1.5,5.5,1.5]);
// Studs and Frames
translate([5.5,0,1.5])
cube([1.5, 5.5, h]);
translate([24-.75,0,1.5])
cube([1.5, 5.5, h]);
translate([48-.75,0,1.5])
cube([1.5, 5.5, h]);
translate([60-4.5,0,1.5]) // King Stud
cube([1.5, 5.5, h]);
translate([60-3,0,1.5]) // Jack Stud
cube([1.5, 5.5, 82]);
translate([60-3,0, 83.5]) // header 0
cube([78, 5.5, 1.5]);
translate([60-3,0, 85]) // header 1
cube([78, 5.5, 1.5]);
for (i = [3:5]) { // Cripples
translate([24*i-.75,0, 90.5-4])
cube([1.5, 5.5, h-89+4]);
}
translate([133.5,0,1.5]) // Jack Stud
cube([1.5, 5.5, 82]);
translate([132+3,0,1.5]) // King Stud
cube([1.5, 5.5, h]);
translate([144-.75,0,1.5])
cube([1.5, 5.5, h]);
translate([168-.75,0,1.5])
cube([1.5, 5.5, h]);
translate([192-7,0,1.5])
cube([1.5, 5.5, h]);
// Top Double Plate
translate([5.5, 0, h + 1.5])
cube([181,5.5,1.5]);
translate([0, 0, h + 3])
cube([192,5.5,1.5]);
}
module TopWall() {
if (windows) %translate([72,-1,24])
cube([48,5,48]);
// Base plate
translate([5.5,0,0])
cube([16*12-11,5.5,1.5]);
// Top Plate
t = .5;
s = 5.7;
translate([s, 0, t])
rotate([0,22.5,0])
cube([1.5,5.5,tl]);
translate([s + sin(22.5)*tl, 0, t+cos(22.5)*tl])
rotate([0,67.5,0])
cube([1.5,5.5,tl]);
translate([16*12,0,0]) mirror([1,0,0]) {
translate([s, 0, t])
rotate([0,22.5,0])
cube([1.5,5.5,tl]);
translate([s + sin(22.5)*tl, 0, t+cos(22.5)*tl])
rotate([0,67.5,0])
cube([1.5,5.5,tl]);
}
translate([24-.75,0, 1.5])
cube([1.5, 5.5, 8*12]);
translate([48-.75,0, 1.5])
cube([1.5, 5.5, 8*12]);
translate([72-3,0, 1.5]) // King Stud
cube([1.5, 5.5, 8*12]);
translate([72-1.5,0, 1.5]) // Jack Stud
cube([1.5, 5.5, 6*12-1.5]);
translate([72-1.5,0, 73.5]) // Header 1
cube([48+3, 5.5, 1.5]);
translate([72-1.5,0, 72]) // Header 2
cube([48+3, 5.5, 1.5]);
translate([72-1.5,0, 22.5]) // Sill 1
cube([48+3, 5.5, 1.5]);
translate([96-.75,0, 75]) // Cripple Top
cube([1.5, 5.5, 2*12]);
translate([96-.75-24,0, 75]) // Cripple Top
cube([1.5, 5.5, 2*12]);
translate([96-.75+24,0, 75]) // Cripple Top
cube([1.5, 5.5, 2*12]);
translate([96-.75,0, 1.5]) // Cripple Bottom
cube([1.5, 5.5, 24-3]);
translate([120,0, 1.5]) // Jack Stud
cube([1.5, 5.5, 6*12-1.5]);
translate([120+1.5,0, 1.5]) // Jack Stud
cube([1.5, 5.5, 8*12]); // King Stud
translate([144-.75,0, 1.5])
cube([1.5, 5.5, 8*12]);
translate([168-.75,0, 1.5])
cube([1.5, 5.5, 8*12]);
}
module Inner() {
// Lower wall
translate([5.5+48, 53.5,0]) // base plate
cube([5.5, 43.25+24, 1.5]);
for (i = [3:5]) {
translate([5.5+48, i*24-.75,1.5])
cube([5.5, 1.5, h]);
}
// Inner ends
translate([5.5+48, 53.5,1.5])
cube([5.5, 1.5, h]);
translate([5.5+48, 59,1.5])
cube([5.5, 1.5, h]);
//top plates
translate([5.5+48, 53.5, h + 1.5])
cube([5.5, 43.25+24, 1.5]);
translate([5.5+48, 59, h + 3])
cube([5.5, 37.75+24, 1.5]);
// Mid wall
translate([59, 53.5,0]) // base plate
cube([67.5, 5.5, 1.5]);
// Top plates
translate([59, 53.5, h + 1.5])
cube([67.5, 5.5, 1.5]);
translate([53.5, 53.5, h + 3])
cube([73, 5.5, 1.5]);
translate([59, 53.5, 1.5]) // inner end
cube([1.5, 5.5, h]);
for (i = [3:5]) {
translate([i*24-.75, 53.5, 1.5])
cube([1.5, 5.5, h]);
translate([125, 53.5, 1.5]) // outer end
cube([1.5, 5.5, h]);
}
}
module Steps() {
for (i = [0:6]) {
translate([0, 10*i-1.5, 7.5*i+6])
cube([48,11.5,1.5]);
translate([0, 10*i-1.5, 7.5*i])
cube([48,1.5,6]);
}
difference() {
translate([.01, -2.85, 3.85])
rotate([-53,0,0])
union() {
cube([1.5,11.5,8*12]);
translate([24-.75,0,0])
cube([1.5,11.5,8*12]);
translate([48-1.5,0,0])
cube([1.5,11.5,8*12]);
}
for (i = [0:6]) {
translate([-1, 10*i-1.51, 7.5*i+6-.01])
cube([50,11.5,10]);
translate([-1, 10*i-10.01, 7.5*i-.01])
cube([50,10,6]);
}
translate([-1, 10*7-.02, 7.5*6-10])
cube([50,30,30]);
translate([-1, -1, -30.0])
cube([50,30,30.01]);
}
}
module Stairs() {
/*
Stairs
rise 105"
run 140"
14 risers (including top floor)
7.5" rise for each
run 10"
headroom opening for all but bottom 2 steps
4' wide (3 stringers at 16" centers, 2"x12"x16')
*/
translate([0,0,1.5]) {
translate([5.5+48,123.5,0])
rotate([0,0,180]) {
translate([0,-1.5,-1.5]) cube([48, 11.5,1.5]);
Steps();
}
translate([5.5,5.5,105/2-9]) {
translate([0,0,0])
cube([60, 1.5, 7.5]);
translate([0,48-1.5,0])
cube([60, 1.5, 7.5]);
translate([1.5,48-.75-24,0])
cube([60-3, 1.5, 7.5]);
translate([0,1.5,0])
cube([1.5, 48-3, 7.5]);
translate([60-1.5,1.5,0])
cube([1.5, 48-3, 7.5]);
for (i = [0:7]) {
translate([7.5*i,0,7.5])
cube([7.5,48,1.5]);
}
}
translate([5.5+48+1.5, 5.5+48, 105/2])
rotate([0,0,-90])
Steps();
}
}
module Top() {
// Walls clipped to rafter shape
r = 8*12-5.5;
intersection() {
translate([8*12,(l+.5) *12,0])
rotate([90,0,0])
cylinder(h=(l+1)*12, r1=r,r2=r,$fn=8);
union() {
TopWall();
translate([0,l*12-3.5,0]) TopWall();
}
}
}
module Rafter() {
translate([0, 0, 0])
rotate([0,22.5,0])
cube([5.5, 1.5, rl]);
translate([sin(22.5)*rl, 0, cos(22.5)*rl])
rotate([0,67.5,0])
cube([5.5, 1.5, rl]);
translate([16*12,0,0]) mirror([1,0,0]) {
translate([0, 0, 0])
rotate([0,22.5,0])
cube([5.5, 1.5, rl]);
translate([sin(22.5)*rl, 0, cos(22.5)*rl])
rotate([0,67.5,0])
cube([5.5, 1.5, rl]);
}
}
module Rafters() {
// Base Plates
cube([5.5,l*12,1.5]);
translate([16*12-5.5,0,0])
cube([5.5,l*12,1.5]);
Rafter();
translate([0, 5.5, 0])
Rafter();
for (i = [1:l*12/24-1]) {
translate([0, 24*i-.75, 0])
Rafter();
}
translate([0, l*12-7, 0])
Rafter();
translate([0, l*12-1.5, 0])
Rafter();
}
module long() {
cube([1.5,16*12,5.5]);
translate([0,16*12,0])
cube([1.5,16*12,5.5]);
}
translate([0,0,-12]) Foundation();
// Lower Walls
translate([16*12-5.5,0,0]) SideWall(false, 16, 3, true);
translate([16*12-5.5,16*12,0]) SideWall(1, 16);
SideWall(5, 16, false, true);
translate([0,16*12,0]) SideWall(false, 16);
Back();
translate([0,l*12-5.5]) Front();
Inner();
Stairs();
translate([0,0,h+4.5]) UpperFloor();
translate([0,16*12,h+4.5]) FloorRafters(l-16);
translate([0,0,h+4.5+9.5]) UpperSubFloor();
translate([0,0,97.125 + 7.5]) {
Top();
Rafters();
RoofSheathing();
}
if (stuff) {
// Lawn Mower
%translate([(16-6)*12,(l-6)*12,1])
cube([5*12,5*12,5*12]);
// Work Table
%translate([11.5*12,7*12,1])
cube([4*12,8*12,3*12]);
// Tim Fat Bike
%translate([5,l*12-30-5,12])
cube([46,30,76]);
// Tim Mission Bike
%translate([5,l*12-56-5,21])
cube([46,25,67]);
// Mir Bike
%translate([5,l*12-82-5,22])
cube([44,25,66]);
// Charlotte Trailer
%translate([5,l*12-101,34])
cube([30, 13, 54]);
// Green Trailer
%translate([5,l*12-125,10])
cube([25,23,38]);
// Green Trailer
%translate([5,l*12-125,50])
cube([25,23,38]);
// Double Trailer
%translate([16*12-5-20,l*12-105,48])
cube([20, 30,40]);
}
@creationix
Copy link
Author

shed5-lower

Just lower half for easier viewing.

@creationix
Copy link
Author

shed5-top

Top half without rafters and perlins.

@creationix
Copy link
Author

shed6

Now with variable length! Shown at 28' instead of 24'

@creationix
Copy link
Author

shed6-lower

@creationix
Copy link
Author

Floors

  • 2"x10"x16' (x45)
  • 4'x8'x23/32" (x32) OSB or Plywood Subfloor

floors1

floors2

3 x floor rafters

floor-rafters

This is made of 2"x10"x16' boards with 24" on center spacing. The outer boards are full length all others (including horizontal caps)
are cut with 3" off to fit on the inside.

2 are used for bottom and one for top floor.

upper floor rafters

upper-floor-rafters

This is a modified floor rafter square with space cut out for the stairs.

Lower Subfloor

lower-subfloor

16 sheets of subfloor tiled to cover 2x floor rafter squares.

Upper Subfloor

upper-subfloor

This is the same as lower, but with cutout for stairs.

Lower Walls

lower-walls

Lumber needed to build all lower walls:

  • 2"x8"x8' (x2)
  • 2"x6"x16' (x17)
  • 2"x6"x8' (x85)

Left-Back Wall

left-back-wall

This is the wall-segment left of the doors and touching the back of the building. It's a plain wall segment with
framing for an air conditioner.

Left-Front Wall

left-front-wall

The next segment (left to previous when viewed from side) touching corner with door. Has window frame.

Right-Back Wall

right-back-wall

This is the side wall touching the stairs, it also has a window opening.

Right-Front Wall

right-front-wall

The last side wall, nothing special in this one.

Front Wall

front-wall

Front-wall with opening for double doors and extra strong 2"x8" headers.

Back Wall

back-wall

Simplest of the walls, a plain back wall (by stairs)

Inner Walls

inner-walls

inner-wall-1

inner-wall-2

These walls go on the inside and close the stairwell and add support for the upper floor rafters near the stairs cutout.

Stairs

  • 2"x12"x8' (x14)
  • 2"x8"x8' (x15)

steps

Lower Steps

steps-lower

Platform

steps-platform

Upper Steps

steps-upper

Top

  • 2"x6"x8' (x100)
  • 2"x6"x16' (x38)

top

Top Wall (x2)

top-walls

Wall extenders for ends of building.

Rafter (x19)

top-rafters

Each rafter is 4 angled 2x6 boards cut at 67.5 degree angles (sides of an octagon).

Perlins

top-perlins

@creationix
Copy link
Author

shed

@creationix
Copy link
Author

I decided to go with a slab for the foundation. It only costs $500 more and saves around $800 in lumber (not to mention a lot of labor) and the end product is better.

shed-on-slab

The guys doing the slab will need to know where to put anchor bolts, this will help:

concrete-touching-walls

@creationix
Copy link
Author

Tweaked window and door openings for new sizes and so that studs line up more often. Also removed perlins and will be putting foil lined sheathing on top instead.

shed7

@creationix
Copy link
Author

Pro-tip. The foil lined sheathing really helps with cooling costs, but it destroys cell reception inside the building by making it a giant Faraday cage.

@creationix
Copy link
Author

image

@creationix
Copy link
Author

image

@creationix
Copy link
Author

image

@karlwilbur
Copy link

Nice! Thanks for sharing! I'm looking to build a paid of smaller sheds and am starting with design in OpenSCAD. Being new to OpenSCAD, what you've shared in this gist will be tremendously helpful. It's a great example of a way to get the design done. I'll make sure to share my design and pics too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment