]> www.fi.muni.cz Git - things.git/commitdiff
Minecraft creeper head
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 31 Mar 2015 15:24:53 +0000 (17:24 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 31 Mar 2015 15:24:53 +0000 (17:24 +0200)
creeper.scad [new file with mode: 0644]

diff --git a/creeper.scad b/creeper.scad
new file mode 100644 (file)
index 0000000..65783dc
--- /dev/null
@@ -0,0 +1,131 @@
+// source: http://www.thingiverse.com/thing:18148
+
+eps=0.01;
+infty = 100;
+b=2;   // Scale factor. A creeper is 24 of these high
+w=3;   // Wall thickness in mm
+t=0.5; // Tolerance between neck and head
+
+echo("Total body height is",5*b+12*b+3*b);
+echo("Total head height is",8*b);
+echo("Total width is",8*b);
+
+// Simple creeper body
+module body() {
+    cube([4*b,8*b,12*b]);
+    translate([-4*b,0,-5*b]) cube([4*b,8*b,6*b]);
+    translate([4*b,0,-5*b]) cube([4*b,8*b,6*b]);
+} 
+
+// The negative space to hollow out the creeper body
+module tummy() {
+    translate([w,w,w]) cube([4*b-2*w,8*b-2*w,12*b-2*w]);
+    translate([2*b,4*b,12*b-w]) cylinder(r=2*b-w,h=w+4*b);
+}
+
+// The body with a neck added and the tummy removed
+module body2() {
+    layer=0.6; // Layer thickness used to make thin disks for support
+    difference() {
+        union() {
+            body();
+            translate([2*b,4*b,12*b-w]) cylinder(r=2*b,h=w+3*b);
+        }
+        tummy();
+    }
+    // Some discs for support
+    //translate([2*b,4*b,12*b-w]) cylinder(r=2*b,h=layer);
+    //translate([2*b,4*b,13.5*b+layer]) cylinder(r=2*b,h=layer);
+    //translate([2*b,4*b,15*b-layer]) cylinder(r=2*b,h=layer);
+}
+
+// The negative space to make the creeper face
+module face(){
+    translate([7*b,0,0]) union() {
+        translate([0,2*b-eps,1*b-eps]) cube([3*b,1*b+2*eps,2*b+2*eps]);
+        translate([0,5*b-eps,1*b-eps]) cube([3*b,1*b+2*eps,2*b+2*eps]);
+        translate([0.5*b,3*b-eps,2*b-eps]) cube([2.5*b,2*b+2*eps,2*b+2*eps]);
+        translate([0,5*b-eps,4.5*b-eps]) cube([3*b,1.5*b+2*eps,1.5*b+2*eps]);
+        translate([0,1.5*b-eps,4.5*b-eps]) cube([3*b,1.5*b+2*eps,1.5*b+2*eps]);    
+    }
+}
+
+// Simple creeper head
+module head(){
+    difference() {
+        cube([8*b,8*b,8*b]);
+        face();
+    }
+}
+
+
+module spring_hole() {
+       assign(d_in = 7, d_out = 12, d_w = 1) {
+       difference() {
+               cylinder(r = d_out/2, h = 7*b + eps);
+               difference() {
+                       cylinder(r = d_in/2 + d_w, h = 6*b - d_w);
+                       translate([0, 0, -eps])
+                       cylinder(r = d_in/2,       h = 6*b - d_w + 2*eps);
+                       rotate([0, 0, 135]) translate([0, 0, -eps])
+                       cube(infty);
+                       
+               };
+               for (a = [-25, 25]) rotate([0, 0, -90+a])
+                       translate([-d_w/2, d_in/2, 0])
+                       cube([d_w, d_out, 6*b - d_w + eps]);
+               
+/*
+               for (a = [0:120:360])
+                       rotate([0, 0, a])
+                       translate([d_in/2, -infty/2, -eps])
+                       rotate([0, -1, 0])
+                               cube([d_w, infty, 7*b-d_w]);
+*/
+/*
+               translate([d_s/2-d_in/2 , 0, 0]) difference() {
+                       cylinder(r = d_w + d_s/2, h = 7*b + eps);
+                       translate([0, 0, -eps])
+                       cylinder(r = d_s/2, h = 7*b + 3*eps);
+               };
+*/
+                       
+       }
+       }
+}
+
+       
+// Head with a hole for the neck
+module head2(){
+    difference(){
+        head();
+        // translate([4*b,4*b,-1]) cylinder(r=2*b+t,h=7*b+1);
+        translate([4*b,4*b,-eps]) spring_hole();
+    }
+}
+
+// Show the assembled creeper
+module creeper() {
+    body2();
+    translate([-2*b,0,12*b]) head2();
+}
+
+//body();
+//tummy();
+head2();
+//body2();
+//creeper();
+
+// These next lines show both pieces in print orientation
+// translate([0,-b,8*b]) rotate([0,-180,90]) head2();
+// translate([2*b,2*b,0]) rotate([90,0,0]) body2();
+
+// Make a small piece to print an overhang test
+/*
+translate([-2*b, 12*b,0]) difference() {
+  rotate([90,0,0]) tummy2();
+  translate([-5*b,-10*b,-b]) cube([14*b, 24*b, 10*b]); // Just leave the neck
+  //translate([-5*b,-16*b,4*b]) cube([14*b, 24*b, 10*b]); // Cross section
+}
+*/
+