3D Text

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

3D Text

tbuser
I've been trying to figure out a way to programmatically turn text
into 3D printable objects.  I couldn't find any tools to easily do
this, so I thought I'd try to figure out a way to create a DXF file
that could then be extruded in OpenSCAD.  My idea was to use
imagemagick to create an image that the autotrace program could turn
into a DXF.  Like so:

convert -size 400x400 -background transparent -fill black -stroke
black -gravity center -kerning -30 -font Helvetica-Bold caption:'Tony
Buser' foo.png

autotrace --output-file=foo.dxf foo.png

This creates a nice clean DXF see:
http://www.flickr.com/photos/tbuser/4445540019/

Unfortunately I ran into a problem, it seems openscad doesn't like the
DXF autotrace creates.  I get a blank stl file and the following
warnings:

WARNING: Unsupported DXF Entity `VERTEX' (2713x) in `foo.dxf'.
WARNING: Unsupported DXF Entity `POLYLINE' (17x) in `foo.dxf'.
WARNING: Unsupported DXF Entity `SEQEND' (17x) in `foo.dxf'.

Is there anything I can do about this?

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Ethan Dicks
On 3/19/10, Tony Buser <[hidden email]> wrote:
> I've been trying to figure out a way to programmatically turn text
> into 3D printable objects.

You are not the only one.

> I couldn't find any tools to easily do this...

There are no easy tools that I have found, either.

> so I thought I'd try to figure out a way to create a DXF file
> that could then be extruded in OpenSCAD...

Limitations in OpenSCAD will make this more than slightly difficult.

> Unfortunately I ran into a problem, it seems openscad doesn't like the
> DXF autotrace creates.  I get a blank stl file and the following
> warnings:
>
> WARNING: Unsupported DXF Entity `VERTEX' (2713x) in `foo.dxf'.
> WARNING: Unsupported DXF Entity `POLYLINE' (17x) in `foo.dxf'.
> WARNING: Unsupported DXF Entity `SEQEND' (17x) in `foo.dxf'.
>
> Is there anything I can do about this?

Add code to OpenSCAD that knows how to process VERTEX, POLYLINE, and
SEQEND?  Rewrite autotrace to only use DXF entities that OpenSCAD
supports?  (which are LINE, CIRCLE, and SQUARE, IIRC, not even
ELLIPSE).  Create a new font by drawing vector entities that are only
composed of supported entities?

Given that I'm not up to my elbows in OpenSCAD code, I thought I might
approach the problem of text in OpenSCAD models by hammering out a
simple block font (suitable for printing on a Makerbot with letter
sizes under 5mm tall) made up of only SQUARE, LINE, and CIRCLE
entities.  I haven't made any real progress on that.  I think just the
digits from 0-9 would be a great start.

-ethan

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

kintel
Administrator
On Mar 19, 2010, at 9:14 PM, Ethan Dicks wrote:

>> WARNING: Unsupported DXF Entity `VERTEX' (2713x) in `foo.dxf'.
>> WARNING: Unsupported DXF Entity `POLYLINE' (17x) in `foo.dxf'.
>> WARNING: Unsupported DXF Entity `SEQEND' (17x) in `foo.dxf'.
>
> Add code to OpenSCAD that knows how to process VERTEX, POLYLINE, and
> SEQEND?  Rewrite autotrace to only use DXF entities that OpenSCAD
> supports?  (which are LINE, CIRCLE, and SQUARE, IIRC, not even
> ELLIPSE).  Create a new font by drawing vector entities that are only
> composed of supported entities?
>
OpenSCAD does support ELLIPSE as well as LWPOLYLINE.
If you convert the outline to LWPOLYLINEs you should be home free.
Otherwise, adding support for the missing entitites would do it.

The real solution for text would be to interface directly with freetype, or a higher-level library on top of that if we can find smth. useful. This is on the TODO list - we're just slighty short of developer resources :/

~/= Marius

--
We are Elektropeople for a better living.





Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Giles Bathgate
On Fri, 2010-03-19 at 23:27 +0100, Marius Kintel wrote:
> This is on the TODO list - we're just slighty short of developer resources :/

