Customizable Polyhedron Surface Generator
thingiverse
In my opinion, one of the major constraints of Thingiverse's customizer is the absence of a surface() function. Because this would be a considerable limitation on some designs I wanted to create, I made a function that takes a textual height map and turns it into a polyhedron. In this thing you will find three files: PolyhedronDemo.scad: This is a sample file that has everything all packaged up so that customizer likes it. (Note: You still might need the python file to make a heightmap.) imagetoopenscad.py: This Python file can create heightmaps. OpenScadImagePoly.zip: This above plus some sample sets. Usage Step 1: Make a heightmap Find an image you want to convert to a heightmap. Run the python code with the image as parameter one, and a name for an OpenSCAD file as parameter two. python -u imagetoopenscad.py Smile.png DemoSurface.scad This will give you a OpenSCAD file that has a height map with dimensions equal to the image passed in. It probably makes sense to edit your images first - OpenSCAD probably won't like that 14megapixel image of your dog! Tip: Try to keep the edge size of the image reasonable, say under 501 pixels. Note: White pixels are closer to zmax, and Black pixels are closer to zmin. Step 2: Copy the heightmap into your customizable OpenSCAD project Once you generate the heightmap, copy it into the file that you want to be customizable. Tip: Because these heightmaps occupy a lot of vertical real estate in the editor, and because they usually have to show near the top of the code, it helps to wrap them in an anonymous scope { } pair. (This allows you to collapse them in the editor.) Step 3: Pass the heightmap into the polyhedron_from_surface module The polyhedron_from_surface module takes one mandatory parameter (the height map variable), and five optional parameters to determine the final size. The module will automatically expand the scale of the height map so that the highest pixel maps to zmax, and the lowest pixel maps to zmin. If you make zmax < zmin, the heightmap essentially gets inverted
With this file you will be able to print Customizable Polyhedron Surface Generator with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Customizable Polyhedron Surface Generator.