Introduction: 3D Topo Map Generation to CNC [x-carve, Shapeoko 2]

About: Mechanical Engineer by day; Tinkerer, Maker, DIY'er, and Brewer by night

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.

Step 1: 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.

Step 2: 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.

Step 3: 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.

Step 4: 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

  1. we go in to scale mode (press the "S" key),
  2. select the local z-axis by pressing the "Z" key,
  3. then comma ","
  4. then the "Z" key again.
  5. Bring everything to the same level by setting it to zero (Press the "0" key, that's a zero),
  6. then press "Enter" to confirm.

Step 5: 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.

Step 6:

    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:

    1. Meshmixer : Reduce poly's simplify model
      1. 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)
      2. Export as STL
    2. 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.
      1. Import the exported STL
      2. Export to OBJ (quads)
        1. Export > Export Model
          1. set target face count to 100000
    3. Make the exported model water tight
      1. Option 1: Import the OBJ (quads) into Remake
        1. Analyze > Detect and fix model issues
      2. Option 2: Import the OBJ (quads) into Meshmixer (Not preferred as Meshmixer cannot export to OBJ quad)
        1. Analysis > Inspector > Auto Repair All
    4. Fusion360
      1. Import watertight OBJ
      2. Go to the create
      3. Right Click the top directory in your design tree and select "Capture Design History"
      4. right click your model under Bodies in your design tree and select "convert" and hit "ok"
        1. Select "Finish Form"
      5. Clean up the model
        1. Draw a square slightly inscribing the boundary of your model
          1. Extrude it with the intersect option/operation.
        2. Scale your model to fit your machine
          1. I scaled mine to about a 12" x 12" area.
        3. Move the models corner to the origin (approximately, I did this manually by hand - there must be a way to get it to snap...)
      6. Generate your tool paths
        1. Go to the CAM module (from the Model module)
        2. Hit 3D > Adaptive clearing
          1. Select your material and tool (I used a 1/4" Flat end mill for roughing)
          2. Move the axis in the Geometry Tab
            1. Check "Tool Orientation"
            2. Select Origin > Model origin
            3. Geometry tab
          3. Check your heights and feed speeds
          4. Hit "OK" and watch the magic happen as the tool path is generated.
        3. [OPTIONAL] - Second path for cleanup
          1. Select your material and tool (I used a 1/8" ball end mill for cleaning)
            1. 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.
        4. Export your G-code
          1. Actions > Post Process
          2. 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)
          3. Hit Post
          4. The code should pop up in Brackets in a short time.
    5. Import the G-code into your favorite G-code sender, check your feeds and speeds and let-a-rip
      1. Easel (-OR-)
      2. Universal Gcode Sender (-OR-)
      3. [Your favorite GCODE sender - may need to change Fusion 360 Post configuration)