How can I wrap a flat surface around a cylinder in OpenSCAD. This was a question I asked myself. OpenSCAD doesn’t provide a ready made method so we need to write our own. Luckily we don’t have to invent the wheel here, others have done that already. Justin Lin has written a very handy tutorial on his website Openhome.cc how to wrap a text around a cylinder. In this project I took it a step further and wrapped a png image over part of a cylinder resulting in a curved image.
It seemed like fun to combine this technique of wrapping with the 3D print of a lithophane. A lithophane is an engraved image on translucent material. Many 3D printers have already produced lithophanes sometimes with stunning results. For this experiment I’ll use white PLA because it has excellent translucent properties.
Now first let me explain the basics on how to wrap a 2D image around a cylinder. First we create a circle out of triangles. These triangles are then extruded to segments to form a cylinder. Next all segments of the cylinder are lined up in a row and the image is place on the far side but just within the limits of the segments. When we intersect the image with every individual segment and return the segments to their original position in the cylinder, a curved image emerges (see images below).
If you want to know more please watch my video below. In this video the OpenSCAD script is explained and demonstrated. Also is shown how to import the stl file in Cura and what settings are used.
Here you can download with an example file of a curved lithophane:
- OpenSCAD file: https://my.hidrive.com/lnk/00iIimsR
- Accompanying png file: https://my.hidrive.com/lnk/8xCoC6RD
If you want to use your own png file change the surface command in the OpenSCAD file to include your own png file. Make sure to also change the height and width according to the imported png image in px. Prerender and render can take some time so it’s recommended to use a fast PC. And the larger the png the longer it takes.