Toolpath Viewer

CADucopia Toolpath Viewer version 0.2

The CADucopia Toolpath Viewer is a RhinoScript that displays a XYZ G-Code toolpath in Rhino as polylines.

G0, G1 and M30 and X, Y, Z are used for generating the polylines. Other G and M codes and special characters (with the exception of a comment character) are ignored.

Installation

1) Download the installation file. Note where you saved it to your hard disk. Unzip it.

2) In Rhino, from the menu Tools / RhinoScript / Load …

3) Press Add… browse to where you saved the file, select Filename: CADucopia Toolpath Viewer vxx yymmdd.rvb (note: vxx yymmdd will be the version x.x and build date year month day, respectively) and press Open.

4) Select CADucopia Toolpath Viewer vxx yymmdd.rvb (which should now appear in the list); press Load; press Close.

5) If you would like the script to Load automatically every time you start Rhino, from the menu Tools / Options … / Rhino Options / RhinoScript / Startup Scripts to load when Rhino starts press the New dashed box icon then “…” button; browse to where you saved the file, select Filename: CADucopia Toolpath Viewer vxx yymmdd.rvb, press Open then press OK.

If you do not do this step, the next time you start Rhino from the menu Tools / RhinoScript / Load … select CADucopia Toolpath Viewer vxx yymmdd.rvb (which should appear in the list if added previously); press Load; press Close.

Use

To run the script: from the menu Tools / RhinoScript / Run … select CADucopiaToolpathViewer from the list and press OK.
(Note: if added in a previous session but not set up to Load automatically when Rhino starts, see Installation item 5.)

Upon running the script you will be presented with two dialogue boxes:

the first, to identify the file containing the toolpath you wish to view; browse to the file, select it and press Open,

the second, a table of properties and their defaults values for viewing the toolpath. Edit these values as appropriate, press OK.

The toolpath will display along with a brief summary (press OK when you’re done reading the summary).

That’s all there is to it! A detailed discussion of the Properties and how to change the defaults follows.

Properties

start point x,y,z

The starting point is x, y, z coordinates of the point from which the milling will start. This point is relative to the milling machine’s coordinate system. This value is read from the machine. The units of the machine should be those of the toolpath. Please see the notes immediately following this regarding units.

toolpath units

Just as it is difficult to know the starting point from the toolpath alone (i.e. the machine has to be taken into account), the same holds true for the units. It may not be possible to determine from the toolpath alone the units of the toolpath. Some toolpaths do not explicitly set it.

Furthermore, this viewer does not support G codes that set units (G20 inch mode or G21 metric mode). The units of the toolpath are assumed to be those of the Rhino model and uniform throughout the toolpath. Do not use this viewer for toolpaths that switch back and forth between inches and metric units – the dimensions will be unreliable.

See the script for specific notes on dealing with differences in units.

G0 layer name
G0 layer color R,G,B
G1 layer name
G1 layer color R,G,B

The names and colors of the layers in Rhino G0 (rapid traverse) and G1 (linear interpolation) toolpath polylines will be drawn on. The colors are designated by their Red, Green, and Blue components.

comment char

Deskproto does not currently support comments in toolpath files. Not all machine controllers support comments. But some users, whose machines do support it, may have added comments manually to their toolpaths. The toolpath viewer supports a single character signaling a comment follows on the line. All characters following the comment char on a line are ignored.

It should also be noted that spaces { }, commas {,}, blank lines {crlf}, and characters NOT in the set {GMXYZ-.0123456789} are also ignored.

Changing the Default Properties

It is possible to change the default properties (with the exception of toolpath units) by editing the script.

1) Open the script file with a text editor like Notepad.

2) Before making any changes, use Save as … to save a copy of the file under another name just in case you want to go back to it.

3) Scroll down to the section where arrItems and arrValues are assigned (if you’ve stopped at the Dim statement you haven’t gone far enough).

4) Edit one or more of the values of ArrValues (the text between the double quotes (“)).

Important note: DO NOT change “arrValues (1) = arrRhinoUnits(Rhino.UnitSystem)”

For example, to change the default start point from 0,0,5 to 5,10,15 edit the line

arrItems (0) = “start point x,y,z” : arrValues (0) = “0,0,0”

to

arrItems (0) = “start point x,y,z” : arrValues (0) = “5,10,15”

From the Notepad file menu press Save. To reload the script: in Rhino, from the menu Tools / RhinoScript / Load … select CADucopia Toolpath Viewer vxx yymmdd.rvb (which should appear in the list if added previously); press Load; press Close.

Disclaimer

This script is made available without any guarantee of fitness for any application. There is no warrantee expressed or implied.

info@CADucopia.com
copyright 2006 CADucopia, LLC