Sponsored By Tormach

Digitizing a Surface: Lesson Plan for the STEM Classroom

April 26th, 2012 by



This lesson progresses through the basic steps required for digitizing a part on the Tormach PCNC 770. CNC Digitizing is a process using a tool probe and a CNC mill to reverse engineer physical parts into 3D CAD software models.  There are two discrete steps to the process:

  1. Point Cloud Generation. Here, the touch probe is used to record a data set of discrete XYZ points. The number of points collect (density of the point cloud) ultimately determines the fidelity of the model. Mach3, the CNC control software for the PCNC 770, has a digitizing wizard to easily gather coordinate data from the desired part and makes this step relatively straightforward.
  2. Surface Creation. Using CAD software tools, the collected points in the data set are turned into a solid surface. This is sometimes called “skinning”.  This can be done with a number of CAD tools available in the market today.  In this demo, we use a popular open-source software suite called Blender.

Essential Components:

Before you begin, you’ll need the following software and hardware tools:

Digitizing Probe Either of these Probes from Tormach can work:

Part to digitize Parts with rounded features work best, digitizing sharp corners requires high resolution point collection.
Blender 3D Package Blender is a FREE 3D software package.  It can be downloaded from Blender.org.  This package will enable transformation from point cloud data to surface data.
Blender “Import Points” Script This script imports the saved data points from the Tormach mill into the Blender environment.
Blender “Skinning” Add-on This Blender add-on adds the ability to create a surface through a cloud of data points.

A Primer on Digitizing Probes

Digitizing Probes can be thought of as a simple switch interfaced to the CNC control system as an input.  The deflection of the probe tip either makes (or breaks) an electrical circuit.  The change in the circuit’s state (usually input voltage) is used to signal to the control when the probe has come into contact with the surface.  Most CNC controllers use the G31 command for probing:

G31  X~ Y~ Z~ F~

When executed, this command will move the probe in a straight line towards location XYZ and feed rate F.  If the probe trips prior to reaching XYZ, the probe will stop, and the trip location is stored in the control.  A digitizing program is essentially a series of G31 commands at different XY grid locations that records each XYZ trip location into a data file, known as a point cloud.

Mach3 has a programming wizard that will automatically generate a digitzing program and write a point cloud file.   You can read more about the details of programming using the G31 command here.


Point Cloud Generation

  1. First select a part you wish to digitize/reverse engineer.  As mentioned before, parts without sharp corners work best.  Secure the part to the milling bed via clamps or a vise.  The digitizing wizard requires the size of the envelope to digitize, therefore roughly measure the length, width and height of the part.  Measurement can either be done using measurement equipment (metal rule works fine for rough measurement) or the jog feature on the mill.  When all measurements are recorded move the probe to the desired starting position.
  2. Proceed to the “Digitization Wizard” within Mach3.  Select “Wizards” on the top menu bar, then click “Pick Wizard.”  The window appears showing all the available wizards.  Scroll and select the wizard named “Digitise Wizard” by Art Fenerty.
  3. Proceed to enter data in each input box with the data for the previously measured part envelope.  Note:  All dimensions measure from the current location of the probe.  Low feed rates obtain more accurate samples, but also increase the digitization time.  A sample screen is shown below.
  4. Once dimensions are entered click the “Create and Load G-Code” button.  This generates the probe toolpath.  This may take a few minutes to compute for a fine resolution digitization.  Once the G-code is created the machine the main screen appears.
  5. Once the setup is complete, click “Start” on the Mach3 interface.  The code will prompt the user to save the output points in a file.  Select a location and a specific name for the digitized points.  The file extension is arbitrary.  Depending on the resolution, digitization will usually take several hours to complete.

Software Installation

  1. Converting the point cloud data to surface data will require additional software usually not included in basic CAD software packages.  For this tutorial Blender Foundation 3D software will be used.  Blender is free/open source and works on multiple platforms.  Blender can be downloaded from Blender.org.
  2. Once Blender is installed, an add-on needs to be downloaded to add the ability to skin (make surfaces) from a point cloud.  The add-on is written in Python programming language and can be downloaded from the Blender Artists Forum.  Download the file “98 t25_PointCloudSkinner1_Umbrella.py.”
  3. Once the point cloud skinner add-on is downloaded, the file needs to be placed in the correct directory.  Copy and paste the “98 t25_PointCloudSkinner1_Umbrella.py” file into the add-on directory for Blender, C:\Program Files\Blender Foundation\Blender\2.61\scripts\addons. (Note: the path may slightly vary depending on the version of Blender and the operating system.)
  4. The add-on is now in the correct directory and now needs to be enabled.  Launch the Blender Software (Start>All Programs>Blender Foundation>Blender).  Once the application launches proceed to “File>User Preferences.”  On the left hand side of the user preferences window select “Mesh.”  Click the checkbox to the right of the add-on labeled “Mesh: Point Cloud Skinner,” to enable the add-on.  Lastly, Click “Save as Default” to enable this add-on every time Blender is started.  Once completed, close the User Preferences window.



