algorithmic modeling for Rhino

Hi all,


Does anybody know about changing a text string into a line curve on an object? I've been looking at specific fonts for CNC machines but these seems to give very odd results.


I've already been using the plugin that converts strings into faces that are defined by font, text height, etc. What I would prefer is to get a string into a single curve (no thickness) that I could bake out of grasshopper.


Has anyone seen anything that relates to this? If I need to start delving into VB, I'll head over to that forum.


Views: 6326

Replies to This Discussion

I don't know if you really need GH for this - I have a Rhinoscript that converts text blocks to a single line font - as we use this regularly for laser marking and CNC milling. Since the number of free single stroke fonts are very limited (there are the same 3 or 4 floating around out there), in our case I use Arial as the "From" TTF font and Machine Tool Sans Serif as the "To" single stroke font. The size/spacing/character correspondence in that case is relatively good...

The attached scripts should work in all planes, keeping the original color and layer, etc. Report back if there are problems. You also need a different script for V4 and V5, as they have changed the text insertion point... I'm assuming you know how to set up Rhinoscripts to run in Rhino. Anyway, FWIW. --Mitch
Oh, sorry, you might also need the font... --M
Cheers for the responses Taz and Mitch!

I'm trying to keep the whole project in grasshopper at the moment as my numbering scheme will be passed from another part of the programme. Thanks for the replies though...I was wondering whether there was a quick fix in grasshopper but I don't think it's out there yet.

I've put together a very basic GH code that will convert a two digit number into a set of curves. This could be increased to larger number without much problem.

My knowledge of tree structures is still limited (as you can see from the code!) so it could be tidied easily enough I imagine. The main reason the code is so large is because I was having difficulty differenciating in lists between e.g. 1 which is 1 curve and 8 which is two curves. In a list, this lead to about 13 curves for the ten digits.

Anyway, it's a start and may help people with some CNC work in the future!
Apologies to Chris Chalmers, I forgot to reference correctly:

I've modified a 3dm file called "numbers.3dm" from by Chris Chalmers to get my numbering system.
Quote: The main reason the code is so large is because I was having difficulty differenciating in lists between e.g. 1 which is 1 curve and 8 which is two curves. In a list, this lead to about 13 curves for the ten digits.

I can imagine it's fairly easy to create a number set each of which only has one curve... An "8" could be a self-intersecting figure eight curve... don't be afraid to use curves that double back on themselves or self-intersect... They're either going to get milled that way anyway or there will be a tool lift. A bit harder to do with text, which has things like "i" and punctuation like ";"... --Mitch


I was asking if you could answer my questions ?

I am looking for a way to bake those texts as a simplify curve.

Both to reduce the time and for further problem.

I tried to cut this document that was nested with rhinonest 3.0

Each time after some cutting process. The machine stopped.

I was wondering if it was caused by the type of curves and the numbers of control points on the curves ?

What do you think ?

Does anyone has ever experienced that problem ?

It will be most helpful if you could possibly tell me more about some strategies I could work with to laser cut those curves.

Best Regards.

Here is the file :


I'm trying to use this method to convert text objects to a single line font.  Could you explain a bit about what you are referring to as "To" "From fonts? is that part of this script or is there another process to set that up?



No.  The "From" font is the one you use normally, in the case of my example it would be Arial.  This is a typical double stroke true type font.  So in your file, all of the text you want to convert would be in Arial. 


The second thing you need to do is install the single line font(s) on your system.  The fonts are attached above in this thread.  Just drop them into your system fonts folder. Machine Tool Sans Serif corresponds pretty well to Arial.  The reason this is important is the text isn't really "converted", it is substituted.


Then when you run the script, *all* the text that is currently the file (the way the script is initially set up) will get converted to single line curves.  There is a line in the script that can be uncommented, and the next line commented out which will allow only selected text to be converted.


HTH,  --Mitch

Do you know why the machine stopped?  There certainly is a massive amount of data, but I can normally handle it with ours.  Sometimes it may be the laser driver that is buggy - we have had occasional Rhino crashes on trying to send files with 10,000+ curves, my tactic is to send the file in parts if it's huge...  It could also be the buffer memory in your laser, or your network...

Exploding the text (as you appear to have done here) is definitely going to add to file size and cutting time - you are doubling each letter - so it's better to work with single line fonts if possible.  The scripts above do work in Rhino - we use them all the time - but there is one problem that that has occurred with V5 - text justification.  As text now comes in as justified any which way one can unfortunately no longer predict accurately if the single line replacement for the test is going to end up in the right place.  In V4, the text insertion point was always in the lower left corner, in V5 it could be lower, upper or mid and right or left...  there are no real tools to detect this AFAIK.


Mitch -- Thanks for the Rhinoscript components. They work great. 

A few things:

I converted some text with exclamation marks, and upon conversion the exclamation marks were omitted

The Arial text objects I converted were centered on the origin, when I ran the script and converted to single line the insertion point was the bottom left corner of the text block. Is there any way to get the insertion point to remain the same as the input text object?








  • Add Photos
  • View All


  • Add Videos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service