Skip to content

Instantly share code, notes, and snippets.

@bmsleight
Created February 16, 2019 18:45
Show Gist options
  • Select an option

  • Save bmsleight/e1fb0882b519afdb5ee86e39ade51cab to your computer and use it in GitHub Desktop.

Select an option

Save bmsleight/e1fb0882b519afdb5ee86e39ade51cab to your computer and use it in GitHub Desktop.
Gödel, Escher, Bach.scad
$fn=100;
words("ILOVEYOU", "OPENSCAD");
module single_letter(tx,ty, ifont, size)
{
scale([size/10, size/10,size/10])
{
intersection() {
translate([0,10,0]) rotate([90,0,0]) linear_extrude(height =10) text(tx, font = ifont);
translate([0,0,0]) rotate([90,0,90]) linear_extrude(height =10) text(ty, font = ifont);
}
}
}
module words(wordx, wordy, ifont="Ubuntu Mono:style=Bold", size=20, space_relative=0.75)
{
for(i=[0:(len(wordx)-1)])
{
translate([i*size*space_relative,i*size*space_relative,0]) single_letter(tx=wordx[i],ty=wordy[i], ifont=ifont, size=size);
}
hull()
{
translate([space_relative*size/2, space_relative*size/2, -1]) cylinder(h=1, d=size);
translate([(len(wordx)-1)*size*space_relative,(len(wordx)-1)*size*space_relative,0]) translate([space_relative*size/2, space_relative*size/2, -1]) cylinder(h=1, d=size);
}
}
@drf5n
Copy link

drf5n commented Feb 20, 2026

Aw, I was looking for the GEB shape. I futzed with it some and realized that to do 3 directions, the letters should match sizes, so they all have to be square and fill their squares. So you would have to scale the B to be as wide as the G, and the E to be as wide as the the B is tall. And then there's an alignment issue.

Since I can't measure the letters, this is an eyeballed hack:

$fn=100;
words("G", "E", "B");
TR=[0,0,0];
SC=[1.0,1,1];


module single_letter(tx,ty,tz, ifont, size)
{
    scale([size/10, size/10,size/10])
    {
        intersection() {
            translate([0,10,0]) rotate([90,0,0]) linear_extrude(height =12)   translate(TR)scale(SC)text(tx, font = ifont);
            translate([0,-.5,0]) rotate([90,0,90]) linear_extrude(height =12)   translate(TR)scale([1.2,1,1])text(ty, font = ifont);
            translate([0,0,0]) rotate([0,0,0]) linear_extrude(height =12)   translate([-.50,0.50,0])scale([1.1,1,1])text(tz, font = ifont);
        }
    }
}


module words(wordx, wordy, wordz, ifont="Ubuntu Mono:style=Bold", size=20, space_relative=0.75)
{
    for(i=[0:(len(wordx)-1)])
    {
        translate([i*size*space_relative,i*size*space_relative,0]) single_letter(tx=wordx[i],ty=wordy[i], tz=wordz[i], ifont=ifont, size=size);
    }
//    hull()
//    {
//        translate([space_relative*size/2, space_relative*size/2, -1]) cylinder(h=1, d=size);
//        translate([(len(wordx)-1)*size*space_relative,(len(wordx)-1)*size*space_relative,0]) translate([space_relative*size/2, space_relative*size/2, -1]) cylinder(h=1, d=size);
//    }
}

Also, there's https://www.thingiverse.com/thing:2914 which does a 3 axis block, but it uses a hard-coded polygon based square font.

And there's a GEB block in the OpenSCAD examples:

https://github.com/openscad/openscad/blob/master/examples/Advanced/GEB.scad

@bmsleight
Copy link
Author

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment