Hello Guest it is March 29, 2024, 09:05:33 AM

Author Topic: Mac4 seems to scrub the surface when moving from Work coord zero to the 1st. cut  (Read 2250 times)

0 Members and 1 Guest are viewing this topic.

I did get generated the below G code from Fusion 360 CAM module. It appears that the spindle is scaping the workpiece surface and isnt lifting enough in Z to clear the workpiece when moving from work coordinate zero to the first cut. The Fusion 360 guys tell me this may be a problem in Mach4. However I am no G code, Fusion or Mach4 expert so perhaps you can spot where the problem is. And most importantly how to fix it so that the tool lifts when it is moving to the first cut. See attachment for pic.

Code: [Select]
(1001)
(T1  D=4.762 CR=0. - ZMIN=-5. - FLAT END MILL)
G90 G94 G91.1 G40 G49 G17
G21
G28 G91 Z0.
G90

(CIRCULAR4)
M5
M9
T1 M6
S10000 M3
G54
M9
G0 X41.57 Y100.524
G43 Z90. H1
Z28.
G1 Z-1.524 F1143.
G18 G2 X42.047 Z-2. I0.476 K0.
G1 X42.285
G17 G3 X42.761 Y101. I0. J0.476
X19.239 I-11.761 J0.
X42.761 I11.761 J0.
X42.285 Y101.476 I-0.476 J0.
G1 X42.047
G18 G3 X41.57 Z-1.524 I0. K0.476
G0 Z40.
Y100.524
Z27.
G1 Z-2.524 F1143.
G2 X42.047 Z-3. I0.476 K0.
G1 X42.285
G17 G3 X42.761 Y101. I0. J0.476
X19.239 I-11.761 J0.
X42.761 I11.761 J0.
X42.285 Y101.476 I-0.476 J0.
G1 X42.047
G18 G3 X41.57 Z-2.524 I0. K0.476
G0 Z40.
Y100.524
Z26.
G1 Z-3.524 F1143.
G2 X42.047 Z-4. I0.476 K0.
G1 X42.285
G17 G3 X42.761 Y101. I0. J0.476
X19.239 I-11.761 J0.
X42.761 I11.761 J0.
X42.285 Y101.476 I-0.476 J0.
G1 X42.047
G18 G3 X41.57 Z-3.524 I0. K0.476
G0 Z40.
Y100.524
Z25.
G1 Z-4.524 F1143.
G2 X42.047 Z-5. I0.476 K0.
G1 X42.285
G17 G3 X42.761 Y101. I0. J0.476
X19.239 I-11.761 J0.
X42.761 I11.761 J0.
X42.285 Y101.476 I-0.476 J0.
G1 X42.047
G18 G3 X41.57 Z-4.524 I0. K0.476
G0 Z40.
X81.57 Y100.524
Z28.
G1 Z-1.524 F1143.
G2 X82.047 Z-2. I0.476 K0.
G1 X82.285
G17 G3 X82.761 Y101. I0. J0.476
X59.239 I-11.761 J0.
X82.761 I11.761 J0.
X82.285 Y101.476 I-0.476 J0.
G1 X82.047
G18 G3 X81.57 Z-1.524 I0. K0.476
G0 Z40.
Y100.524
Z27.
G1 Z-2.524 F1143.
G2 X82.047 Z-3. I0.476 K0.
G1 X82.285
G17 G3 X82.761 Y101. I0. J0.476
X59.239 I-11.761 J0.
X82.761 I11.761 J0.
X82.285 Y101.476 I-0.476 J0.
G1 X82.047
G18 G3 X81.57 Z-2.524 I0. K0.476
G0 Z40.
Y100.524
Z26.
G1 Z-3.524 F1143.
G2 X82.047 Z-4. I0.476 K0.
G1 X82.285
G17 G3 X82.761 Y101. I0. J0.476
X59.239 I-11.761 J0.
X82.761 I11.761 J0.
X82.285 Y101.476 I-0.476 J0.
G1 X82.047
G18 G3 X81.57 Z-3.524 I0. K0.476
G0 Z40.
Y100.524
Z25.
G1 Z-4.524 F1143.
G2 X82.047 Z-5. I0.476 K0.
G1 X82.285
G17 G3 X82.761 Y101. I0. J0.476
X59.239 I-11.761 J0.
X82.761 I11.761 J0.
X82.285 Y101.476 I-0.476 J0.
G1 X82.047
G18 G3 X81.57 Z-4.524 I0. K0.476
G0 Z40.
X188.928 Y63.024
Z28.
G1 Z-1.524 F1143.
G2 X189.404 Z-2. I0.476 K0.
G1 X189.643
G17 G3 X190.119 Y63.5 I0. J0.476
X94.881 I-47.619 J0.
X190.119 I47.619 J0.
X189.643 Y63.976 I-0.476 J0.
G1 X189.404
G18 G3 X188.928 Z-1.524 I0. K0.476
G0 Z40.
Y63.024
Z27.
G1 Z-2.524 F1143.
G2 X189.404 Z-3. I0.476 K0.
G1 X189.643
G17 G3 X190.119 Y63.5 I0. J0.476
X94.881 I-47.619 J0.
X190.119 I47.619 J0.
X189.643 Y63.976 I-0.476 J0.
G1 X189.404
G18 G3 X188.928 Z-2.524 I0. K0.476
G0 Z40.
Y63.024
Z26.
G1 Z-3.524 F1143.
G2 X189.404 Z-4. I0.476 K0.
G1 X189.643
G17 G3 X190.119 Y63.5 I0. J0.476
X94.881 I-47.619 J0.
X190.119 I47.619 J0.
X189.643 Y63.976 I-0.476 J0.
G1 X189.404
G18 G3 X188.928 Z-3.524 I0. K0.476
G0 Z40.
Y63.024
Z25.
G1 Z-4.524 F1143.
G2 X189.404 Z-5. I0.476 K0.
G1 X189.643
G17 G3 X190.119 Y63.5 I0. J0.476
X94.881 I-47.619 J0.
X190.119 I47.619 J0.
X189.643 Y63.976 I-0.476 J0.
G1 X189.404
G18 G3 X188.928 Z-4.524 I0. K0.476
G0 Z40.
X298.928 Y63.024
Z28.
G1 Z-1.524 F1143.
G2 X299.404 Z-2. I0.476 K0.
G1 X299.642
G17 G3 X300.119 Y63.5 I0. J0.476
X204.881 I-47.619 J0.
X300.119 I47.619 J0.
X299.642 Y63.976 I-0.476 J0.
G1 X299.404
G18 G3 X298.928 Z-1.524 I0. K0.476
G0 Z40.
Y63.024
Z27.
G1 Z-2.524 F1143.
G2 X299.404 Z-3. I0.476 K0.
G1 X299.642
G17 G3 X300.119 Y63.5 I0. J0.476
X204.881 I-47.619 J0.
X300.119 I47.619 J0.
X299.642 Y63.976 I-0.476 J0.
G1 X299.404
G18 G3 X298.928 Z-2.524 I0. K0.476
G0 Z40.
Y63.024
Z26.
G1 Z-3.524 F1143.
G2 X299.404 Z-4. I0.476 K0.
G1 X299.642
G17 G3 X300.119 Y63.5 I0. J0.476
X204.881 I-47.619 J0.
X300.119 I47.619 J0.
X299.642 Y63.976 I-0.476 J0.
G1 X299.404
G18 G3 X298.928 Z-3.524 I0. K0.476
G0 Z40.
Y63.024
Z25.
G1 Z-4.524 F1143.
G2 X299.404 Z-5. I0.476 K0.
G1 X299.642
G17 G3 X300.119 Y63.5 I0. J0.476
X204.881 I-47.619 J0.
X300.119 I47.619 J0.
X299.642 Y63.976 I-0.476 J0.
G1 X299.404
G18 G3 X298.928 Z-4.524 I0. K0.476
G0 Z40.
X408.928 Y63.024
Z28.
G1 Z-1.524 F1143.
G2 X409.404 Z-2. I0.476 K0.
G1 X409.642
G17 G3 X410.119 Y63.5 I0. J0.476
X314.881 I-47.619 J0.
X410.119 I47.619 J0.
X409.642 Y63.976 I-0.476 J0.
G1 X409.404
G18 G3 X408.928 Z-1.524 I0. K0.476
G0 Z40.
Y63.024
Z27.
G1 Z-2.524 F1143.
G2 X409.404 Z-3. I0.476 K0.
G1 X409.642
G17 G3 X410.119 Y63.5 I0. J0.476
X314.881 I-47.619 J0.
X410.119 I47.619 J0.
X409.642 Y63.976 I-0.476 J0.
G1 X409.404
G18 G3 X408.928 Z-2.524 I0. K0.476
G0 Z40.
Y63.024
Z26.
G1 Z-3.524 F1143.
G2 X409.404 Z-4. I0.476 K0.
G1 X409.642
G17 G3 X410.119 Y63.5 I0. J0.476
X314.881 I-47.619 J0.
X410.119 I47.619 J0.
X409.642 Y63.976 I-0.476 J0.
G1 X409.404
G18 G3 X408.928 Z-3.524 I0. K0.476
G0 Z40.
Y63.024
Z25.
G1 Z-4.524 F1143.
G2 X409.404 Z-5. I0.476 K0.
G1 X409.642
G17 G3 X410.119 Y63.5 I0. J0.476
X314.881 I-47.619 J0.
X410.119 I47.619 J0.
X409.642 Y63.976 I-0.476 J0.
G1 X409.404
G18 G3 X408.928 Z-4.524 I0. K0.476
G0 Z90.
G17

