Last active
August 7, 2019 06:44
-
-
Save Neon22/9ec0b7e6518b1c3fb93bbd68f6eafa99 to your computer and use it in GitHub Desktop.
modified version of file
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
part = "both"; // [first:Mold Only,second:Stencil Only,both:Mold and Stencil] | |
/* [Parameters] */ | |
// Load a 100x100 pixel image. (images will be automatically stretched to fit) Simple, high contrast images like logos work best. | |
Image = "soft_test.png"; // [image_surface:100x100] | |
//Length of the sides of the square actuator | |
Side_Length = 50; //[1:100] | |
//Thickness of the first layer of silicone (Having different thicknesses on the layer will create varying effects) | |
Layer_1_Height = 4; //[1:4] | |
//Thickness of the second layer of silicone (Having different thicknesses on the layer will create varying effects) | |
Layer_2_Height = 6; //[1:4] | |
/* [Hidden] */ | |
base_thickness = 3; | |
wall_thickness = 10; | |
shelf_width = 2; | |
image_scale = 0.01; // 0.01 if source is a PNG. Use 2 if source is .dat file in Customizer | |
tolerance = .3; // used so Stencil fits in easily | |
// Calculated | |
stencil_thickness = Layer_2_Height*image_scale; //scale height | |
scaleFactor = Side_Length/100; // pixels to mm | |
overall_height = base_thickness + Layer_1_Height + Layer_2_Height; | |
// | |
Delta = 0.1; // small overlap for perfect booleans | |
// | |
print_part(); | |
module print_part() { | |
if (part == "first") { | |
mold(); | |
} else if (part == "second") { | |
stencil(); | |
} else if (part == "both") { | |
both(); | |
} else { | |
both(); | |
} | |
} | |
module both() { | |
mold(); | |
stencil(); | |
} | |
module stencil() { | |
translate([0,0,Layer_1_Height+Layer_2_Height+23]) // position over mold | |
scale([scaleFactor,scaleFactor,1]) | |
difference() { | |
// the image shape | |
scale([1.01,1.01,stencil_thickness]) | |
surface(file=Image, center=true, convexity=5); | |
// subtract the floor (hole) | |
cube([135,135,2*stencil_thickness+Delta],center=true); | |
} | |
} | |
module mold() { | |
box_width = Side_Length+wall_thickness; | |
Layer1_width = Side_Length-shelf_width; // stencil rests on layer1 shelf | |
Layer2_width = Side_Length+tolerance; // stencil fits in easily | |
difference() { | |
// Outer Box Shell | |
translate([0,0,(overall_height)/2]) { | |
cube([box_width,box_width,overall_height], center = true); | |
} | |
// Subtract Layer1 (lower level) | |
translate([0,0,base_thickness]) | |
translate([0,0,(Layer_1_Height)/2]) { | |
cube([Layer1_width,Layer1_width,Layer_1_Height+Delta], center = true); | |
} | |
// Subtract Layer2 (upper level) | |
translate([0,0,Layer_1_Height+base_thickness]) | |
translate([0,0,(Layer_2_Height)/2]) { | |
cube([Layer2_width,Layer2_width,Layer_2_Height+Delta], center = true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment