post

What’s growing

Now that my students are wrapping up their summer research activities, it’s time to share some of my new designs.  This one is inspired by my students – they wanted to design and 3D print keychains – and Rozenn’s request to have name tags for our plants.

Rosemary, thyme and sage, with a bit of patriotism to boot.

Read on to see how I designed these, which involved a little bit of magic for the swash ornament.

Yep, I had to search for the definition of swash ornament myself, but more on that in a minute.  The plant tag is a fairly simple design consisting of an oval plate with a hole in it, some text and the swash ornament.  I’m a fan of OpenSCAD for designing my 3D prints and making shapes is pretty straightforward.

difference(){
    linear_extrude(1.0)scale([1,0.65])circle(30);
    translate([0,14,-1])scale([1,.5,1])cylinder(d=10,h=10);
}

In the code block above, linear_extrude is used to convert a 2D object (the circle) into a 3D object.  I used scale to squish the circle into an oval.  To cut out a hole in this plate, the difference operation is used.  Text can also be added in the same fashion; the text function creates a 2D text object which can be converted into a 3D object via linear_extrude.  I used Kalam as the font for my plant tags.

The swash ornament was a bit trickier.  I suspect someone has figured this out, but I know of know mathematical or geometrical representation of swash elements to make them using the tools available in OpenSCAD.  Therefore, I found one that I liked and saved a screenshot of the image.

OpenSCAD does have the ability to import an image via surface but the image needs to be processed and it is a bit clunky, so I decided to take a different route, which is arguably more clunky than doing it in OpenSCAD: Mathematica!

Once the image is imported into Mathematica, it needs to be converted into a binary, black and white image.  Some of the edges need to be cleaned up as well.  I do this by performing a morphological dilation using a disk matrix kernel with radius r.  What? You don’t know what that means?  Neither do I; I just searched the documentation, cut and pasted some example code, and liked the result:

This is what happens when you do ““Dilation[Binarize[ImageResize[img, 600]] // DeleteSmallComponents, DiskMatrix[2]] on a swash ornament.

The next step is to convert the binary image into a 3D object which involves two steps.  First, ImageMesh is used to create a 2D object (along the lines of circle and text in OpenSCAD) and then the Mathematica version of linear_extrude is called RegionProduct.  Confusing?  Yep.  Higher level programming languages are very powerful, but the learning curve is steep.  I’ve been working with meshes and regions in Mathematica for another project which I hope to share in the coming weeks, and I can only say that I am not nearly as proficient in these features as one would expect for having spent many hours working with them.  That said, we can make a fairly nice object with

ImageMesh[
  Dilation[Binarize[ImageResize[img, 600]] // DeleteSmallComponents, 
   DiskMatrix[2]]];
o = RegionProduct[%, Line[{{0.}, {3.0}}]]

Full disclosure: a scaling transform was added to make this object look pretty, but you don’t really care about the details.

Finally, we have an object that can be saved as an STL file and imported into OpenSCAD.

I can’t 3D print multiple colors … yet.

The last part, which I won’t bore you with, is to make what amounts to a 3D printed swizzle stick in order to hang the tag in the pot.  It’s a few cylinders at right angles, and is not exciting at all (and you’ve just witnessed what I think is exciting, so imagine my threshold for boring).

Hmm, maybe I need my students to come back in to the lab so I stop sharing.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.