Skip to main content

Engineering my cat into keychain charm.

 Cats. What can I say that hasn't already been said.

But this is about a process to turn a picture of my cat into a lithophane. The difficulty: the shape should match the outline of the cat.

To go about this I needed 4 tools: image editing software, an image to lithophane converter, Inkscape, and a STL editor.

The first step was to isolate my cat in the picture:


This was probably the most time consuming aspect, carefully tracing her outline and removing the background. For this I used paint.net but you can use whatever you are familiar with. The result:

After isolating her I also made a 2nd image, which will be used later for creating the outline. This image is simply the area where the background was but filled black, the inverse of above. You can see I smoothed the edges a bit too:

The next step is to use a lithophane generator to create the STL. My favorite is: http://3dp.rocks/lithophane/ . You will want to use a flat model, turn off the border, and set base/stand depth to 0. Save the model to your documents.

Now you will use Inkscape to open up the outline image and trace the outline into a SVG. I won't be covering this process, but you can find a tutorial here: https://inkscape.org/doc/tutorials/tracing/tutorial-tracing.html

I highly recommend that you adjust the smooth corners and optimize. You don't want jagged edges here, as it will be the outline of your model. Make sure to save the file type as SVG, I have had the most luck with this.

The final step is to use your newly generated SVG file to cut out the unwanted parts of the lithophane STL. I'm sure there are a few editors that can do this, but surprisingly the most effective I have found is OpenScad. You will be doing a boolean operation. You do not want to do an Intersection operation, as it would need to calculate those thousands of points to see if they intersect! Instead, you want to do a difference. Create a rather large box that is much larger than the STL. Extrude cut the outline from that box, then use the box to remove the unwanted portions of the Lithophane.
Example OpenScad Code:

difference() 
{
    import("hazel.stl", convexity=3);
    
    difference()
    {
    translate([-100,-100,-10])
      cube([200,200,20]);
    translate([0,0,-12])
      linear_extrude(height = 40, center = false, convexity = 10)
        scale(v = [.075, .075, .075])
          translate([-81,-77,0])
            import(file = "hazel.svg");
    }
}
You will need to adjust the sizes and scale to fit your model. Change the translate() functions and check the output to see if it looks how you would like. With a little luck you will get a nice looking output:

Click the render button in OpenScad and go have a coffee, this might take a few minutes.
You can also add a keychain loop by modelling one in openscad, or editing the outline jpg before converting it to a SVG. If it takes too long to render, reduce the complexity of the lithophane used.
Save your STL and print it out!

Comments

Popular posts from this blog

Engineering the Marlin Linear Advance K-factor Calibration Pattern Generator for Duet

I love Marlin Firmware. What they have managed to squeeze into the 8bit 16mhz microcontrollers is impressive. But what is even more impressive, is their documentation. The Marlin documentation is far and above anything I have seen for an open source project. In addition to great documentation, they provide some very useful tools. Like the K-Factor Pattern Generator for calibrating Linear Advance in Marlin. I wish Duet provided a similar tool, as I find it invaluable for calibrating your pressure advance settings. What I have managed to do, is use the developer tools of the Chrome browser to edit the javascript and modify a few things to make it work. Why go through such lengths? Well, for a direct drive extruder the calibration values for duet are very low, and very sensitive. how sensitive? I have found differences in value changes of 0.00002 And because I don't take "close enough" as an answer, I had to dig in and make the script fit the resolution I require...

Reverse Engineering a Wand Vibrator

You ever want to take apart something prohibitively expensive and find out what's inside? I do, all the time. Lucky for me this cast aluminum massager is broken (it won't turn off). So I get to try to fix it (hopefully). It's likely just a bad mosfet. But it'd be fun to upgrade. It's surprisingly low power. 19.5W, 13v @ 1.5A 13v is a bit strange to see, but whatever. Could very likely be replaced by a 12v supply without significant loss in power. One screw came out halfway and appears to stop. Maybe it has a retaining clip? The other at the end won't budge. Time for a bigger screwdriver. It took a bit of prying. The retaining ring is glued on (I was worried it was screwed on). A bit of wiggling and it's free. The screw that I thought had a retaining clip actually has a screw standoff to hold the PCB in. I might try to take them apart, but it's not necessary to. And now for what you've all been waiting for. It's an incredibly simple...