In our daily life there is a family of shapes that we encounter most frequently, yet it’s too complex to draw using primitive tools. I am talking about Text.
Our digital universe is primarily made of text, but we never have to draw it. All the complex shapes that make up the text are mapped to specific keys on our keyboard. When we hit the keys the underlying software knows how to convert that keystroke in the shape of a letter. We don’t have to worry about how smooth the curvature of “O” is or how tall “J” should look. Most of the software we use daily has taken care of these minute details. But when it comes to modeling tools, that luxury can’t be taken for granted.
For instance in 3DTin, users have tried to create textual shapes in their 3D models by using cubes. But the results are far from ideal. Typical glyphs are so intricately shaped that, designing them manually is out of question. Therefore we decided to do something about it. We are introducing two templates to add text to your 3D models.
You will see the new templates near the end of the template list (which you can open by clicking the geometry button below 3DTin icon in the top left corner)
Click on the Text template and you will get to customize it.
Fill in whatever text you want to add. Specify height or width (not both) and choose one of the three fonts.
When you press ‘Add’, the server will generate the solid in the shape of the text you provided. Once it’s ready you will see the ghost of this solid dancing along the mouse cursor.
As you click anywhere in the sketch, the solid will get added to the sketch.
As simple as that.
There is no new interface, it’s just another template.
The second new template is similar to the first one in parameters, except it generates a void in the shape of text. It will be useful to create engraved text.
How is it done?
If you remember, we have built our server infrastructure in the form of a python library named ‘Cadmium‘ – which is written on top of the venerable CAD libraries OpenCASCADE and PythonOCC. In order to create 3D text, we extended the cadmium library for the job. We use python bindings of fontforge to extract shape information from TTF font files and then use it to build solids using PythonOCC. The source code is available in cadmium’s github repository. If you are an advanced user interested in cadmium, you will be glad to know how easy it’s to create an STL file in the shape of the text you want. You just need to write following 3 lines of python code.
from cadmium import Text s = Text('My 3D Text', fontpath='path-of-ttf-font-file', width=10, thickness=1) s.toSTL('mytext.stl')
It’s all ready to use. So give it a try and let me know how it goes.
Caveat Since it takes lot of processing on server to generate the solid from text glyph, we have limited the length of text to 5 for now. Depending upon ongoing usage we may change it in future.