Importing Digitized Data Points:

  1. Open a new file in Blender (File>New).  The initial cube should be deleted.  Right-click the cube and press “X” on the keyboard.  Then select “Delete.”  Next, the workspace view should be changed.  Change the view on the top drop-down menu from “Default” to “Scripting.”
  2. A new layout should appear.  Click the “+” on the scripting window to create a new text block.  Give it a name such as “ImportPoints.py”  Be sure to add the “.py” extension, to make the file a Python script.
  3. The digitized data from the file needs to be converted to a format compatible with the 3D software.  A script has been made to convert the output file from Mach3 in Blender.  Go to http://groklab.org/tormach/2012/04/04/importing-points-to-blender/ to obtain the script code.
  4. Copy and paste the code into the scripting window.  Make sure the indentation of the file does not change when pasting.
  5.  At the top of the pasted code one line reads: path=’C:\\test.txt’.  This needs to be changed to the location of the digitized point file on each specific computer.  For example: path=C:\\Users\Me\Documents\DigitizingData\Mydata.dat’
  6. Once completed, Click “Run Script” to import the data.  This should import the point cloud to Blender.




Skinning the Points

  1. First points need to be selected for skinning.  Most times the user will want to skin all the points at once, but refinement of the skinning can be done by only selecting a few points at a time.  First click the object labeled “My Digitized Data” from the Outliner (model tree).
  2. Enter the Edit Mode by pressing the “Tab” key.  Here multiple points can be selected.
  • Press “A” to toggle select all/deselect all points
  • Right-Clicking points will select individual points, hold “Shift” while right-clicking for multiple points
  • Press “B” to select points by drawing a box around the desired points

Once the desired points are selected, press “Tab” again to exit Edit Mode.

  1. Next, it is time to set up the skinning parameters.  Click the “Scene” tab in the properties window.
  2. Scroll to the bottom of the Scene properties tab.  At the very bottom there is a panel labeled “Point Cloud Skinner.”  Change the target object from “Plane” to “My Digitized Data.” Distance to skin should be set to a size slightly larger than the distance between individual points (e.g. 0.050).  For most cases ratio for axis and ratio for grid do not need to be changed.
  3. Once parameters are set, click the “Skin” button.  Skinning can take up to 10 minutes for high resolution data.


Saving the File

  1. Once the skinning is finished, click “File>Export,” a list of possible output file types appears.  Select a file type that works well for the desired CAD/CAM software.  In addition to exporting the mesh, saving the Blender file is beneficial.  The Blender file can be reopened and reused when new digitization files need skinning.

Troubleshooting and Skinning Tips

Often times the skinning will not be correct on the first try.  Slight modifications to the skinning parameters may produce better results.  For digitization points that have large changes in point spacing (i.e. sharp changes in z-direction depth) the distance for skin parameter will need to be changed depending on the section of points.

Selecting Faces, Points, Etc.

All manipulation must be done in Edit Mode.  To enter Edit Mode press “Tab” with the object selected.  Common selection methods are:

  • Right-Click – Select single point
  • Shift + Right-Click – Select multiple points
  • A – Select/Deselect All
  • B – Bounding Box Selection
  • X – Delete Selection

For advanced selection methods:  http://wiki.blender.org/index.php/Doc:2.6/Manual/Modeling/Meshes/Selecting

Manually Making Faces

Within Edit Mode select three or four vertices.  Press “F” to make a face between these points.  For advanced mesh making tools:


 Special thanks to Brian Johns of University of Iowa for development of this lesson concept.

2 Trackbacks

  1. […] Dig­i­tiz­ing Les­son Plan with Blender on TeachSTEMNow.com […]

  2. […] Digitizing a Surface: Lesson Plan for the STEM Classroom /* This entry was posted in Tutorials by Bart. Bookmark the permalink. Share this article Tweet   Follow @blendernation !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); /* […]

Post a Comment

You must be logged in to post a comment.