M9
G28 G91 Z0.
G90
G28 G91 X0. Y0.
G90
M30
« Last Edit: February 01, 2019, 04:21:09 PM by Mike1000 »
Hi,
I don't claim any expertise at reading Gcode but does this line:
Code: [Select]
G28 G91 Z0.leave the Z axis at zero and  shortly thereafter the line:
Code: [Select]
G0 X41.57 Y100.524drives to the location of your first cutting move......but at Z=0!

I would estimate that machine is doing what it is told......its just that you, or rather your CAM program have told
it to do something you don't like.

Try editing the line to:
Code: [Select]
G28 G91 Z10and with any sort of luck the initial move will be 10mm above the material.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Fusion 360 posts the G28 G91 Z0 at the beginning of G Code, before tool changes, and at the end of G Code; this line of code will move your machine to the Z home position.  Since Z Home is usually at the top of Z travel, it is a safe place for tool changes and for starting new operations.

Using G28 G91 Z10 will move incramentally positive 10 in Z AND THEN go to machine Z home, or what Mach4 thinks home is if you don't have home switches. 
Watch this video to get am understanding of G28
https://youtu.be/Rd-h0YA9IzQ

Do you have home switches on your machine?
If you are referencing (homing) your Z on top of the material instead of just setting your Z work offset, what you are describing will occur.
« Last Edit: February 02, 2019, 01:27:21 AM by Cbyrdtopper »
Chad Byrd

