Created
May 22, 2020 21:02
-
-
Save praeclarum/341c5171c1e12d4395ccc979596e5af8 to your computer and use it in GitHub Desktop.
OpenJSCAD source code for the Meadow Enclosure shown at the Wilderness Labs Dev Camp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resolution = 50; | |
var printerError = 0.05; | |
var xsize = 100; | |
var ysize = 100; | |
var height = 20; | |
function main() | |
{ | |
// return printEnclosureTop(); | |
return printEnclosureBottom(); | |
// return union( | |
// enclosureTop() | |
// .rotateX(180) | |
// .translate([0,-ysize*1.1,0]), | |
// enclosureBottom()); | |
} | |
function printEnclosureTop() | |
{ | |
return enclosureTop().rotateX(180); | |
} | |
function printEnclosureBottom() | |
{ | |
return enclosureBottom(); | |
} | |
function allMounts() | |
{ | |
return union( | |
meadowF7(), | |
accelerometer() | |
.translate([0, 30, 0])); | |
} | |
function mounts(xsize, ysize) | |
{ | |
var height = 8; | |
function standoff(x, y) { | |
return difference( | |
cylinder({ | |
r: 3, | |
h: height, | |
center: true, | |
}), | |
cylinder({ | |
r: 2.6/2 + printerError, | |
h: height+2, | |
center: true, | |
})) | |
.translate([x, y, height/2]); | |
} | |
return union( | |
standoff(xsize/2, ysize/2), | |
standoff(xsize/2, -ysize/2), | |
standoff(-xsize/2, ysize/2), | |
standoff(-xsize/2, -ysize/2)); | |
} | |
function meadowF7() | |
{ | |
return mounts (68, 18); | |
} | |
function accelerometer() | |
{ | |
return mounts(15, 10); | |
} | |
function enclosureBottom() | |
{ | |
var e = enclosure(); | |
var bottomSize = 0.25; | |
var chopper = | |
cube({size:[xsize*2,ysize*2,height*2]}) | |
.translate([-xsize,-ysize, | |
height*bottomSize]); | |
var outer = difference( | |
enclosure(), | |
chopper); | |
var inner = difference( | |
enclosure(0.95), | |
chopper.translate([0,0,3])); | |
return union( | |
outer, | |
inner, | |
allMounts() | |
.translate([0,0,-height/2])); | |
} | |
function enclosureTop() | |
{ | |
return difference( | |
enclosure(), | |
enclosureBottom()); | |
} | |
function enclosure(thickness) | |
{ | |
thickness = thickness || 0.9; | |
var e = enclosureShape(); | |
var cavity = e.scale(thickness); | |
return difference( | |
e, | |
cavity); | |
} | |
function enclosureShape() | |
{ | |
return cylinder({ | |
r: xsize/2, | |
h: height, | |
center: true, | |
fn: resolution, | |
}); | |
// return cube({ | |
// size: [xsize, ysize, height], | |
// center:true, | |
// }); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment