Skip to main content

As automation continues to grow, CNC (Computer Numerical Control) machining gains popularity. One of the ways that CNC machines can be programmed is via G-Code. The growth of automation has also influenced the additive manufacturing industry. Automated additive manufacturing is another popular and growing process that can utilize G-Code.

Previously Galil customers only had access to third party software to perform the conversion between G-Code and Galil’s own DMC code. Galil now has their own in-house developed G-Code to DMC converter for customers to use in their applications.

A beta version of the G-Code to DMC converter is available on our website for $395.This includes a web based file converter for simply converting G-Code files to Galil DMC files (Galil controller’s native language), and API support for streaming large G-Code files.

The file converter is used for small G-Code files. The DMC file produced can easily be downloaded to a controller using existing Galil software such as GDK, or by using Galil’s existing gclib API.

The streaming API is used for G-Code files that produce DMC files exceeding the controller’s memory, or for customers who prefer to integrate their G-code files into a host application. The API allows customers tocreate their own host applications. Figure 1 displays streaming API example code that sets parameters, sends a G-Code command, and executes a G-Code file.

Figure 1: Streaming API Code Example

Figure 1: Streaming API Code Example

 

Any existing G-Code generation software can be used. Only minimal knowledge of DMC code is required. For example, lets assume that we have a 3 axis mill with a spindle, and we have the CAM program which produces G-Codes to drive the mill. For this application we are going to need a 4 axis controller to control the servo motors.

To solve this, we are going to use the G-Code to DMC file converter, and a DMC-4040-C022-I000-D3540.

This mill includes 4 servo motors with incremental quadrature encoders (X axis, Y axis, Z axis, and spindle). The X and Y axes move lateral to the part surface and position the end mill relative to the part fixture origin. The Z axis moves perpendicular to the part surface and controls the milling depth. The spindle axis controls the RPM of the end mill. All of these axes are controlled using the DMC-4040 and the D3540 sinusoidal servo amplifier.

Starting with a block of aluminum, we would like to create a small drip tray using the mill. FreeCAD’s CAM software is used to create the drip tray and milling tool path.

Figure 4 shows this drip tray, including the tool path that will be taken to produce the drip tray.

By selecting the Post Process button in the CAM software, a G-Code script corresponding to the drip tray milling profile is created. The first 20 lines of G-Code are shown in Figure 2. These lines include G17 to select the XY plane, G90 to specify absolute coordinates, G21 to specify millimeters as the units, M5 to turn the spindle off, M3 to turn the spindle on and specify RPM, G0 and G1 linear moves, and later on but not shown, G2 and G3 commands to create arcs used to mill the fillets in the corners of the drip tray. The spindle speed was set to 4500 RPM, and the feed rate was set to 3000 mm/min.

Figure 2: G-Code Script

Figure 2: G-Code Script

 

Now that we have created the G-Code script, the G-Code to DMC file converter is used to produce the corresponding DMC file named drip_tray.dmc. This file is opened in Galil’s GDK (Galil Design Kit) software, downloaded to the controller, and then we can execute the file. Next figure shows the beginning snippet of drip_tray.dmc in the GDK editor (Galil Design Kit’s program editing tool).

Figure 3: Produced DMC File

Figure 3: Produced DMC File

 

After downloading and executing the DMC file, the mill runs through the part profile and creates the drip tray. The mill starts at the origin and first creates the middle pocket of the tray. After the pocket is complete, the mill moves around the outer edge of the part to round out the corners. Figure 5 shows the tool path produced in the XY plane using the GDK plotter tool.

The plotter tool allows the user to configure a plot of the desired data using custom coordinate systems. This tool is accessible with the purchase of a GDK pro key. In this case, the X axis is the mill X axis, and the Y axis is the mill Y axis. The X and Y axes both have a resolution of 100 counts per millimeter. The end mill has a diameter of 4 mm.

Figure 4: FreeCAD Drip Tray and Milling Profile

Figure 4: FreeCad Drip Tray and Milling Profile

 

Figure 5: XY Milling Profile

Figure 5: XY Milling Profile

 

The currently supported G-codes include:

– G00/G01: Linear Move

– G02: Clockwise Arc or Circle Move*

– G03: Counterclockwise Arc or Circle Move*

– G04: Dwell

– G17: XY CNC Workspace Plane*

– G18: ZX CNC Workspace Plane*

– G19: YZ CNC Workspace Plane*

– G20: Inch Units

– G21: Millimeter Units

– G28: Auto Home

– G29: Bed Leveling**

– G90: Absolute Positioning

– G91: Relative Positioning*

– G92: Set Position

– M02: End Program*

– M17: Enable Steppers

– M18/M84: Disable Steppers

– M82: Set Extruder to Absolute Mode*

– M83: Set Extruder to Relative Mode

– M98: Call Subprogram*

– M99: Return From Subprogram*

– M104: Set Hotend Temperature**

– M106: Set Fan Speed**

– M107: Fan Off**

– M109: Wait for Hotend Temperature**

– M140: Set Bed Temperature**

– M190: Wait for Bed Temperature**

G-Codes with a single asterisk next to them are supported by the file converter but are currently under development for the streaming API. G-Codes with two asterisks are only supported by the streaming API.

M-Codes can be different in different applications. It is possible to tailor the DMC code for a particular M-Code to do whatever is needed.

Galil is happy to discuss adding additional G-Codes or other customization’s that a customer may require. Galil can also discuss adding any other desired features as a customization. This could include things such as coordinate transformations, simulating the tool path prior to running the profile, or collision detection to avoid collision with the work piece or any other physical components while machining.

If you have any questions or additional requirements, please reach out to Galil’s Applications team. You can reach the Applications team at support@galil.com or (916) 626-0101.