I have been tinkering with openscad myself, submitting patches for
features that obviously 'the devs' are not that interested in. Is there
anything that you would you like to me have a look at?

Regards

Giles


Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

kintel
Administrator
On Mar 19, 2010, at 11:55 PM, Giles Bathgate wrote:

> I have been tinkering with openscad myself, submitting patches for
> features that obviously 'the devs' are not that interested in. Is there
> anything that you would you like to me have a look at?
>

What is actually done by 'the devs' (i.e. Clifford and me atm.) is always subject to arbitrary prioritization, so interest is not so much of an issue as available time is. Personally, I'd love to see more contributions :)

doc/TODO.txt is the current wishlist, although without any priority.

So from the top of my head, this what I see as important tasks (again, my personal opinion):
o Establish some kind of regression test framework. Refactoring is a bit of a pain atm.
  Unit testing would also be nice, but less important right now.
o General GUI polishing, including beating the editor a bit into shape (although I expect external editing to be
  used by power users).
o Somehow make CSG evaluation run faster
o TTF Text support
o Improve DXF import (requires some refactoring) to support more entities

These might all be a bit hard to get started on but there are lots of small issues in the TODO list.

Don't hesitate to fire off questions. The code comments has potential for improvements, so if anything is unclear it means someone should add more comments.

~/= Marius

--
We are Elektropeople for a better living.





Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

tbuser
In reply to this post by Ethan Dicks
On Fri, Mar 19, 2010 at 4:14 PM, Ethan Dicks <[hidden email]> wrote:
> approach the problem of text in OpenSCAD models by hammering out a
> simple block font (suitable for printing on a Makerbot with letter
> sizes under 5mm tall) made up of only SQUARE, LINE, and CIRCLE
> entities.  I haven't made any real progress on that.  I think just the
> digits from 0-9 would be a great start.

Ugh, so I thought the easiest thing I could try was to take your
suggestion to make simple block fonts in openscad code.  Once I got
over the pain of not being able to reassign variables amongst other
things... I came up with this:

http://gist.github.com/338558

I'm basically mapping Atari's 8-bit fonts into arrays and then
building each character up using cubes as pixels...  I'm surprised I
got it to work.  :)  Unfortunately, when I compile it I get Simple:
No, Valid: Yes.  And when I try to export it to STL it says Object
isn't a valid 2-manifold! Modify your design.. What does that mean?

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Giles Bathgate
On Sat, 2010-03-20 at 04:55 -0400, Tony Buser wrote:
> Once I got over the pain of not being able to reassign variables amongst other
> things...

There is the assign() function if that is suitable for your needs?

http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Conditional_and_Iterator_Functions#Assign_Statement

Regards

Giles



Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

kintel
Administrator
In reply to this post by tbuser
On Mar 20, 2010, at 9:55 AM, Tony Buser wrote:

> Unfortunately, when I compile it I get Simple:
> No, Valid: Yes.  And when I try to export it to STL it says Object
> isn't a valid 2-manifold! Modify your design.. What does that mean?

OpenSCAD is a pit picky when it comes to topology. The resulting topology must be manifold. One example of a non-manifold mesh is when one edge is shared between more than two faces. This happens e.g. in the middle of your '0' character.
This is a safeguard against models which would cause problems when lasercutting or 3D printing, but in your case it's not a real problem. Fixing this properly is not too trivial, but if you have any suggestion on how to improve application behavior in this respect I'm interested in hearing about it.

~/= Marius

--
We are Elektropeople for a better living.


Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Giles Bathgate
On Sat, 2010-03-20 at 15:18 +0100, Marius Kintel wrote:
> OpenSCAD is a pit picky when it comes to topology. The resulting topology must be manifold. One example of a non-manifold mesh is when one edge is shared between more than two faces. This happens e.g. in the middle of your '0' character.

So, he wants to make his pixels a 'tad' bigger.



Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Clifford Wolf
In reply to this post by kintel
Hi,

