Loading

Write.scad

by HarlanDMii, published

Write.scad by HarlanDMii Jan 18, 2012

Description

UPDATED: 04/24/2013 M_G pointed out that space didn't work properly on writecube.. (fixed) Thanks M_G!!
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.

Recent Comments

view all

The correction on the github sight is correct. Can't believe I hadn't noticed it. Thanks hindessm :)
The count loop starts at 0, so it should only count from 0 to Numberofletters -1

Oh, the GitHub version is not the canonical one, I just mirror the Thingiverse releases there so I can easily integrate them into my things.

Nevertheless, HarlanDMii, you most probably understand the code best, could you have a look if https://github.com/rohieb/Writ... makes sense to you?

finally I posted a "working" version.

http://www.thingiverse.com/thi...
Thx HarlanDMii!

Makes

Liked By

view all

License

Write.scad by HarlanDMii is licensed under the Creative Commons - Attribution license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

openscad version 2011.12 or later is required to be able to run this code. Be sure to download the latest version from openscad.org/

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.

Comments

You must be logged in to post a comment.

hindessm on Feb 7, 2014 said:

I sent a github pull request for a (mostly harmless) off-by-one error in the write() module. I'd also be interested in any feedback about making my work-in-progress font at https://github.com/beanz/celti... easier for users to work with.

rohieb on Apr 15, 2014 said:

Oh, the GitHub version is not the canonical one, I just mirror the Thingiverse releases there so I can easily integrate them into my things.

Nevertheless, HarlanDMii, you most probably understand the code best, could you have a look if https://github.com/rohieb/Writ... makes sense to you?

Lucian151 on Jan 26, 2014 said:

Hi! Thank you for putting this up here!
I have a quick question, is there any way to get the text to wrap around a cone-shaped object? Would I have to give the text a slant so that it stays parallel to the surface of the cone?
Also, how do you indent the text?
Thank you so much!

XiaoShiZi on Dec 17, 2013 said:

Nice! One question: can you upload those .svg files to be able to add some missing characters to those fonts?
Like ç é à etc. Greatly done! Thx!

HarlanDMii on Dec 17, 2013 said:

Not sure how I failed to include them in the later zip file, but the svg files for the fonts are included in the WriteScad_01_29_2012.zip file

Freakazoid on Nov 22, 2013 said:

Really nice script! I used it to design customizable rings for my Flash Drive Cryptex: http://www.thingiverse.com/thi...
I wouldn't have been able to realize it without your work. Thanks!

i3user on Nov 5, 2013 said:

Eureka!! Your basics tutorial did it. It didn't work immediately as I managed to load two files twice somehow and my computer renamed letters, "letters2"! anyway I did figure that basic mistake out and renamed the file back to just "letters", it started working. I'm off and running. Thank you soooo much...

i3user on Nov 5, 2013 said:

The other problem I have is following directions. I downloaded the wrong pdf. Just reread your comment to download the "getting started pdf. That looks like what I want. I'll get started after dinner. Thanks!!

i3user on Nov 5, 2013 said:

Spent an hour on this and not getting anywhere. The problem is apparently I'm not understanding directories? I have the 2013 openscad, the write scad and letters.dxf file downloaded but they must be in different places and maybe that's why they are not working. If I click on the write program it opens in the openscad editor OK but nothing happens when I hit F5. If I open the dxf file openscad opens up and this appears in the editor: "import("C:/Users/Dave/Downloads/Letters(1).dxf"); " but if I hit f5 openscad closes claiming there is a problem?? Are these files supposed to open in the openscad editor?

i3user on Nov 4, 2013 said:

Thank you for the reply. I have used openscad a lot for the last 2 months since I got my printer. Mostly I mimic and then change things to get what I want or to see what happens. After a couple of weeks I was writing my own openscad programs including my own tedious "rounding routine". It's the way some of us rednecks learn. Unfortunately it's not as efficient as actually "knowing" what your doing as a learning tool. My extent of using openscad is: downloaded it, learned to make boxes,sphere's,cylinders and modules, translate (that took a while), difference etc. - familiar with F5,F6 and saving .stl files. - wander around in the dark making things that turn out good in print but the code is long and tedious and is best kept hidden away from real programmers eyes! BUT I have no idea how to (for lack of a better word) "meld" other programs or files to openscad like write scad or some of the thread programs etc. If it was a piece of code I could place in my program I could figure out where to put it and place it in 3d.? I have been busy so I will try to re look at the directions later tonight and get back if it makes sense. I did search through the beginning online tutorials about openscad and must have missed the steps. A thing called "library's" was mentioned and I'm guessing that is what this is all about but I don't know how to get them connected to my program designs. If they were connected I probably have the juice to figure out how to use the commands.

