Skip to content

Instantly share code, notes, and snippets.

@fzerorubigd
Created October 7, 2021 22:05
Show Gist options
  • Save fzerorubigd/430aaf85588ea0431dc4c135e12f4263 to your computer and use it in GitHub Desktop.
Save fzerorubigd/430aaf85588ea0431dc4c135e12f4263 to your computer and use it in GitHub Desktop.
My first scad code
$card_lx = 72;
$card_ly = 52;
$height = 20;
$border = 2;
module emptyBox(x, y, h, border) {
difference() {
cube([x+(border*2), y+(border*2), h]);
translate([border, border, border])
cube([x, y, h]);
}
}
module doubleBox(x,y,h , border) {
difference() {
union() {
emptyBox(x, y, h, border);
translate([0, y+border, 0])
emptyBox(x, y, h, border);
}
translate([(x+(border*2))/2, -1, h]) {
difference() {
rotate([-90,0,0]){
cylinder(h=h, r = h+1);
}
translate([-h,-1,1])
cube(h*3);
}
}
}
}
difference() {
doubleBox($card_lx, $card_ly, $height, $border);
translate([-1,-1,16])
cube([2,$card_ly*3, 5]);
translate([$card_lx+$border+1,-1,16])
cube([2,$card_ly*3, 5]);
translate([-1,-1,16])
cube([$card_lx*3, 2, 5]);
translate([-1,($card_ly+$border)*2+1,16])
cube([$card_lx*3, 2, 5]);
}
translate ([100,0,0])
emptyBox($card_lx+$border, 2*$card_ly+2*$border, 5,1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment