Home
Blog CamBam Download Screenshots Gallery Getting Started Tutorials Forum Documentation PCB Isolation Routing CNC Links Contact |
CamBam - Tutorial : HeightmapsThe heightmap plugin is used to transform bitmaps into 3D polylines, using the pixel shade information to determine the Z height. If the image lighting is right, this can result in a nice 2D to 3D effect. WARNING! CamBam will quite happily produce gcode that plunges the entire depth of your heightmap in one go. In future releases, more sophisticated 3D profiling operations will be used, but for now keep your heightmaps reasonably shallow... or at least don't stand too close to the pointy end of your machines if you are foolhardy enough to try this code out :)Select a Bitmap File.The first step is to select a suitable bitmap file. Inspired by the inimitable greybeard's experiments in the cnczone 3D for Crazies thread, I photographed a object submerged in a tray containing water and blue food colouring. I then used a drawing program to filter the bitmap to just show the red channel as a greyscale image. In theory, the further the item is from the surface of the liquid, the more blue it will appear. This worked much better than I expected although care must be taken to avoid surface relections and air bubbles. This is perhaps not such a good idea for making heightmaps of people. Armed with a likely bitmap, select Plugins->Heightmap Generator menu option in CamBam. Use File->Open in the Heightmap Generator form to open the required image. Heightmap OptionsChange the heightmap options from the Heightmap plugin's Tools->Options menu.
Generate Heightmap and GCodeClose the options window and select Tools->Generate Heightmap. Here is a screenshot of the resulting heightmap. As well as generating a 3D Line object that contains the resulting heightmap, the plugin also creates an engraving machine operation linked to this line. An engraving operation is used as these are designed to 'follow' the associated geometry. In effect it is using the 3D line as a toolpath. To convert the heightmap into gcode for your machine, right click the Machining group in the CamBam tree view then select the Create GCode File menu option. But does it work? Well I finally got around to testing some gcode and here is the result. This also has the dubious honour of being the first CamBam gcode tested on a machine. The machine and my cutter survived! The image is 120mm X 90mm using a 2mm flat bit in plywood. Not fantastic to look at but at least there were no disasters. Creating a Point Cloud From a HeightmapGenerate a heightmap polyline as per usual and select the line if it is not already. Now do Insert->Pointlist->Step Around Geometry.
This will insert a point along the line every N step distance. CamBam currently displays points using biggish squares so it will look cluttered, but don't worry about that. The line object can now be deleted. The drawing can now be exported to a DXF file. Here a heightmap pointcloud is viewed in Autocad. |