Offline thosj

*
  •  532 532
    • View Profile
Yeah, G28 is TOO weird for ME. it's a two move function and if THAT is not understood you can crash something! You read a single line of Gcode thinking, OK, it moves to Zx, and it doesn't unless it's Z0. If it's Z10, it moves 10 then to zero!! Most all Gcode reads straight thru, one line does THAT, but G28 doesn't conform:)

Fusion posts CAN be edited, with Visual Studio Code or even Notepad++, but it can be daunting. 'Tho it's javascript it's a lot of code. I found the gumption to fix/edit out those G28s, but I likely didn't do it the "proper" way, so I won't be posting my edited post!!! There's a toggle in the code, USE G28, that can simply be turned off, but then the machine doesn't get up out of the way and you need to add code to get it up out of the way!! I edited the AXIS HOME or what ever it's called to use G53 moves, which read like "normal" Gcode and work for ME.

All that said, is there a skilled Fusion post editor guy hanging out here that would be willing to help a guy (ME!)? My local, Autodesk authorized, place wants $250 for what I perceive (ha!) to be some pretty simple edits. A fixed income retired guy doesn't want to pay that!

Tom
--
Tom
I have made edits to the Mach4 post for Fusion, it's not bad at all.   I also asked Autodesk to add the G30 option instead of G28 and they did that for me, it is now in the stock post for Mach4.  I use G30 all the time.   

