example023.scad 779 B

1234567891011121314151617181920
  1. // Example combining MCAD/fonts.scad with search() function.
  2. use <MCAD/fonts.scad>
  3. thisFont=8bit_polyfont();
  4. x_shift=thisFont[0][0];
  5. y_shift=thisFont[0][1];
  6. hours=["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];
  7. module clock_hour_words(word_offset=20.0,word_height=2.0) {
  8. for(i=[0:(len(hours)-1)]) assign( hourHandAngle=(i+1)*360/len(hours), theseIndicies=search(hours[i],thisFont[2],1,1) ) {
  9. rotate(90-hourHandAngle) translate([word_offset,0])
  10. for( j=[0:(len(theseIndicies)-1)] ) translate([j*x_shift,-y_shift/2]) {
  11. linear_extrude(height=word_height) polygon(points=thisFont[2][theseIndicies[j]][6][0],paths=thisFont[2][theseIndicies[j]][6][1]);
  12. }
  13. }
  14. }
  15. clock_hour_words(word_offset=16.0,word_height=5.0);