Clearance and Retract Heights, and Going to Z0 First Causes Collisions

Clearance and Retract Heights, and Going to Z0 First Causes Collisions

russtuff
Advocate Advocate
10,965 Views
37 Replies
Message 1 of 38

Clearance and Retract Heights, and Going to Z0 First Causes Collisions

russtuff
Advocate
Advocate

Hey crew, I appreciate any help you can offer, as I'm still learning and am not all that solid when it comes to offsets and heights. I am hoping someone can offer me some insight, as I am having issues with the code Fusion is generating for me (I post to LinuxCNC).

 

I may be misunderstanding the definitions I've found on the Fusion Help site for these heights, so I'll copy them first so we are all on the same page:

 

~ The Clearance height is the first height the tool rapids to on its way to the start of the tool path.
~ Retract height mode sets the height that the tool moves up to before the next cutting pass.
~ Feed height mode set the height that the tool rapids to before changing to the feed/plunge rate to enter the part.

 

In this shot you can see my part, the four slots I'll be pocketing, and the heights I have for this setup.

DC Motor Mount Height Settings.png

 

Based on the above definitions, here is what I expect to happen:

 

1. Rapid to Z3

2. Rapid to XY whatever

3. Rapid to Z.1 (the Feed height)

4. Feed into the first slot and do the job

5. Rapid up to Z.1 (the Retract height, which also happens to be the Feed height)

6. Rapid to the next XY whatever

7. Steps 4-6 until the fourth slot is done

8. Rapid to Z3 and end the program

 

My first problem is outlined in the code below, where we are going to Z0, then moving in the XY (crashing into the fixture), then retracting to Z3. Here is some sample code, and I have highlighted the movements to make it easier on the eye:

%
(POCKETING 4 SLOTS)
(T6  D=0.2187 CR=0. - ZMIN=-0.22 - FLAT END MILL)
N10 G90 G94 G17 G91.1
N15 G20
N20 G53 G0 Z0.
(2D POCKET 4 SLOTS)
N25 M9
N30 T6 M6
N35 S4600 M3
N40 G54
N45 M8
N55 G0 X-0.9606 Y4.9231 (crash)
N60 G43 Z3. H6
N65 G0 Z0.1219
N70 G18 G3 X-0.9818 Z0.1 I-0.0219 K0. F24.
N75 G1 X-1.18 Z0.0931
N80 G17 G3 Y4.8269 Z0.0878 I0. J-0.0481

the program goes on and on

 

My second problem is that after doing the first slot, instead of retracting to the Retract height and rapiding to the next slot it is retracting to the Clearance height. This isn't a major issue, and only a little inefficient since we are moving at rapid speed anyway. Here is a screenshot of the simulation where I would expect to see the movements between slots happen at Z.1, but they are happening at Z3:

DC Motor Mount Retracting to Clearance Height.png

 

