G-Code fail

Discussion of various (CNC related) topics which are not product support issues.
Post Reply
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

G-Code fail

Post by nambass »

I am trying to get the g-code sample to work. I got Cabinet Vision and the g-code generated by the post processor is not working. so now we try to create a sample file that will work.

I have a manual tool change spindle and is using the master tool mode.

After I ref all I change to master tool, measure it and then set my axis - zero position on the corner of the work piece,

Then I load the code below and run
After the first tool change, the z-limit is triggered because the Z-axis is trying to go to high up. I have compared this with aspire Mach 3 files but the files seems to be the same.

Please help!

%
O0001
N20 G00 G21 G17 G90 G40 G49 G80
N30 G71 G91.1
N40 T01 M06
N41 G00 G43 Z38.100 H1
N50 S18000 M03
N60 G0 X350.95 Y620.156
N70 G1 G41 D11 X393.15 Y613.806 Z-0.1000 F2000
N80 X781.3 F10000
N90 Y5.
N100 X5.
N110 Y613.806
N120 X393.15
N130 X405.85
N140 G40 X448.05 Y620.156 Z21.000
N141 Z38.000
N142 G00 X0 Y0
N150 M05 M30
%
User avatar
DaveCVI
Site Admin
Posts: 798
Joined: Mon Feb 04, 2013 3:15 pm
Contact:

Re: G-Code fail

Post by DaveCVI »

Hi,
Below are some comments re the gcode - perhaps they will help
Dave

%
O0001
N20 G00 G21 G17 G90 G40 G49 G80
The above appears to be the initialization line emitted by the post processor.
It does not set the Work Coordinate system to be used. That is OK, as the default is G54, but I prefer to not depend
on defaults, and to set G54 explicitly. As is, the code will use whatever the current WC is set to.

N30 G71 G91.1
I don't know what the G71 is doing here. G71 is not a valid mill gcode for mach (as far as I know). It is commonly a lathe roughing cycle. You would expect mach to error out on the invalid gcode, but it does not - this is a known deficiency of mach - it accepts mill codes in lathe mode and lathe gcodes in mill mode... What the effect of doing a G71 in mill mode is I can't say. To eliminate a potential problem, I'd not have a post processor emit it in mill gcode.

N40 T01 M06
OK, we've now mounted tool #1

N41 G00 G43 Z38.100 H1
And this line will apply the TLO for tool #1 and then try to go t a height of 38.1 in the current cork coordinate system.
This is the line that you say goes to high right?
Well, this is trying to go 38.1 above wherever you set the WC Z0 to for the current WC system.
If you do not have that much space above Z0 (+ the length of the tool) then you will run out of travel.
Check the TLO value for tool #1 (I'm also assuming that it is getting measured and the TLO value is getting set as part of the M6 above).

It would seem that the key question is: Why is the code trying to go to Z38.1?
My guess is that the cam program (or the the post processor) thinks this is some safe height at which is can then do the rapid move in the next line.

So what is calling for this height for rapid moves?

N50 S18000 M03
N60 G0 X350.95 Y620.156
N70 G1 G41 D11 X393.15 Y613.806 Z-0.1000 F2000
N80 X781.3 F10000
N90 Y5.
N100 X5.
N110 Y613.806
N120 X393.15
N130 X405.85
N140 G40 X448.05 Y620.156 Z21.000
N141 Z38.000
Again here the code is trying to go to Z38.. why?

N142 G00 X0 Y0
N150 M05 M30
%[/quote]
Productivity Software for Personal CNC Machinists
http://www.CalypsoVentures.com
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

Re: G-Code fail

Post by nambass »

Thanks for the feedback

What do you recommend for the safe z height - will 20 be enough?

Also do you recommend I remove the G71 and define G45?


What is strange is that the test code was compared with code I generated using Aspire and the Asire code worked fine. And most of the initializing lines was copied line by line to make sure it is identical. Yest on my sample code I got the limit switch error.
User avatar
DaveCVI
Site Admin
Posts: 798
Joined: Mon Feb 04, 2013 3:15 pm
Contact:

Re: G-Code fail

Post by DaveCVI »

nambass wrote:Thanks for the feedback

What do you recommend for the safe z height - will 20 be enough?
You need enough height to clear whatever may be in the path of the rapid move. Since I don't know that, I can't tell you "how much is enough".
nambass wrote: Also do you recommend I remove the G71 and define G45?
I would remove the G71.
Re the G54 I prefer to set it explicitly - but many like to use whatever the current WC system is set to - in which case you leave out any explicit choice of WC system. G54 is the default WC system is one is not set explicitly.
BTW - I think you meant to type G54 instead of G45.
[/quote]
nambass wrote: What is strange is that the test code was compared with code I generated using Aspire and the Asire code worked fine. And most of the initializing lines was copied line by line to make sure it is identical. Yest on my sample code I got the limit switch error.
Any machine has a fixed amount of total Z travel. Generally, Z0 is at the top of the Machine Coordinates (Note that I said machine coordinates) and the travel downward in Z is in the minus direction. So let's say you had a total travel of 1m or 1000mm in Z. The Machine coords would then be from Z=0 to Z=-1000.

Now then, the Work coordinate system is NOT the same as the machine coordinate system. They are shifted from each other. The amount of that shift is call the work coordinate offset - which is what you are setting when you set the work coordinate Z0 level.

Let's say that the WCZ0 is set to a physical level that corresponds to MCZ = -500 (i.e. in the middle of the physical Z travel limits). Now you have a total of 500mm travel between WCZ0 and the top of physical travel.

OK, now you decide that 200mm is enough clearance space to do your rapid movements.... you had better now be using a tool that is not longer than 500-200 = 300mm in length. If the tool is longer, when you ask the machine to put the tool tip at WCZ=200, you will be asking the physical spindle Z height to be above the top of MCZ0.

