-// These control the default values for write() writesphere() writecube()
-// if the parameters are not included in the call. Feel free to set your own
-// defaults.
-
-//default settings
- center=false;
- h = 4; //mm letter height
- t = 1; //mm letter thickness
- space =1; //extra space between characters in (character widths)
- rotate=0; // text rotation (clockwise)
- font = "Letters.dxf"; //default for aditional fonts
-
-
-// write cube defaults
- face = "front"; // default face (top,bottom,left,right,back,front)
- up =0; //mm up from center on face of cube
- down=0;
- right =0; //mm left from center on face of cube
- left=0;
-
-
-// write sphere defaults
- rounded=false; //default for rounded letters on writesphere
- north=0; // intial text position (I suggest leave these 0 defaults)
- south=0;
- east=0;
- west=0;
- spin=0;
-// writecylinder defaults
- middle=0; //(mm toward middle of circle)
- ccw=false; //write on top or bottom in a ccw direction
- r1=0; //(not implimented yet)
- r2=0; //(not implimented yet)
-
-
-
-// Contact me if your interested in how to make your own font files
-// Its tedious and time consuming, but not very hard
-
-
-module writecylinder(text,where,radius,height){
- wid=(.125* h *5.5 * space);
- widall=wid*(len(text)-1)/2;
- //angle that measures width of letters on sphere
- function NAngle(radius)=(wid/(pi2*radius))*360;
- //angle of half width of text
- function mmangle(radius)=(widall/(pi2*radius)*360);
-
- if ((face=="top")||(face=="bottom") ){
- if (face=="top" ){
- if (center==true){
- writecircle(text,where+[0,0,height/2],radius-h,rotate=rotate,font=font,h=h,t=t,
- space=space,east=east,west=west,middle=middle,ccw=ccw);
- }else{
- writecircle(text,where+[0,0,height],radius-h,rotate=rotate,font=font,h=h,t=t,
- space=space,east=east,west=west,middle=middle,ccw=ccw);
- }
- }else{
- rotate(180,[1,0,0])
- if (center==true){
- writecircle(text,where+[0,0,height/2],radius-h,rotate=rotate,font=font,h=h,t=t,
- space=space,east=east,west=west,middle=middle,ccw=ccw);
- }else{
- writecircle(text,where+[0,0,0],radius-h,rotate=rotate,font=font,h=h,t=t,
- space=space,east=east,west=west,middle=middle,ccw=ccw);
- }
- }
-
- }else{
-// if (radius>0){
- if (center==true) {
- rotate(-mmangle(radius)*(1-abs(rotate)/90),[0,0,1])
- translate(where)
- writethecylinder(text,where,radius,height,r1=radius,r2=radius,h=h,
- rotate=rotate,t=t,font=font,face=face,up=up,down=down,
- east=east,west=west,center=center,space=space,rounded=rounded);
- } else{
- rotate(-mmangle(radius)*(1-abs(rotate)/90),[0,0,1])
- translate(where+[0,0,height/2])
- writethecylinder(text,where,radius,height,r1=radius,r2=radius,h=h,
- rotate=rotate,t=t,font=font,face=face,up=up,down=down,
- east=east,west=west,center=center,space=space,rounded=rounded);
- }
-// the remarked out code is for cone shaped cylinders (not complete)
-// }else{
-// if (center==true) {
-// rotate(-mmangle(radius)*(1-abs(rotate)/90),[0,0,1])
-// translate(where)
-// writethecylinder(text,where,radius,height,r1=r1,r2=r2,h=h,
-// rotate=rotate,t=t,font=font,face=face,up=up,down=down,
-// east=east,west=west,center=center,space=space,rounded=rounded);
-// } else{
-// rotate(-mmangle(radius)*(1-abs(rotate)/90),[0,0,1])
-// translate(where+[0,0,height/2])
-// writethecylinder(text,where,radius,height,r1=r1,r2=r2,h=h,
-// rotate=rotate,t=t,font=font,face=face,up=up,down=down,
-// east=east,west=west,center=center,space=space,rounded=rounded);
-// }
-// }
- }