A wheel centre cap

In the post about printing 3d gears, we saw that it was possible to print replacement gears for car parts. I have now received a report that the printed gear works after several weeks of in-car testing, so let us count that as a success. In fact, it was so successful that I got a request to print another part that was missing; a press-fit wheel centre cap, original as below.


The owner also wanted the logo on the replacement part. When you don’t pay, there is no limit to what you can ask for :-) Anyway, I thought we might give it a try.

First step was simply to place the original on the flatbed scanner and make an image of the logo. I could have found the logo on the web, but that is cheating. Instead the scanned image was imported into Photoshop and turned into a monochrome image and blurred/clipped and saved to a PNG file.


Then, OpenSCAD  was fired up, and the following script was edited


In the above code, the d1 to d4 parameters define measured diameters (using a caliper) on the original. d1 is the outermost diameter. Similarly h1 to h4 define the heights measured from the bottom when logo is pointing down.

The “logo()” module imports the scanned image and turns it into a 3d object. A slice of that is created by intersecting it with a “cube” (actually a cuboid). The intersection is then scaled, rotated and translated to fit the size and orientation of the printed object.

The “bottom()” module is simply a short cylinder minus the logo at bottom and a smaller cylinder on top, to create a “rim” on the bottom part.

The “teeth()” module describes the 2d profile of the teeth that grips the wheel and then performs a rotational extrude (360 degrees). This is then intersected with the result of the “cross()” module which simply defines a cross from 2 cuboids. The result is 4 teeth, separated by 90 degrees.

All in all, less than 60 lines of code. We then get this OpenSCAD model to export as an STL file.


There are many ways to process an STL file, but generally it needs to be run through a “slicer” program to generate the G-code that a printer can understand. There are many very good slicer programs, including slic3r and Cura, but recently I have been using KISSlicer, as it has many nice customization options.


After completing the slicing, we have the G-code to send to the printer. I am using OctoPrint running on a wireless Raspberry Pi to control the printer, so the G-code is sent to OctoPrint via the web browser on the PC. OctoPrint can also display the temperature of the hot end and the heated bed. All we have to do is check that the printer calibration is ok and commit the print:


When finished, we have something that closely resembles the OpenSCAD model.


When we turn the print around, we also see something that resembles the logo. It is not perfect, but it is there. One idea is to fill the void with some dark filler and sand the top surface a bit. Then it might pass :-)


A challenge with a part like this is that the printed part is relatively brittle compared to the original, so it is hoped that the teeth simply do not break off. This is why the printed teeth are made wider than in the original, where it is only the smaller teeth that grip the wheel.

2 thoughts on “A wheel centre cap”

  1. I used OpenSCAD just recently too. There was snhmteiog I wanted to get 3D printed. Precise dimensions were critical. I downloaded Autodesk 123D but quickly became frustrated; if there’s a way to enter exact coordinates, I couldn’t find it.OpenSCAD’s description sounded horrible. No drag & drop? Defining everything with a script? How can you draw anything that way? But after my disappointment with 123D, I decided to give it a shot. The result: I love it! The text editor could be better, and auto-refresh would be nice. But the ease of defining a shape, cutting chunks out of it, sticking things onto it, and doing it all with perfect accuracy was wonderful.I don’t know how scalable it would be in practice. My objects were fairly simple. I wouldn’t want to design a car with it. But of course, car designers wouldn’t waste their time with 123D either.

  2. @Levente: It is possible to use an external editor such as e.g. Notepad++ and close the OpenSCAD editor, but let OpenSCAD watch the file being edited (in the other editor). Every time you save it, OpenSCAD refreshes.

Leave a Reply

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