/* [Variables (All units are in mm)] */
direction = "coronal"; // [coronal,sagittal]
// Slice Thickness (default=1.0)
// [B] Length from Cerebrum to Cut End of Spinal Cord
// [C] Length of Olfactory Bulb
// [D] Height of Brain (Depth of Matrix)
// Width of Slot for Inserting Razor Blade (default = 0.4)
// Shift Cutting Position Anteriorly. Active when Coronal is Selected (Numbers Less Than the Value of thickness)
// Bridging that connects slots for fabrication stability
stabilizer = "off";// [off,on]
emboss_text = "no";// [no,yes]
// Text to be Embossed on Top Surface
text_to_emboss = "Your Text Here";
// Font Size of Text (default = 2)
// Calculating dimensions for the outer box
outer_length = length + bulb + 8;
outer_height = depth + 3;
cube([outer_length, outer_width, outer_height], center=true);
module drawBrainOutline() {
translate([bulb/4, 0, outer_height/2 - depth/2]) {
scale([length/width, 1, 1]) cylinder(h=depth, r=width/2, $fn=100, center=true);
translate([-length/2 + bulb/2, 0, 0]) cube([bulb, bulb, depth], center=true);
translate([-length/2, 0, 0]) cylinder(h=depth, r=bulb/2, $fn=100, center=true);
if (direction == "coronal") {
translate([bulb/4, 0, outer_height/2 - depth/2]) {
for (x = [-(length+bulb)/2 - shift: thickness : length/2]) {
cube([slot_width, outer_width, depth + 3], center=true);
else if (direction == "sagittal") {
translate([0, 0, outer_height - depth - 1]) cube([outer_length, slot_width, depth + 3], center=true); // Center groove
for (i = [0 : thickness : floor(width/2)]) {
translate([0, i, outer_height - depth - 1]) cube([outer_length, slot_width, depth + 3], center=true);
translate([0, -i, outer_height - depth - 1]) cube([outer_length, slot_width, depth + 3], center=true);
if (emboss_text == "yes") {
if (direction == "coronal") {
translate([outer_length/2 - bulb/4, 0, outer_height]) {
linear_extrude(height=.5)
text(text_to_emboss, size=font_size, halign="center", valign="bottom");
} else if (direction == "sagittal") {
translate([0, outer_width/2, outer_height]) {
linear_extrude(height=.5)
text(text_to_emboss, size=font_size, halign="center", valign="top");
if (stabilizer == "on") {
if (direction == "coronal") {
for (y = [(-outer_width/2)*2/3, (-outer_width/2)/3, 0, (outer_width/2)/3, (outer_width/2)*2/3]) {
translate([0, y, outer_height/2 - bridge_diameter/2])
cylinder(h=outer_length, d=bridge_diameter, center=true, $fn=20);
} else if (direction == "sagittal") {
for (x = [(-outer_length/2)*2/3, (-outer_length/2)/3, 0, (outer_length/2)/3, (outer_length/2)*2/3]) {
translate([x, 0, outer_height/2 - bridge_diameter/2])
cylinder(h=outer_width, d=bridge_diameter, center=true, $fn=20);
translate([0, 0, outer_height/2]) {