

Then we extrude our expanded text_area to stamp_relief_depth and position it above the stamp text using a translate transformation ( translate( )). This transformation expands the subsequent 2D geometry by the parameter delta or shrinks the geometry if delta is negative. We model the relief background based on the text_area and extend it with the transformation offset. We extend our module stamp with the parameters stamp_margin and stamp_relief_depth, which define the margin around the text and the depth of the relief background. Linear_extrude( height = stamp_relief_depth ) Stamp_relief_depth = 2, // depth of the relief substrate Let us return to the relief submodule and use our text_area module to describe the relief background: Before we continue, we should make sure that we remove our “debug” instance of the text_area now. We have created a 2D surface that can automatically adjust to the size of the stamp text! We will now use this special surface to construct the rest of the stamp. If you now remove the ! character again and run a preview ( F5) you can see that we have reached our goal (Figure 8. : Done! A 2D surface that automatically adapts to the dimension of the text We are almost there! We can now use the Boolean operation intersection to create the intersection of our two 3D shapes and then apply another projection transform to convert it back to a 2D shape: In the same way, the len function also allows to get the number of elements in an array. Note the use of the len function to get the number of characters of the stamp text. Linear_extrude( height = estimated_length ) With these values we can now extrude the 2D shapes and let them overlap using rotate and translate transforms:Įstimated_length = len(txt) * font_size * 2

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 Then, it was just a matter of adding cylinders, centering them in the ring, and rotating them into position.Font = "Liberation Sans:style=Bold Italic", That way, the thickness of the plane that needed rounding is uniformely the thickness of the ring.

VerticalOffset = tan(gapAngle / 2) * ringRadius I decided I'd simplify that and take out an extruded triangle. I was using difference to take a rectangle out of the ring. I ended up taking a third option I suppose.
