3D Topo Map Generation to CNC [x-carve, Shapeoko 2]
16969 Views, 58 Favorites, 0 Comments
3D Topo Map Generation to CNC [x-carve, Shapeoko 2]
For holiday gifts I wanted to create 3D relief maps of locations of where family members live based of topographical data. I desire to have true 3D CNC milling, not just 2.5D. At last years Bay Area Maker Faire I was able to attend an Inventables event where I learned that Fusion360 by Autodesk is a full featured professional 3D CAD and CNC path generator (that uses the amazing HSMworks kernel ) that is 100% free (monetarily, not philosophically) for home users and hobbyists. I've previously made a blog post with the same information presented here, but I thought Instructables would be a better platform to present the information.
Using this new found information, my quest to develop a workflow for 3D relief maps began. My initial queries took me to a very concise and easy to use web utility that generates STL's from topographical data call Terrain2STL by GitHub user Thatcher Chamberlin. After playing around with this utility I discovered that the resolution of the maps was not to be desired and the surfaces that it created were not necessarily the easiest to modify, as the features were indeed accurately represented where I desired to create a relief map that was more or less exaggerated - after all this is art - not science. Additionally I discovered that found Fusion360 can only natively import BREP type geometries like IGES, and STEP.
I concluded that generating geometries in a more manual manner may give me some added artistic freedom, such as adding some first order gain to the elevation (z-axis) generating a more dramatic depiction of the terrain. My search first lead to me a tutorial which utilizes a SRTM plugin in Google Earth to download grey scale data of UV texture maps and mapping them to a displacement function in 3DS Max. Unfortunately the SRTM plugin has stopped functioning in later versions of Google earth (the University of London overlays are still present but the grids and ability to download the .asc files no longer are present). However, the SRTM website where the plugin grabs all the data is still up and the same data (ASCII or GeoTIFF) can be downloaded. Follow the steps in the tutorial linked above to get your gray-scale image. (Download the Geotiff, open it in MicroDEM, find your area of interest, download the gray-scale version of the map with MicroDEM, etc.)
I opened the TIFF file in GIMP and used the levels feature to normalize/rebracket the image.
Create a Planer Surface the Same Subdivisions As the Pixel Dimensions of Your Image
Now we have a elevation/z-information that we can throw into a 3D modeler to develop a 3D map. So, off we go to Blender, a free and open source 3D modeler that rivals that of many professional programs in features and abilities. I downloaded the latest version and began my journey into figuring out how to map my image to a 3D surface. The aforementioned tutorial utilizes a proprietary program called 3DS Max, that not as accessible as Blender for obvious monetary reasons. They briefly mention Blender near the bottom of the body of the tutorial but, there is no specific instructions on how to navigate oneself through the program in order to generate the desired effect. Therefore more google query's and swinging through the rough of the internet did I fight my way through this hurdle. The source that proved the most helpful was a YouTube video by URtuts.
Blender has a very rich environment that benefits from good input hardware. I absolutely recommend using a dedicated three button mouse with a scroll wheel when using blender in the very the least. Attempting to manipulate models with a built in laptop trackpoint or trackpad is going to make you homicidal. Avoid this at all costs. A three button mouse is cheap - this one did me fine.
First step is to create a plane mesh with the same divisions as the pixel resolution of your image file. GIMP was able to quickly provide the resolution information. In Blender [2.72b] delete the box (Delete or "x" key) and go to the "Create" tab on the left hand side of the screen. Scroll down and select "Grid" and In the bottom toolbar switch from Object Mode to Edit Mode. This should highlight your whole mesh orange and if you zoom in (mouse scroll wheel up) close enough you will be able to see the subdivisions of your mesh.
Type in your x-subdivisions and y-subdivisions subtracting ONE [1] from the values found in Gimp. My image was 783 pixels by 518 pixels, Therefore the number of subdivisions for my mesh is 782 for x-subdivisions and 517 for y-subdivisions.
Apply the Geotiff Data to the Grid to Create a 3D Geometry
Now in the same menu select the little checkerboard symbol (the Texture Menu). Select "New" - more options should appear: a black box with several drop down menus. Under the "Image" dropdown select "Open", navigate and select your tiff image, and click "Open Image". Now switch back to Object Mode using the bottom menu bar and you should see the texture applied.
Clean Up: Select the Perimeter and Pull It Below the Surface.
Now go back by clicking on the wrench icon again to adjust the texture mapping parameters. I adjusted he "Strength" parameter from 1.000 to 0.600. This adjust the gain of the texture map. Hit "Apply". This will apply the texture and remove it from the stack. Following this switch back to "Edit Mode." In the upper left hand corner there should be a icon that is blue circle with an "i" in it, select this and switch it to "3D View." (If your whole model is not orange than it is not all selected. To select all press CTRL+A.) Under the "Select" drop down menu select "Select Boundry Loop". Use the z-axis arrow handle and drag the selection down (Click and hold) so that all the boundaries are below the lowest part of the of the surface.
Clean Up: Level the Bottom Points to the Same Plane.
The edge is now below the surface, but it is still jagged and each vertex is still in the same relative position to each edge vertex. We need to bring the whole selected edge up to the same plane.
To do this
- we go in to scale mode (press the "S" key),
- select the local z-axis by pressing the "Z" key,
- then comma ","
- then the "Z" key again.
- Bring everything to the same level by setting it to zero (Press the "0" key, that's a zero),
- then press "Enter" to confirm.
Clean Up: Close the Bottom Then Export Your Geometry.
Now all we need to do from here is close the bottom since it is still an open surface (creating a closed surface). To do this, while the perimeter vertices are still selected, select "Mesh", select "Faces", and select "Make Edge/Faces" (located on the lower left in the menu next to the "Edit Mode" selector and the "Add" menu). This is now as far as we can take the model in Blender in order to get it to model that can be edited in Fusion360. If you would like to get a better idea of what you are looking at switch from Edit Mode back to Object Mode and display the model as rendered. Go to the upper left hand and switch from 3D View mode (box icon) to Info mode. Select "File" from the upper left drop down menus, select "Export", and select "Stl (.stl)" to export as a stereolithograph.
As mentioned before Fusion360 can only handle BREP type solid geometries and STL's are not solids, they are meshes. Adding to this frustration are very limited options and guides on how to convert STL's (and OBJ's, etc) to the STEP or IGES type solids. The research and time that went into finding how to do this with free software lead to a some simple work flow to convert STL's to IGES. This section may be the most helpful as most 3D models available for download for rapid-prototyping/3D printing are in STL format and converting these to a file that can be used by a full featured CAM program like Fusion360 is likely a common problem.
AutoDesk's 123D Design release 1.7 has a CNC utility in the works. In fact the program can convert mesh to solid to be exported to a STEP or SAT. Unfortunately at this time the algorithm is limited (and as communicated to me by an Autodesk employee, a difficult problem to solve - mathematically) therefore a workflow that involves simplification is needed. The programs involved are Meshmixer, Remake (Momento), and Fusion360.The basic steps are:
- Meshmixer : Reduce poly's simplify model
- Reduce - I found that I could reduce the triangle based surface by about 90-95% without loosing a significant amount of detail - (Here's a Youtube)
- Export as STL
- Remake : Export to quads (this is not a free program, but there is a free trial version. I believe there are monthly plans for $30). I spoke with an Autodesk Rep and I was told that we could expect STL to BREP geometry conversion in Fusion360 at some time in the future.
- Import the exported STL
- Export to OBJ (quads)
- Export > Export Model
- set target face count to 100000
- Export > Export Model
- Make the exported model water tight
- Option 1: Import the OBJ (quads) into Remake
- Analyze > Detect and fix model issues
- Option 2: Import the OBJ (quads) into Meshmixer (Not preferred as Meshmixer cannot export to OBJ quad)
- Analysis > Inspector > Auto Repair All
- Option 1: Import the OBJ (quads) into Remake
- Fusion360
- Import watertight OBJ
- Go to the create
- Right Click the top directory in your design tree and select "Capture Design History"
- right click your model under Bodies in your design tree and select "convert" and hit "ok"
- Select "Finish Form"
- Clean up the model
- Draw a square slightly inscribing the boundary of your model
- Extrude it with the intersect option/operation.
- Scale your model to fit your machine
- I scaled mine to about a 12" x 12" area.
- Move the models corner to the origin (approximately, I did this manually by hand - there must be a way to get it to snap...)
- Draw a square slightly inscribing the boundary of your model
- Generate your tool paths
- Go to the CAM module (from the Model module)
- Hit 3D > Adaptive clearing
- Select your material and tool (I used a 1/4" Flat end mill for roughing)
- Move the axis in the Geometry Tab
- Check "Tool Orientation"
- Select Origin > Model origin
- Geometry tab
- Check your heights and feed speeds
- Hit "OK" and watch the magic happen as the tool path is generated.
- [OPTIONAL] - Second path for cleanup
- Select your material and tool (I used a 1/8" ball end mill for cleaning)
- I used a Parallel path strategy then a Contuor path strategy, you may use other strategies in different orders. Experiment. These tend to take a fraction of the original clearing, so there's not too much time invested here.
- Select your material and tool (I used a 1/8" ball end mill for cleaning)
- Export your G-code
- Actions > Post Process
- Select "GRBL" under Post Configuration, change the program name if you wish (like "0-topo" or whatever) -OR- If you are using Easel, use the easel.cps post configuration which you can download within Easel (Here is a post discussing how to install the easel.cps so that Fusion360 can find it)
- Hit Post
- The code should pop up in Brackets in a short time.
- Import the G-code into your favorite G-code sender, check your feeds and speeds and let-a-rip
- Easel (-OR-)
- Universal Gcode Sender (-OR-)
- [Your favorite GCODE sender - may need to change Fusion 360 Post configuration)