Write.scad
Description
UPDATED: 03/06/2013 Added Help file for creating fonts.
I have looked everywhere for an easy way to write on my 3d objects. Everything I could find was hard to manipulate, so I decided to give it a shot myself. Hope you like this as much as I do. I'll try to answer any questions you have.
write.scad Routines:
write()
writecube()
writesphere()
writecylinder()
writecircle()
Fonts:
letters.dxf (change in write.scad)
orbitron.dxf
braille.dxf
knewave.dxf
BlackRose.dxf
-------------------------
writecylinder specs in testwritecylinder.scad
-------------------------
Be glad to add more fonts if requested, or give details to make your own.
Instructions
Put the files (write.scad) and (letters.dfx) in
the working directory with your open scad project.
refrence write.scad in your code...(use)
NOTE: write.scad contains write(),writesphere(),writecube() and writecylinder() modules
// write anywhere in your openscad project
locate([x,y,z])
write("Hello World",h=6,t=3);
// change fonts and spacing
write("Hello World",h=6,t=3,font="knewave.dxf",space=1.1);
// write on a cube
translate([15,15,15])
cube([20,20,10]);
writecube("Hello World",[15,15,15],[20,20,10],face="top");
// write on a sphere
translate([15,15,15])
sphere(12);
writesphere("Hello World",[15,15,15],12);
// write on a cylinder
translate([0,0,0])
cylinder(r=20,h=40,center=true);
writecylinder("Text on Cylinder",[0,0,0],20,40,rotate=45,center=true);
writecylinder("Text on top",[0,0,0],20,40,face="top",center=true);
//detailed usage in testwritecylinder.scad
//be sure to download the latest write.scad to use the new commands
// write in circles
writecircle("text",[0,0,0],radius);
=================================================================
=================================================================
You are welcome to use and distribute this code freely. no need to make it a derivative of write.scad
Check back every once in a while for additions.
If you make something really cool that uses it, let me know. I want to see :)
HAVE FUN WITH IT, and comments are always appreciated.
You must be logged in to post a comment.
Just added a new font for write.scad to thingiverse http://www.thingiverse.com/thi...
And another big thank you to HarlanDMii for write.scad!
For those who rather like to work with Git than with Thingiverse, I am mirroring this thing on GitHub, so you can easily add it as a submodule to your Git-revisioned things: https://github.com/rohieb/Writ...
Thanks for this great module, HarlanDMii!
I love this but I'm having trouble with my font, Edwardian Script, in capitals. For some reason some letters (FGHIJV) aren't showing up. Any suggestions. I've uploaded the SVG and DXF to my collection if someone can take a look. Thanks.
To all writing in OpenScad: I am looking for a font that has no closed perimeters in its characters.
Reason is that I want to write on one part and exclude from another part so when I merge parts, the text will fit into the hole. When closed perimeters (as in "o" or "B" are used, some parts will not be connected to the printed object.
Is there a font like that for use with "Write" plugin?
rgrds Thomas
www.3daybreaker.blogspot.com
I added a help file for adding fonts. I havent had time to complete the trouble shooting section yet, but I will have it completed soon.
Just saw the T=option to make it different thicknesses... my bad..
Great tool! Is there a way to change the depth of the letters? It seems locked to 1mm, and I would love to switch it to 2mm.
really cool. very good work.
i have used it already serveral times.
http://www.thingiverse.com/thi...
>Be glad to add more fonts if requested, or give details to make your own.
that would be nice if you tell how to create more fonts.
i would like to create symbole fonts.
thanks!
How do you use writecircle to write text, right side up, on the bottom of the circle?
Awesome "thing" you've built! Will save me tons of time building neckerchief slides.
You mentioned that you could either add fonts upon request, or provide instructions on how to add a font. So ... I'm asking.
I'd like some generic monospaced font like Courier and I'd like Arial. I'd be happy to do it myself if you want to provide instructions, or you can do the font thing and
publish them.
One other feature that would help me, but probably isn't very "generic", would be an option to 'touch' the text. In other words, if you set the space to 0 for example, that might signal that each character should just touch the adjacent characters (so they form a continuous chain).
And maybe a negative value for space could indicate how much overlap you wanted.
Thanks,
- Tex
Wow! We should merge our code! I got variable-width fonts working! (Mean OpenSCAD hack)
this is great fun. however,
if I use this to write negative (difference the textblock with other shape) thaen some characters will leave unconnected parts.
Would it be possible to design a font that has no closed loops , to be used in {Difference} ??
Thomas
Hi
I'm going to get great use out of your hard work :) thanks
TL:DR use module defaults it just works.
One thing I noticed is most of your examples have translates at the start and one inside your module declaration i.e. cube in your instructions....
From a user stand point I'd suggest looking at
the cube() etc defaults and adding your defaults to match so "this" could work....
cube(30);
writecube("text",size = 30); // or change size to cube
instead of...
(my working example of current module)
cube(30,true);
writecube("text",[0,0,0],size = 30);
(your example in pdf)
translate([10,20,30])
cu
be(30,center=true);
writecube("text",[10,20,30],30);
By change line 231(the writecube module declaration line) to...
module writecube(text = "Hello world" ,where = [0,0,0],size = 50){
You make "this" work...
cube(30,true);
writecube("text",size = 30);
With more consideration you could eliminate
the need to use "true" in the cube command to get the text lined up.
This is positively bizarre, but the capitol A was the only letter not working for me. I looked at Write.scad and found a couple of extra spaces around "a", and when I deleted them, it now works perfectly. No idea why. I changed:
if ((word[r] == "a" )
to
if ((word[r]== "a")
This is probably the last update to write.scad for a little while. (unless anyone has some new ideas). Be sure to download the latest write.scad to get all the new commands. Everything that uses any of the old versions is still compatible with the newest one.
Very nice and useful script.
Is there a way to determine the length of the written text?
Something like getTextLength('MyText,h=10,t=4)
And it returns something like 62mm
Thank you
CharacterWidth =(.6875*CharacterHeight*space);
TotalWidth=CharacterWidth*NumCharacters;
Character height is givin in mm.. if not suplied, default value is 4mm
I estimated the character width based on its height. (.6875 of the height)
(space is a scale value to fudge the spacing.. default value is 1)
This help? I will write up a little better description if needed.
The test scripts are crashing for me when I try to render in the GUI. At the command line it gives me lots of warnings about unknown function "len" and eventually fails out on "Current top level object is not a 3D object.
Nice, I struggled to do something similiar and ended up using smallsidefont by br3bttr and integrating it into my scad code as a library. I"ll try yours as a comparison.
See thingiverse http://www.thingiverse.com/thi... as an example of how I do it.
How does your text actually look when it is printed out?
Note: I had to update my version of OpenSCAD before some of the commands in write.scad would work.
If you have a chance to test the font on something you print before I get my printer, let me know how it does.
I updated the write.scad this afternoon.. Just replace the the old version with the new version. The usage is still exactly the same.
I havent received my printer yet so I havent had a chance to print. Im hoping to have it soon. I have only been using openscad now for 3 days. Im learning as I go. Some of the commands and lack of real variables is frustrating.I havent seen any documentation on the len command. It was a shot in the dark when I discovered it.

To new Linux users: This script won't work 'out of the box' as Linux file naming (which OpenSCAD follows) is case sensitive. Therefore to use/include it, you will have to either rename the file Write.scad to write.scad, or change all the use/include statements to Write.scad. Until you do this you will get an error: "WARNING: Can't open 'use' file 'write.scad'."
Otherwise an awesome script!