Tool path doesn’t match gcode preview

Hi all, need a bit of help with some gcode again. I’ve done a few projects now without issue so felt pretty good about cutting out this sign but then heard the router cut across the piece at almost full depth for no apparent reason. I can’t see it in the gcode viewer on Estlcam or a separate online one but when I run the cut in the air it does the same move.

WelcomeCenter_fullpass.gcode (530.9 KB)

Is it possible to bump Home Y during the execution of gcode? That’s the only think I can think of.

I had kind of same problem before. It was because my “old” arduino 8 bit controller running grbl could not handle the g-code on a particulair point because some i and j values became to large. It was solved by cleaning the large i and j values.

I have a Jackpot controller but even still, I’ve had issues with large I and J values so I’ll start there

The line does not happen in a g-code simulator, so a Jackpot firmware issue is a good guess. Since it happens with an air cut, it shouldn’t take much time to isolate the line(s) of code that caused the problem. If the line is associated with the inner portion of the “e” like it appears, this is one of the first things that happen in the file. Just delete lines in the g-code file and rerun until the issue is isolated.

If there is anyone else on this forum running a Jackpot board and has a bit of time, it would be helpful to run the g-code file to see if it happens to them as well. If it does not happen, please list the version of the firmware.

Edit: Some CAM apps allow you to turn off G2 generation, simulating curves with G1 instead. Also, are you running the latest Jackpot/FluidNC firmware?

Thanks for the response Robert, yeah I think this is my next course of action:

  • Confirm one more time that the offending line happens when doing an air cut
  • Take a look at the gcode at that spot and see if I can find anything unusual
  • Update the firmware on my Jackpot (it was shipped with FluidNC v3.9.1)
  • Air cut again to see if problem repeats
  • If it does, turn off arc commands in Estlcam and move on with my life
1 Like

Sounds like a plan. This assumes it is a G2/G3 issue. If you get it isolated, and it is not fixed in the latest version of FluidNC, please report the issue.

Was just checking the docs, is FluidNC v3.9.1 the most current stable version? Where does one check?

Yea, 3.9.1 is the current recommended version. I highly doubt a newer version resolves this.

https://docs.v1e.com/electronics/jackpot/#firmware

1 Like

Sweet. Fine by me. Didn’t really want to mess with an update anyways. I’m sure a lot of this is due to me generating paths using fonts or bit mapping on Inkscape. “Normal” drawings and parts out of Solidworks seem to be fine. May just turn off arcs altogether and see if that alleviate all my issues. Is the only reason to have them on to simplify the gcode file?

I don’t know the history. Curves are more accurate. The segments would never be seen for CNC carving in wood, but at some resolution, like fine laser work, I would expect to see the segments. Curves are more computationally expensive. This might have been an issue for old 8-bit control boards, especially since many math functions would be handled in software rather than hardware.

I’ll try running it tomorrow. Where did you set origin?

Thanks! I actually still need to try it again myself. Origin is the bottom left corner, aka (0,0)

I had same error source, svg from Inkscape and from fonts.

For those interested and in need a python script (found it online but don’t know where anymore)
witch cleans up to large i and j codes. It works well for me. Use at own risk.

Credits to the original autor (was not included).

import sys

def parse_line(line):
	line = line.strip()

	elements = []
	last_letter = 0
	for i in range(1, len(line)):
		if line[i].isalpha():
			elements.append(line[last_letter:i].strip())
			last_letter = i

	elements.append(line[last_letter:].strip())

	elements = {e[0] : e[1:] for e in elements}


	return elements

# Plane constants
XY = 0  # G17
XZ = 1  # G18
YZ = 2  # G19


# line0 is the command that moves to the starting point* for the arc
# line1 is a G2 or G3 command
# plane is set to the plane constant associated with the current arc plane
# min_len** is the smallest arc distance that won't be converted to a line
# min_ratio** is the smallest arc distance / R that won't be converted to a line

# *line1 must specify both coordinates
# **Set property to None to skip testing against it

def check_lines(line0, line1, plane, min_len=0.01, min_ratio=0.01):

	l1 = parse_line(line1)

	if ('G' not in l1) or (int(l1['G']) not in [2, 3]):
		return None

	l0 = parse_line(line0)

	offset0 = None
	offset1 = None

	try:
		# Set values relative to the arc plane
		if plane == XY:
			start0 = float(l0['X'])
			start1 = float(l0['Y'])
			end0   = float(l1['X'])
			end1   = float(l1['Y'])
			if 'I' in l1 and 'J' in l1:
				offset0 = float(l1['I'])
				offset1 = float(l1['J'])
		elif plane == XZ:
			start0 = float(l0['X'])
			start1 = float(l0['Z'])
			end0   = float(l1['X'])
			end1   = float(l1['Z'])
			if 'I' in l1 and 'K' in l1:
				offset0 = float(l1['I'])
				offset1 = float(l1['K'])
		elif plane == YZ:
			start0 = float(l0['Y'])
			start1 = float(l0['Z'])
			end0   = float(l1['Y'])
			end1   = float(l1['Z'])
			if 'J' in l1 and 'K' in l1:
				offset0 = float(l1['J'])
				offset1 = float(l1['K'])
	except KeyError:
		return None

	arc_dist = ((end0 - start0)**2 + (end1 - start1)**2)**0.5

	if offset0 is not None:
		radius = (offset0**2 + offset1**2)**0.5
	elif 'R' in l1:
		radius = float(l1['R'])
	else:
		return None

	if ((min_len is not None) and (arc_dist < min_len)) or \
	   ((min_ratio is not None) and (arc_dist / radius < min_ratio)):
		command = "G1 "
		for e in l1:
			if e not in ['G', 'I', 'J', 'K', 'R']:
				command = command + "{}{} ".format(e, l1[e])

		return command + "\n"


if len(sys.argv) < 2:
	print ("Usage:")
	print ("\tpython arc_fix.py filename")
	print ()
	print ()
	print ("\tfilename - The filename of a Gcode file")
	print ()
	print ()
	print ("\tThis utility will replace excessively small or straight")
	print ("\tG2 and G3 arcs with straight lines.")
	print ()
	print ("\tOutput is streamed to stdout.  The original file is not")
	print ("\tmodified.  To save to a file, use:")
	print ()
	print ("\t\tpython arc_fix.py inputfile > outputfile")
	print ()
	print ()
	sys.exit()

gcode_filename = sys.argv[1]
infile = open(gcode_filename, "r", encoding="UTF-8")
gcode_lines = infile.readlines()
infile.close()
modified_lines = 0
modified = []

prev_line = "( )"
line_number = 0
for line in gcode_lines:
	fixed = check_lines(prev_line, line, XY)
	if fixed is None:
		modified.append(line)
	else:
		modified.append(fixed)
		modified_lines += 1
		print(". [%d] Replaced lines \n\t%s\n\t%s\n -- with --\n\t%s" % (line_number, prev_line, line, fixed))
	fixed = None
	prev_line = line
	line_number += 1

if not modified_lines:
	print("No excessively small arcs found / replaced.  Skipping Export.")
	sys.exit()

outfile = open(gcode_filename + ".fixed", "w", encoding="UTF-8")
outfile.writelines(modified)
outfile.close()

print("Replaced %d excessively small arcs in %s and fixed them in %s.fixed" % (modified_lines, gcode_filename, gcode_filename))

1 Like