//wordblocks module leta(a){ rotate([90,0,0]) rotate([-0,-90,0]) translate([0,0,-height]) linear_extrude(height*3) text(a, size = height, valign = "center", halign = "center",font="Amiri:style=Bold"); } module letb(b){ rotate([180,0,0]) rotate([-90,0,0]) translate([0,0,-height]) linear_extrude(height*3) text(b, size = height, valign = "center", halign = "center",font="Amiri:style=Bold"); } //block("M","K"); module block(a,b){ lw = height+(5*th); // letter block width difference(){ union(){ difference(){ cube(lw,true); leta(a); letb(b); translate([(th*1.4),(th*1.4),0]) // hollow out cube(lw,true); } translate([th*1.4,th*1.4,0]) // infill cube(lw,true); #translate([lw/2,lw/2,0]) // add flat rotate([0,0,45]) cube([lw*1.5,lw*1.5,lw],true); } translate([lw*.8,lw*.8,0])// cut back rotate([0,0,45]) cube(lw*2,true); } } // Main module to render a string in both YZ and XZ planes module li_string(input ) { // Split input into two parts parts = split_string(input); lw = height+(5*th); // letter block width spacing = lw*1.4; // Loop through each character pair and position at 45 degrees for (i = [0 : len(parts[0]) - 1]) { translate([i * spacing / sqrt(2), -i * spacing / sqrt(2), 0]) block(parts[0][i], parts[1][i]); } } // Helper function to split a string into two halves function split_string(str) = [ [for (i = [0 : ceil(len(str) / 2) - 1]) str[i]], [for (i = [ceil(len(str) / 2) : len(str) - 1]) str[i]] ]; module words(a){ rotate([-90,0,0])rotate([0,0,45])li_string(a); } height=20; $fn=100; th= 3; //depth of letter // words("ALEX TEDDY"); // words("EMMAANDY"); words(" FRUIT FLIES LIKE A BANANA");