You said you edited Axis Home...  What did you do?   
Chad Byrd

Offline thosj

*
  •  532 532
    • View Profile
Hmmm....I'll have to look exactly when I get near the machine computer. I found in the code where it was doing those G28 moves. I tried to set the USE G28 to false, but then there were no moves up or away. So I turned it back ON and found where it was in the code and changed the G28 stuff to G90 G53 *********.xx and Yxx.xx, etc. It still calls it G28, or at least the USE G28 toggle is left at true. It does what I want it to do. I don't want to move to X and Y home, too far to run at the end of a part, then run all the way back, even at 120 IPM, too far!!! So I use some G53 moves and I can tell it where to go FROM the home positions

If you use Visual Studio Code and a plugin Autodesk wrote, you can post generic output, there are several choices, and then in the code you can select a line of Gcode and it'll jump to the line in the post that generated said code. Makes it at least a little easier to work thru the complicated, at least to me, post code. I have edited PostHaste posts for GibbsCAM and that's so dead simple a caveman could do it, but this is pretty complicated. I THINK it's so complicated because the post has to handle multi-axis moves and such, not just the everyday stuff I mostly use!

My real reason for wanting/needing to edit Fusion posts is my machine, a knee mill converted, uses the knee for offsetting tool lengths, so I don't want G43 Z1. H4 type lines, I want M43 H4 to move the A (knee) the difference in tool lengths, M43 being a macro I wrote with Artsoft's help. I got that fixed in the Fusion post, too!! I keep doing this fumbling and pretty soon I'll be a programmer......well, maybe sort of, I'll never be a real programmer that lives this all day every day. Gcode/CAM programming, yes, but javascript  or lua or any of those, not so much.

I guess we're hijacking the OP's post here, sorry.

Tom
« Last Edit: February 02, 2019, 04:57:18 PM by thosj »
--
Tom
Tom, that's a pretty good idea...  Use the knee to adjust tool heights.   

I've got the visual studios plug-in, it's so much easier to modify a post with VS rather than using Notepadd++... You can post a test post and easily navigate to the script that way.   

The G30 I asked Autodesk to add acts the same way as G28 only you get to choose where the machine goes based on #VARS #5181-5186....I think that's the variables I would have to check to be sure.   But I have mine set to move the Z 6 inches below Z home, X is in the center of travel, and Y is at Y home that way once the machine is finished with the code it calls the G91 G30 X0 Y0 and it moves the machine table front and center.
« Last Edit: February 02, 2019, 05:27:32 PM by Cbyrdtopper »
Chad Byrd

Offline thosj

*
  •  532 532
    • View Profile
Chad,

That G30 sounds just like what I'd like only I went about it kind of the clunky way. Would you mind sharing that post? I'd then edit my M43 stuff into it and I'd be set and more confident the post hasn't been screwed up. Oh, and check the variables used and tell me how to set those!!!

Yes, that tool offsetting with the knee is a great thing. The quill only moves 4.8 inches so if you have more than that variability in tool lengths your doomed. The knee moves 16". The knee is too heavy to zoom around peck drilling and stuff. Originally I had the knee CNC'd for Z and didn't like all the action with the heavy knee. I even have two gas springs on the knee to relieve some of the weight and it still didn't sit well with me. Moving 8 or 10 times per program, nice and slowly/smoothly doesn't seem so bad!!! The knee has the original acme screw, so I even have the macro, when moving lower, moving -.1 and UP to final position to position better. This idea came from an old regular here way back in the 90's, Ray Livingston. I've done it since, Mach3 and now Mach4. When I mention it to others they give me the deer in the headlights look, so I've stopped even mentioning it and just machine happily on!! Works for me.

