Somehow my machine is only accurate when running handwritten g-code
Hello guys, newbie here.
Not really sure where to post this. Is there a Mach4 Sub-Forum? Maybe G-Code forum? Feel free to move if necessary.
I built the R-CNC from makerfr.com, using a PMDX-416 and Mach4 as a controller.
CAD and CAM are done in Fusion 360 with the mach4 post-processor.
Setting it up, I've noticed that the machine is not accurate. "Well, adjust the steps-per-unit, duh!"
Been there, done that. Multiple times. With multiple different measuring methods. 30+ year old Mitutoyo 10mm 0.01mm resolution indicator and a long ruler. Interestingly they differ quite a lot.
Calculated the steps-per-unit (SPU) with the built-in wizard in mach4 using the mitutoyo. That resulted a movement of 390mm when told to move 400mm, reading on the long ruler. Its a cheap basic ruler but it can't be off by 10mm over 400mm, can it?!
So I used the ruler to re-calculate it as I trust a long distance more than the 10mm of the mitutoyo and it looks to be ok when running manual code:
I wrote a little piece of test code, using a 4mm endmill, I plunged about 0.2mm into a piece of wood before running the code.
G00 x24
G00 y24
G00 x0
G00 y0
The result was a perfect rectangle, measuring 20x20mm with my calipers and above mentioned ruler.
Now comes the fun part.
I created a small 15x15mm square pocket and a 15mm diameter hole in Fusion, 3mm deep.
Used a 2D Pocket to generate the toolpath with my 4mm Endmill, all well and good in the simulation.
Ran the code on the machine and measured the diameters.
Both the square and the hole were 13mm in diameter. WTF
I checked everything. Tooldiameter in Fusion is correct, even in the G-Code there's a line finishing the rectangle:
G1 X35.998
Y-46.438
X46.998
Y-35.438
X37.619
I'm no expert but seeing y-46.438 and y-35.438 looks suspiciously like a 15mm distance routed with a 4mm endmill. (11mm distance + 2mm on each side of the endmill)
So there must be a problem with mach4, right? But then again, the dimensions are fine with the handwritten code.
I'm slowly going insane.
Beginning of the G-Code looks like so:
(ACCURACY-TEST)
(T2 D=4. CR=0. - ZMIN=-3. - SCHAFTFRSER)
G90 G94 G91.1 G40 G49 G17
G21
(2D POCKET3)
M5
T2 M6
(4MM ALUFRSER 12MM)
S10000 M3
G54
G0 X61.651 Y-42.757
G43 Z15. H0
Z5.
G1 Z2.898 F500.
X61.677 Y-42.764 Z2.754 F333.
X61.753 Y-42.784 Z2.628
X61.868 Y-42.808 Z2.54
X62.009 Y-42.828 Z2.5
Just noticed it uses G54 while I'm using G55. Or do I? Offsets have not been an issue. idk.
Any hints would be greatly appreciated.
cheers
Re: Somehow my machine is only accurate when running handwritten g-code
It sounds like it's applying an offset to run inside the rectangle instead of outside it. If your hand-written Gcode works, but the Fusion-generated code doesn't, it's not likely to be a Mach4 problem; I'd look at the G-codes Fusion is inserting at the top of your program (like that G54).. Eliminate any that you wouldn't put in on purpose, and see what it does when run. There's probably a setting in Fusion that tells the tool where the tool should be in relationship to that rectangle; and since it's set incorrectly, it's deducting the radius twice instead of once.
Re: Somehow my machine is only accurate when running handwritten g-code
Stock to leave is turned off, my first thought too :D
I've tried removing all arguments, the code literally started with the move to the entry position. No difference.
I even ran the generated code from the MDI but still no difference.
Reinstalled Mach4 and setup a profile from scratch (Had been using the default PMDX-Profile), no difference.
I cut into the side of a piece of wood by moving the y-axis, then ran "g00 x14" and moved the y-axis again into the wood, and the resulting distance between the two cuts was 10mm, as it should be.
I then did the same thing with "G1 x14 F500" and again the result was accurate. So it can't be something about the G1 vs G00 moves. But there's nothing left.
I will try further and manually program with the MDI, going through the program step by step.
The most frustrating thing is that it worked. The damn thing was accurate. But I had some stability issued with my Windows install, so I upgraded to a 64-Bit Dual Core and reinstalled Win7 Professional. And then trying to make a fixture plate I discovered the issue.
Re: Somehow my machine is only accurate when running handwritten g-code
Reinstalled the driver for the PMDX-Controller, no difference.
Then I ran this part of the g-code from the MDI. Its the "finishing" pass of the square.
G1 X2.
Y-13.
X13.
Y-2.
X3.621
X3.545 Y-2.007 Z-2.985
X3.471 Y-2.029 Z-2.97
X3.413 Y-2.058 Z-2.926
X3.361 Y-2.096 Z-2.883
X3.329 Y-2.126 Z-2.818
X3.302 Y-2.159 Z-2.753
X3.284 Y-2.184 Z-2.6
G0 Z5.
Aaaand it produced the error. So there's gotta be something wrong in here.
Only thing I can think of is the fact that G1 is only expressed once and not at the beginning of every line. But as I said, I'm no expert and I have basically no experience with g-code except for the last few weeks playing around with the cnc.
Re: Somehow my machine is only accurate when running handwritten g-code
Cutter comp in Fusion is set to "In computer". So there is no compensation going on in mach4, I think there's even a G40 command at the top to turn it off.
I did a cut with the endmill (Its two weeks old btw) and it was 4mm wide.
It might just be my new pc hardware. I've since completely reinstalled my machine, including new downloads of all software/plugins and a softwareupdate of the PMDX Controller. No difference.
I'm reverting back this night and tomorrow to the old 32 bit system and we'll see it that makes a difference. If it does not, I will officially declare the experiment over :D