On Fri, Mar 19, 2010 at 11:27:09PM +0100, Marius Kintel wrote:
> The real solution for text would be to interface directly with freetype,
> or a higher-level library on top of that if we can find smth. useful.
> This is on the TODO list - we're just slighty short of developer
> resources :/

afaik freetype does not support rendering to a vector backend but always
generates pixel maps.

My current plan for this is the following:

1. implement an svgpath() statement that creates a 2d object from an svg
path (I probaly could reuse some code from [1] for this).

2. implement a function that can convert a string into an array of
characters.

3. write a simple perl/awk/whatever script that reads in an svg font
file (they look like [2]), extracts all <glyph> entities and spits out an
SCAD module that converts a string into a union of svgpath() statements.

non-monospace fonts would probably need some additional functions
(calculating sums using the entries from lists, etc) that would
probably be handy to have for many other cases too.

yours,
 - clifford

[1] http://svn.clifford.at/ecad4g/trunk/shapes/primitives.cc
[2] http://svn.clifford.at/ecad4g/trunk/modules/kernel/fonts/Mono.svg

--
Some languages are designed to solve a problem. Others are designed to
prove a point.

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

Jerry Isdale
In reply to this post by tbuser
I'm very interested to hear solutions here.  I posted a challenge in the Makerbot forums for people to post 3D logo design/documentation.  So far no one else has publicly stepped up with a solution, although some partials did appear.  One person (Miles of TeamTeamUSA) was able to extrude a DXF of the logo into a printable stl. I'm hoping to get details of how out of him at this weekend's LA Makerbot meeting at CrashSpace.

The challenge was posted in the Makerbot GoogleGroup (search challenge if this link gets munged):
  http://groups.google.com/group/makerbot/browse_thread/thread/1eceac641dee3461/34e49cfae341af3d?lnk=gst&q=challenge#34e49cfae341af3d

CrashSpace is in Culver City, CA (los angeles) see http://crashspace.pbworks.com


Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

tbuser
In reply to this post by Giles Bathgate
On Sat, Mar 20, 2010 at 5:55 AM, Giles Bathgate <[hidden email]> wrote:
> There is the assign() function if that is suitable for your needs?

The assign function doesn't help when you're in a loop... it's kind of
fitting that I'm translating 8bit atari fonts when dealing with the
limitations of openscad.  :)  Openscad is awesome, but things like
that are kind of frustrating.

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

tbuser
In reply to this post by kintel
On Sat, Mar 20, 2010 at 10:18 AM, Marius Kintel <[hidden email]> wrote:
> OpenSCAD is a pit picky when it comes to topology. The resulting topology must be manifold. One example of a non-manifold mesh is when one edge is shared between more than two faces. This happens e.g. in the middle of your '0' character.

Ah you're right, the problem was the 0 character.  Thanks, I think I
can work around that.

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

tbuser
In reply to this post by Jerry Isdale
On Sat, Mar 20, 2010 at 1:21 PM, Jerry Isdale <[hidden email]> wrote:
> I'm very interested to hear solutions here.  I posted a challenge in the Makerbot forums for people to post 3D logo design/documentation.  So far no one else has publicly stepped up with a solution, although some partials did appear.  One person

I was kind of inspired to play with this because of that post.  I had
hoped to be able to use autotrace + openscad to let me take different
kinds of images and turn them into STL files.  Unfortunately, I don't
think I'd have the time or skill to add things like polyline support
to openscad.

Reply | Threaded
Open this post in threaded view
|

Re: 3D Text

kintel
Administrator
In reply to this post by Clifford Wolf
On Mar 20, 2010, at 6:15 PM, Clifford Wolf wrote:
>
> afaik freetype does not support rendering to a vector backend but always
> generates pixel maps.
>
Freetype does support vectors using the FT_OutlineGlyph class.
Look at e.g. http://oglft.sourceforge.net/
I also have other glyph rendering code available which should also support kerning and possibly left-to-right rendering, but it's a bit of work to rip it out and integrate it into OpenSCAD.

This would, IMO, be a better solution than picking out vectorized characters from svg fonts.

~/= Marius

--
We are Elektropeople for a better living.