Thanks,
Tom
--
Tom
Tom,
The G30 is in the stock post supplied by Autodesk; you can download it straight from the HSM post library.  The G30 was added in October, 2018; if you have downloaded a new post since then, it will be added in there already, you just have to set it to "Use G30" under the Safe Retract properties.
Here is the link to the Post Library.
https://cam.autodesk.com/hsmposts?

Like you mentioned, you will need to add in your custom M43 into the new post. 

It is HIGHLY recommended to have a reliable home position for each axis to use any of the safe retracts, G28, G53, or G30.

G30 uses Machine Coordinate Positions, do not enter a work offset position into the #5181, #5182, and #5183 Variables, enter the Machine Coordinate Position.
 
To start, jog the machine to where you want it to be when the program is finished, for me, the table is front and center and Z about 6 inches below Z Home.  Once you have the table where you want it, look at your Machine Position under the diagnostics tab, or toggle the "Machine Coordinates" button to display Machine Coordinates on the Program Tab.  Enter X, Y, and Z positions into #5181, #5182, and #5183 respectively. 

To test this, jog the table off the positions you just recorded and type this code into MDI: 
G91 G00 G30 Z 0.00
G30 X 0.00 Y 0.00
G90

Your machine sounds exactly like the Bridgeport Series II we have, I retrofitted it about a year ago.  I really like this machine, only the quill only moves about 4.5", so when I use drills I have to adjust the knee up and down.  I also have to change Spindle RPM manually. I should have put a motor on it, but I didn't.  Using the knee to adjust the Tool Height Offset is genius; it's tempting to go back and add a motor to the knee now.  I would probably use the machine more if I do that haha!!
« Last Edit: February 03, 2019, 02:48:43 PM by Cbyrdtopper »
Chad Byrd

Offline thosj

*
  •  532 532
    • View Profile
Cool, Chad,

I'll redownload the post and start anew after figuring out how G30 works. I can just compare my current edited post for the M43 stuff.

How do I enter my positions into the # variables? I've never done that. Those variables stay put once entered, I'm guessing, right? I know where I want the positions because I use G53 now, which simply takes a "machine coordinate" position right in the Gcode line directly. I just hard coded the G53 lines in the post.

What I do with my CNC'd knee is have it set to the A axis. One thing "unusual" that I do is A+ is UP or into the work! But remember, I don't machine with the A axis, the only time the A moves is inside the M43 Macro. I do it that way so I can use positive tool lengths. I either use a dummy tool longer than any other tool or use the longest tool in a particular setup to set the A Zero position. Or set that to a tool gage block or tool setter probe. Then measure all the tools with the A axis while Z set set at zero. I have some button code setup on a screen to measure the tool, it takes the position of A and puts it in the currently loaded tool offset in the tool table. Once done gaging the tools, I set the A zero to the top of the part or wherever I want it. The tools are relative to that, so all set now. One could do this differently if you were comfortable looking at negative tool length offsets. I'm an old timer, so I'm NOT comfortable with it!!

One other bit of weirdness I do is I have my Z home at the top of the travel, like normal, but then my Ref All Home code sets that position as A 1.00, so in effect, A zero is one inch down from the highest position. Actually that Z1.000 is .020 below my home switch position, just because back in Mach3 it didn't like to go right up to the switch position, but Mach4 will. Mach4 soft limits work a lot different from Mach3 soft limits, in Mach4 you can rapid right up to them where in Mach3 in gradually slowed near the end! I just did it that way in Mach4 because that's the way I did it!! Doing this gives me some latitude above Z0 to move around between holes and stuff. It just makes sense to me so that's what I do. This is where trying to explain what I do here gets the deer-in-the-headlights stare. If we were standing at the machine I could explain it perfectly, but trying to do it in a forum post elicits eye rolls!!!

And one other thing I do is at the end of every tool in the posted gcode, I move the A down to zero, get it out of the way!! That's why A zero is set to the longest tool or a dummy long tool.

Anyway, thanks for the tip on the G30 and let me know how I get the numbers in the # variables.

Tom
« Last Edit: February 03, 2019, 06:24:17 PM by thosj »
--
Tom