i3user on Nov 3, 2013 said:

Is there any tutorial for making this work? For instance "write scad for dummy's"? I use open scad in it's most basic form (cube, difference,translate, cylinder, F5, F6, "save as stl" etc) .but don't have a clue how to integrate this to my projects. I should say my file handling skills are right at the edge of marginal. The wrong edge. Do I some how open all these files and then what, paste them into the original openscad program? Or? what??
I downloaded the files listed here and tried just running them to see what happened but get error messages etc. Sorry to be so dumb but I need it in: download write .scad- when openscad opens- download XXX.dxf- copy xxx.dxf and paste it into write.scad. blah, blah, etc. I don't know what "in the same file" means.

Obviously my example above doesn't work but what does without having been through computer school? I do design things in openscad but do not understand "add on routines" or whatever they are called.

HarlanDMii on Nov 3, 2013 said:

Download the Getting Started pdf from above (just added) for some very basic help

HarlanDMii on Nov 3, 2013 said:

I'll create a step by step demo to help get you started.. Are you using PC or Mac?
Have you used OpenSCad?

dgm3333 on Jun 11, 2013 said:

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!

jonnyhoeven on Jun 11, 2013 said:

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!

rohieb on Apr 20, 2013 said:

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!

mrchrisreyes on Apr 12, 2013 said:

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.

HarlanDMii on Apr 13, 2013 said:

Posted a response on you page

knape on Mar 23, 2013 said:

Is there any way to write the # sign in Braille?

knape on Mar 24, 2013 said:

I added the number sign to the original braille.dxf
download it here:
https://www.dropbox.com/s/r783...

3daybreaker on Mar 22, 2013 said:

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

jonnyhoeven on Jun 11, 2013 said:

Just uploaded a stencil based font, it should be able to hold the inside of the "letters" when printed large enough.

HarlanDMii on Mar 6, 2013 said:

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.

jonnyhoeven on Jun 11, 2013 said:

Thanks for that help section, it helped me a lot.

Jinja on Mar 2, 2013 said:

This is a great library. Has anyone created a stencil font for it yet?

jonnyhoeven on Jun 11, 2013 said:

I just did.

theroar on Jan 16, 2013 said:

Just saw the T=option to make it different thicknesses... my bad..

theroar on Jan 16, 2013 said:

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.

nischi on Jan 13, 2013 said:

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!

HarlanDMii on Jan 23, 2013 said:

Sorry about the slow reply, I have a major project that has taken a year to complete. I will get detailed instructions on creating fonts posted just as soon as possible.

Anonymous on Jul 6, 2012 said:

How do you use writecircle to write text, right side up, on the bottom of the circle?

Anonymous on May 29, 2012 said:

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

hotkey on May 9, 2012 said:

Wow! We should merge our code! I got variable-width fonts working! (Mean OpenSCAD hack)

http://www.thingiverse.com/thi...

jamesglanville on May 6, 2012 said:

Any way to get numbers to work?

3daybreaker on Apr 18, 2012 said:

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

timmytool on Mar 7, 2012 said:

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.

HarlanDMii on Mar 11, 2012 said:

:) Thanks for the suggestions. I made this during the first week I was learning openscad, and havent had much time to update since. Hopefully can back to it soon and make the writecube a little more consistent.

emmett on Feb 3, 2012 said:

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")

HarlanDMii on Feb 3, 2012 said:

:) Not sure what happened there?? Ill play around with it to see if I can repeat the problem. Thanks for the heads up.

HarlanDMii on Jan 30, 2012 said:

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.

3dfuture on Jan 29, 2012 said:

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

HarlanDMii on Jan 29, 2012 said:

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.

NateTG on Jan 21, 2012 said:

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.

HarlanDMii on Jan 21, 2012 said:

AndyP said that he had to update to the latest version of Openscad before it would work on his. The version I am using was released December 2011 so it is a very new release.

http://www.openscad.org/

AndyP on Jan 20, 2012 said:

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.

HarlanDMii on Jan 20, 2012 said:

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.

HarlanDMii on Jan 20, 2012 said:

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.

blackice83 on Jan 19, 2012 said:

Awesome work! Thank you!!

HarlanDMii on Jan 20, 2012 said:

Thanks. Hoping to have more options soon

Top