G36/G37 block for old CAM

Hi, I’m a new KiCad user.
I wanted to generate (plot) gerber files for our lab’s old PCB milling machine (at least 15 years old), which I have to work with a pretty old proprietary CAM software to operate.
Now the problem is, although the CAM and KiCad both claim to support RS-274X format, the CAM is not accepting gerber files generated with KiCad, raising an error on import. :confused:
I did a bit of fiddling around, and I found out that, a gerber file with G01/G02 in G36~G37 block is not accepted, while a gerber file without G01/G02 in G36~G37 block is accepted. An example of G36~G37 block that is accepted by the CAM is:
G36*
X31535000Y10045000D02*
X31535000Y11545000D01*
X31785000Y11795000D01*
X32985000Y11795000D01*
X33235000Y11545000D01*
X33235000Y10045000D01*
X32985000Y9795000D01*
X31785000Y9795000D01*
X31535000Y10045000D01*
G37*

Apparently the gerbers that KiCad generates have a lot of G01/G02 in G36~G37 block.
I also looked at the contents of gerber files previously generated with Eagle, and it contained no G01/G02/G03 in G36~G37 block. All arcs were approximated with massive amount of line segments.

So my question to the community is: how can I make KiCad not to use G01/G02 in G36~G37 and instead force to use linear interpolation? :question:
I understand this is a problem on the CAM side, not KiCad. However I thought it would be easier to solve it on KiCad if it is possible.

Thanks, and pardon my broken English. :bowing_man:

There’s no way to do that. KiCad exports valid gerbers and that’s it, there are few options to tweak in the plot dialog and not for this case. I don’t know if there exist any gerber manipulating software which converts shapes from one gerber feature to another. Because gerber is plain text it shouldn’t be too difficult to write a script to do that.

Thanks for your input @eelik. Now I need to look for other solutions…
Although I do agree with you that it won’t be that difficult to write a script to manipulate a gerber file, I’m not sure if my ability in programming would allow me to write such a software in, say, a day or two. But I am sure it’s worth trying.
As for my current project, I actually ended up exporting copper layer as DXF, importing it with CAM’s built-in petty CAD tool, then tweaking it to make it a valid format for the CAM. It was so time-consuming that I am now seriously considering to ditch our milling machine and use prototype services.

Thanks again.

1 Like

What sort of milling machine do you have?

It may be worth it to upgrade the electronics with something that speaks GRBL and then have your Gerber files interpreted by software such as coppercam of flatcam.

PCB’s for 3D printers and stepper motor drivers are cheap and easy to get and milling PCB’s is still relatively common in the hobby-market

Without knowing anything about your CNC machine, it’s difficult to comment but, this may help (been doing CNC for 30yrs. I’ve worked with many CNC machines and hand-coded too many times. I have a 25 yr old machine I use for PCB’s).

I assume your Machine will accept the Minimal Standard of Gcodes (most all will but, the Standard list of Gcodes is small and does Not include G37/etc… There are many Gcommand/Numbers that Machine#1 reads as do ‘this’, while Machine#2 interprets it as do ‘this’ and the ‘this’ for the machines is specific to the Brand/Model of the Machine.

Consider doing this:

  1. Inspect good Gcode and see what is specific to this machine and required in the file. File headers and tool routines, comment format, line-numbering… A slew of considerations…

  2. Once knowing what to Copy&Paste into a file, Add some basic commands to do simple movements.

  3. Piecemeal adding commands/code until satisfied and you have a List to work with (sure, you can research the machine and possibly discover a published list or user manual…)

  4. Armed with that knowledge do this:
    • Download the limited version of CopperCam (or other program)
    • Setup the Output Format to meet the machines requirement (usually stuff in #1, above).
    • Load the Gerber and save the output and see if it works.
    • Suggest trying with and without using the RS-274X format.

  5. If happy with results - using CopperCam, you can save a Post-Processor File with the necessary stuff and tag it as the default. Thus, never having to again mess with it (screenshot below shows example of tagging mine).

CopperCam’s Manual - info on G36/G37: Screenshot below…

Summary:
• See if the machine will run basic Gcodes
• Use CopperCam / other to generate the Gcode with desired Format

CopperCam info on G36/G37

follow-up…

It’s been 5yrs since defining the Output Gcode (post-processor for CopperCam) so, I dug into my files/notes…

  • My old CNC Mill does will Not use G36/G37 and I setup the Output file based on one of Defaults selections in CopperCam; specifically, the ISO format.

I tweaked it to my needs and it’s been all I ever need.

But, this morning for a moment of Fun while drinking blackcoffee, I plotted two Gerbers from Kicad (a PCB with only Copper Zones to assess the impact on CopperCam and the Output); One Gerber using the X2 format, One Gerber Not using the X2 format.

Both files contain the necessary movements G36/G37 and the difference is mostly in the header and as described in the Pop-up message in Kicad when hovering over X2 selection and, the CopperCam screenshot in above post.

Both files were correctly used by CopperCam and both Output Gcode files are identical thus, my Postprocessor format correctly handles the G36/G37 - it interprets deletes them and spits out usable Gcode without the G36/G37, thus usable on my machine.

In Summary - whether or not using X2 in Gerbers, a correctly defined Output Format is all that’s needed… Perhaps that may be a solution for you…