My third (and final) problem (and now I'm really being picky), is at the end of the program we are at Z3 from the final retract, but head back to Z0. It makes more sense to me that it should stay up at Z3 so I can change setups. I always just delete that part of the code, which you can see here:

program has been going nicely....
N1115 X-4.3347 Y4.9264 Z-0.211 I0.0121 J-0.0182
N1120 X-4.3367 Y4.924 Z-0.2049 I0.0158 J-0.0151
N1125 X-4.3373 Y4.9231 Z-0.1981 I0.0178 J-0.0127
N1130 G0 Z3.
N1140 M9
N1145 G53 Z0. (I always remove this line)
N1150 M30
%

 

Thank you anyone who can explain or help.

rus, making stuff
youtube.com/russtuff
0 Likes
10,966 Views
37 Replies
Replies (37)
Message 21 of 38

daniel_lyall
Mentor
Mentor

You need to home the machine or lift it up before you hit start.

 

http://www.practicalmachinist.com/vb/cnc-machining/what-thinking-behind-g28-336637/?utm_source=Pinpo...

 

http://www.cnctrainingcentre.com/news/work-offsets/

 

https://www.youtube.com/watch?v=ISerhQ4J9Kc

 

https://www.youtube.com/watch?v=Bd6-BQUCbVA


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 22 of 38

g.awada
Explorer
Explorer

thank you for your reply and the links, but they havent really helped to be honest.

here is a section of my generated gcode file, you can see that the machine moves along the x and y axes before retracting and going back down for carving, as opposed to retracting, then moving along x and y and then going back down.

any thoughts?

 

(Made in : Autodesk CAM Post Processor)
(G Code optimized for OpenBuilds OX CNC 1000 x 750 with GRBL V0.9j controller)

(Program Name : msba7 mnsour)
(1 Operation 🙂
(1 : 2D Contour1)
( Work Coordinate System : G54)
( Tool : Drill 1 Flutes, Diam = 0.16mm, Len = 1.6001999999999996mm)
( Spindle : RPM = 10000, set router dial to 1)
( Machining time : 3 min 49 sec)

G90 G94
G17
G21

(Operation 1 of 1 : 2D Contour1)

G53 G0 Z0
G54
S10000 M3
G4 P0.8
X-1.425 Y15.611
Z11
G1 Z6 F1000
Z-5 F200
G2 X-1.405 Y15.713 I0.07 J0.039 F1000

Message 23 of 38

daniel_lyall
Mentor
Mentor

@g.awada wrote:

thank you for your reply and the links, but they havent really helped to be honest.

here is a section of my generated gcode file, you can see that the machine moves along the x and y axes before retracting and going back down for carving, as opposed to retracting, then moving along x and y and then going back down.

any thoughts?

 

(Made in : Autodesk CAM Post Processor)
(G Code optimized for OpenBuilds OX CNC 1000 x 750 with GRBL V0.9j controller)

(Program Name : msba7 mnsour)
(1 Operation 🙂
(1 : 2D Contour1)
( Work Coordinate System : G54)
( Tool : Drill 1 Flutes, Diam = 0.16mm, Len = 1.6001999999999996mm)
( Spindle : RPM = 10000, set router dial to 1)
( Machining time : 3 min 49 sec)

G90 G94
G17
G21

(Operation 1 of 1 : 2D Contour1)

G53 G0 Z0   read this https://www.shapeoko.com/wiki/index.php/G-Code  these 2 are the first moves you need to learn this.
G54              and read this https://github.com/grbl/grbl/issues/613
S10000 M3
G4 P0.8
X-1.425 Y15.611
Z11
G1 Z6 F1000
Z-5 F200
G2 X-1.405 Y15.713 I0.07 J0.039 F1000


 


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

Message 24 of 38

russtuff
Advocate
Advocate

Hello.

Have you tried deleting the G53 line from your code? I think this is your problem (as it was mine). I have been deleting G53 from my code for a long time until I learned how to deal with it. My machine does not have home/limit switches but LinuxCNC still requires me to "home" each axis. I can have the machine in any position I want when I click the home button for each axis, because it isn't going to matter anyway once I do my touch-off. If you do have home switches and your machine moves when you home an axis, my process below isn't going to help. Here's what I do:

 

1. Home all axis in LinuxCNC (even though my machine doesn't move around at all and all it does is change the home coordinates to zeros.

2. Touch off on the part I'm about to machine. I normally set Z0 at the top of my stock

3. Move the Z-axis some amount above the stock (maybe 4")

4. Re-home the Z-axis (remember, my machine doesn't actually move because it knows there isn't a home switch to go find)

5. Touch off the Z-axis on the stock again (resetting G54), yes this is tedious.

 

Now when that G53 Z0 line gets called, the machine will move to machine coordinate Z0 which is 4" above the stock.

You might not have to do step 5, so test it out before committing.

rus, making stuff
youtube.com/russtuff
Message 25 of 38

daniel_lyall
Mentor
Mentor

The grbl you can turn it off and on to set the home position on it, or use a G code to reset home, it's all in there wiki if you are not useing home switches. 


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 26 of 38

HRTFAB
Enthusiast
Enthusiast

Hey guys sorry to kick the dead horse but I have been having the same issue with my machine the only difference is my machine does have limit switches. My machine is an early 1990's bridgeport btc-1. It was retro fitted with Gecko drives and runs on a PC with Mach 3. Every time i post i have to go to the M8 line and enter a G0 Z.1  or whatever clearance i need for fixtures and bolt heads etc... I also have to go to the end of the code and delete the G28 command as it will also retract to work offset Z0 not machine  Z0 and leave a light cut across the surface of my parts? Any help would be very useful, as modifying the  code every time is very time consuming. 

0 Likes
Message 27 of 38

daniel_lyall
Mentor
Mentor

G28 is goto machine zero same with G30 have a look at the Mach3 manual you can get it from here http://www.machsupport.com/help-learning/product-manuals/

 

Have a read of this so you know what g28 is and does  https://www.cncci.com/resources/tips/how%20g28%20works.htm

 


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 28 of 38

HRTFAB
Enthusiast
Enthusiast

so I read both links that you sent, specifically Machs explanation of homing limtis and G28 in section 5-19, unfortunately this was not very helpful. The second link was very informative , but im not sure if it can help me with my issue, or maybe im just  not seeing it? Ill admit that I always though that G28 sent the tool to the current work offset x,y,z zeroes but I went out and tried it on my machine and sure enough, it sent it to the machines work offset. But i dont see how this helps me with the issue in the code? I will atttatch an f3d file to try and illistrate where im having issues in the post maybe you can help me see what im missing here.

0 Likes
Message 29 of 38

HRTFAB
Enthusiast
Enthusiast

(1001)
(LEFT REAR CORNER MODEL NOSE FACE LT)
(T9 D=0.25 CR=0. - ZMIN=-0.68 - FLAT END MILL)
G90 G94 G91.1 G40 G49 G17
G20
G28 G91 Z0.
G90

(2D POCKET1)
M5
M9
T9 M6
S1750 M3
G54
M8

 

(if i dont add a G0Z+ value like G0Z.1 here, the tool drags across the part due to the prvious G28 G91 Z0 location)


G0 X2.2301 Y-0.4767
G43 Z0.6 H9
Z0.2
G1 Z0.125 F20.
G3 X2.2299 Y-0.4756 Z0.1174 I-0.1164 J-0.0233 F10.
X2.2291 Y-0.4722 Z0.1106 I-0.1162 J-0.0244
X2.2278 Y-0.4671 Z0.1051 I-0.1155 J-0.0278
X2.2257 Y-0.4607 Z0.1014 I-0.1141 J-0.0329
X2.223 Y-0.4537 Z0.1 I-0.1121 J-0.0393
X2.0043 Y-0.5463 Z0.087 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z0.0739 I0.1093 J0.0463
X2.0043 Y-0.5463 Z0.0609 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z0.0479 I0.1093 J0.0463
X2.0043 Y-0.5463 Z0.0349 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z0.0218 I0.1093 J0.0463
X2.0043 Y-0.5463 Z0.0088 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.0042 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.0172 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.0303 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.0433 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.0563 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.0694 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.0824 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.0954 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.1084 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.1215 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.1345 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.1475 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.1606 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.1736 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.1866 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.1996 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.2127 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.2257 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.2387 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.2517 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.2648 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.2778 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.2908 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.3039 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.3169 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.3299 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.3429 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.356 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.369 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.382 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.3951 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.4081 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.4211 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.4341 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.4472 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.4602 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.4732 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.4862 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.4993 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.5123 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.5253 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.5384 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.5514 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.5644 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.5774 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.5905 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.6035 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.6165 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.6296 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.6426 I-0.1093 J-0.0463
X2.223 Y-0.4537 Z-0.6556 I0.1093 J0.0463
X2.0043 Y-0.5463 Z-0.6686 I-0.1093 J-0.0463
X2.2324 Y-0.5 Z-0.68 I0.1093 J0.0463
X2.0025 I-0.115 J0.
X2.235 I0.1163 J0. F20.
X1.765 I-0.235 J0.
X2.235 I0.235 J0.
X2.2338 Y-0.4924 Z-0.6788 I-0.025 J0.
X2.2308 Y-0.4861 Z-0.6752 I-0.0238 J-0.0076
X2.2273 Y-0.4819 Z-0.6697 I-0.0208 J-0.0139
X2.2245 Y-0.4796 Z-0.6627 I-0.0173 J-0.0181
X2.2235 Y-0.479 Z-0.655 I-0.0145 J-0.0204
G0 Z0.6

M9
G28 G91 Z0. (I always have to delete this line and the next so that after the M9 command, it reads G91 Z+ for the same reason as above, for example M9, G91 Z.5, M30
G28 X0. Y0.
M30

0 Likes
Message 30 of 38

HRTFAB
Enthusiast
Enthusiast

ok it took me a second but i get it now, well where there problem is anyways. so the first line where we see G28 G91 Z0 in the example above if i understand G28 correctly should have left the tool above the current work offset at whatever  the current +Z  machine offset is (the work offset is always -Z from the machine cordinates), and then move to that X Y location at the machine Z0 after the M8 command. So heres whats happening, when the G28 G91 Z0 command is executed my machine goes to machine cordinate Z0 but immeditatley back to work cordiante Z0, then it tries to cut throguh fixtures and such on its way to the first X Y command, what do you think is causing it to return to current work offset ZO ????  I suspect whatever is causing this is also causing my issue with the G28 command at the end of the code also.

Thanks for your help in advance, this has really been kicking my a**

0 Likes
Message 31 of 38

daniel_lyall
Mentor
Mentor

It's not fusion where the problem is it's in Mach3, I can show you all day my machine going to G28 at the start of the G code then going to the first cut position (Work Zero) same at the end and not crashing or anything bad.

 

It sounds more like Mach3 has pooped itself, you have a offset stuck or a tool change position set, what version of Mach3 are you useing.

 

One thing to try is put in G40 and G49 into the mdi then restart mach3 and putting the G40 and G49 in to the MDI again then home the machine and set the work Zero's and run a g code again with the G28 in it.

 

Do it as an air cut if the machine does not goto Machine Zero at the start where it is in the G code you will have to try doing a overwrite of Mach3 with a fresh copy.


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 32 of 38

HRTFAB
Enthusiast
Enthusiast

sorry for the delay, ive been really busy lately. Thanks for taking the time to respond to this. I would really love to figure this out but at this point im still at a loss. The problem appears to be in fusion 360 converting the post to Mach 3, as the issue i am having is visible in the Post, before it ever gets loaded into Mach 3. As previously stated I do have limit switches, and everything works fine as long as I manually change the post where I showed. For what its worth I have the latest version of Mach 3. One thing that I have noticed recently, is if I choose an edge of a model for my top height Fusion generates a clearance move before the first x,y position move, but if I just select model top which is what makes sense to me, it goes from G0 to the first x,y location dragging the tool across the work piece.

0 Likes
Message 33 of 38

daniel_lyall
Mentor
Mentor

Have a read of these and have a nice day.

 

https://www.cncci.com/resources/tips/how%20g28%20works.htm

 

https://www.cnccookbook.com/g28-g-code-cnc-return-reference-position/


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes
Message 34 of 38

g.awada
Explorer
Explorer

just solved this! and the solution is much easier than you think.

 

I'm using Mach3.

Go to Config-->Homing/Limits 

on the left corner of the popup window is G28 home location coordinates, by default all are set to zero. Change that to whatever Z value you are comfortable with an you're done! I dont have limit switches installed but now the machine considers its 'home' to be whatever offset you specify. I left X and Y at zero and changed the Z offset.

 

Turns out everything was working just fine, G28 gets called, machine goes home, except home was exactly where it is.

 

*If your machine is acting stupid, its because you told it to do so!

Message 35 of 38

daniel_lyall
Mentor
Mentor

That's just one of the ways you can do it you set it there for atc as well.

 

The problem will come back if you do not set a Machine Zero/Home the machine never knows where it is, it will only know where the work zero is.

 

If you don't have switches move the machine to  a safe position and hit ref all home it will do a in places home.

 

But that's me being a safety nazis o well never mind

 

 

 

 

 


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

Message 36 of 38

Anonymous
Not applicable

I haven't found the Linuxcnc post processing file to modify but my work around is when Brackets opens I just add a 1 to the end of line 7 so that it goes up .1 inch above my work piece as it goes to the start position from home.  N20 G53 G0 Z0.1  And then save that file to use for my operating .ngc file on Linuxcnc. 

0 Likes
Message 37 of 38

Anonymous
Not applicable

If you post process your project you can edit the linuxcnc configuration file by selecting the open config button to the right of the selected linuxcnc machine.  When you open that file you can put two slashes to make the commands into comments that won't be run on lines 618 and 1426 which will make it look like this:    // writeRetract(Z); (I imagine these line numbers will change with new versions so you should search or writeRetract(Z) while using the Brackets editor instead of relying on my line numbers.  With these lines commented out it removes the annoying line 7 N20 G53 G0 Z0.  and also the end of file returning to Z0.  When you make these changes save your file with a different name like Linuxcnc Z0 mod.cps so that you don't overwrite your original file.  Then close the post processor and re-open it and select your modified post processor. 

0 Likes
Message 38 of 38

daniel_lyall
Mentor
Mentor

@Anonymous That is a very dangerous thing to do, you do not just remove something if you do not understand what it is for G53, G28 and G30 is a move to machine zero if you do not have this and the machine does an X and Y move if anything is in its way it will smash through it including you if you are in the way.


Win10 pro | 16 GB ram | 4 GB graphics Quadro K2200 | Intel(R) 8Xeon(R) CPU E5-1620 v3 @ 3.50GHz 3.50 GHz

Daniel Lyall
The Big Boss
Mach3 User
My Websight, Daniels Wheelchair Customisations.
Facebook | Twitter | LinkedIn

0 Likes