Look through chapter 4 and 5.2 of the MSM user manual to see pictures of how a CNC control (mach in this case) calculates conversions from MC to WC and back and how Tool length offsets impact this.
Another good source for this topic is Peter Smid's book "CNC Programming Handbook".

Dave
Productivity Software for Personal CNC Machinists
http://www.CalypsoVentures.com
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

Re: G-Code fail

Post by nambass »

I have earlier sent all my screens of my current settings.

I am trying to run this code but it fails on the 2nd tool change because it triggers the z-limit switch. What I do noticed after the first tool change, the spindle is moving about 80mm from the board as the zafe limit. My maximum z-limit is 82mm.

Ok this is because I have added extra space to do a test cut in the air before I execute the real cut.

But this issue is still the 80mm safe z limit - is my concern because this triggers the z-limit switch on the 3rd tool change.

Any help will be appreciated . I included the gcode as generated by cabinet vision software.
Attachments
R730101N.zip
(4.95 KiB) Downloaded 957 times
User avatar
DaveCVI
Site Admin
Posts: 798
Joined: Mon Feb 04, 2013 3:15 pm
Contact:

Re: G-Code fail

Post by DaveCVI »

Hi,
I suspect that you are still having the same problem as in the prior posts.
In a previous reply, I offered some suggestions of things to look at... It still appears to that you are attempting to use a combination of Z height and tool length that ends up being more than the total travel the machine has.
That is a matter of "operator setup" for a CNC machine. You need to check travel amounts, tool length offset values etc.
The references I suggested in a prior response cover those topics in good detail.

This does not appear to be a technical problem with MSM, and I'm sorry but I don't have the time to work thru 800+ lines of gcode that was generated by your CAM program to analyze it for you.

Dave
Productivity Software for Personal CNC Machinists
http://www.CalypsoVentures.com
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

Re: G-Code fail

Post by nambass »

Hi Dave

I removed G71 and also recon it will be safe not do define G54.

As for your previous explanation and assessment, you are correct. IT is definitely the issue of my Z-axis is close to the limit and then when M06 is initiated, the machine want to move beyond the maximum travel distance. But the main reason for this is the safe distance it clears above my WC Z0 is about 80mm.

And this is my question. Where do i define the safe z travel distance?
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

Re: G-Code fail

Post by nambass »

Dave I just want to exlain some more:

My Z- Zero is on top and in Mach I have setup Safe Z to be active and set it to be -0.1 (Just to keep it less then my maximum)

Then I noted in the MachStdMill Settings screen the Safe Z Height is set to be -0.1
The Repid Max is 1000.

Is this not the settings I need to look at or change. As I said the current clearance my machine have for rapid travel os about 80mm. and this is too much.

Regards

Andre
nambass
Posts: 19
Joined: Wed Feb 26, 2014 12:25 pm
Location: Windhoek

Re: G-Code fail

Post by nambass »

Here is a copy of my settings screen.

As I said earlier:
My machine is setup for Z 0 to be on top and move in negative. The TP is located at -167.3607 which is very close to the top of my table surface. So this means my maximum z travel is about -170.0000.

I have set the Max height for Z axis to be -0.1 to be little less than the maximum z travel and the Z- home position.

I noted on my settings screen a few things that I am not sure about:
a) Safe Z Height - Is the setting correct then?
b) Rapid Max - is set to be 1000 but do not know if this is correct or what it should be.
c) Max Dist on Touch is set to be 180.000 - Should this not be a negative value and set to be -170.000
d) Max Dist on TC Pos is is set to be 180.000 - Should this not be a negative value and set to be -167.3607
e) CV Dist is set to be 180.00 - am not sure if this is correct?

will appreciate if you could help explaining these as the manual is not clearly explaining all the above.
Attachments
Settings screen
Settings screen
Settings.jpg (70.02 KiB) Viewed 12969 times
User avatar
DaveCVI
Site Admin
Posts: 798
Joined: Mon Feb 04, 2013 3:15 pm
Contact:

Re: G-Code fail

Post by DaveCVI »

Hi,
for sake of conversation, let's assume the part is a simple, flat, rectangular block. To more the tool across the top of the part, all that is needed is some clearance between the tool tip and the top of the part. I was taught to use about 0.100" or about 2.5mm. The amount is not really critical as long as there is clearance... so If I were working in metric units, that would be 2.5mm, I'd pick 3mm or maybe 5mm until I got used to the fact that the tool tip was not dragging on the part.

This clearance height is usually a parameter that is set in the CAM program. This makes sense as the CAM program is what knows about the geometry of the part - so if you add a boss that sticks up, the CAm programs knows and can adjust the WC Z height to leave the desire 5mm clearance. How fancy this gets all depends on how mart your CAm program is (and probably how much it costs :o )

Most CNC controls don't try to know anything about the part the part - they just move the tool tip to where the gcodes them to go.

No then, mach3 has a "feature" that tries to help in this area - and I dislike it. That "feature" is "safe Z height" which is the DRO you see on the MSM settings common screen. Alas, this is another feature that I know to cause problems. I highly recommend NOT USING the mach safe Z feature. The problems are that the login inside mach that tries to figure out a "Safe Z" height can be flaky and depends on several other settings. Sometimes the value us set in MC and sometimes in WC. Turn it off (just set to zero I believe), and mach will not be messing with the tool height.

The Mach safe Z is another place that mach tries to"help" the operator - but just ends up making a mess of things. When it moves the Z height, the tool tip is no longer where the gcode told the tip to be in Z - and this can cause problems.

Dave
Productivity Software for Personal CNC Machinists
http://www.CalypsoVentures.com
Post Reply