

For the length we can take the number of characters in the text, multiply this by the font size and then use a safety factor of two. Here we can simply assume ‘3 x font size’. For the “suitable length” of the first shape, we need to estimate what the maximum height of the text will be. If we extrude each of the shapes by a suitable length and then superimpose them, the intersection of these two shapes should have exactly the geometry we are looking for. What we’re missing now is a way to combine these two 2D shapes. Note that this time we have only extruded by one millimeter. Now we have another 2D shape representing the height of our text. We start by defining another submodule text_area and create the text inside of it again as a 2D base shape and extrude it to 3 millimeters: We’re going to try it anyway, and we have to dig deep into our bag of tricks to do it. It may be surprising, but there is no way in OpenSCAD to find out these dimensions! This limitation of OpenSCAD makes it very difficult to define geometries that automatically adapt to a given text. The height will be similar to the font size. To continue in our model description, it would be useful if we could get the width and height of the text. In this case we extrude ( linear_extrude) the text to the desired depth of the stamp relief. We can use the resulting text geometry like any other 2D basic shape. As with circles, spheres or cylinders, we can specify the level of detail of the geometry with the special variable $fn. We set the vertical and horizontal alignment of the font ( valign and halign) to center and pass txt, font size and font type as further parameters. In the relief submodule we use the 2D base shape text to generate a two-dimensional geometry of the stamp text. The fourth parameter stamp_depth defines the depth of the stamp relief. An overview of the fonts available in OpenSCAD can be found in the menu under Help -> Font List. The parameter txt sets the text of the stamp, the parameter font_size sets the (maximum) height of a regular capital letter in millimeters and the parameter font sets the font to be used. Our module stamp has four parameters for now. Stamp_depth = 2, // depth of the stamp relief Font = "Liberation Sans:style=Bold Italic",
