Hello Guest it is April 19, 2024, 02:58:54 PM

Author Topic: Crash after tool change  (Read 1986 times)

0 Members and 1 Guest are viewing this topic.

Offline Azalin

*
  •  181 181
    • View Profile
Crash after tool change
« on: April 01, 2022, 05:39:51 PM »
Hi,

I have a very weird problem and I broke too many end mills in one week. Here's the problem:
- I start a program.
- Mach4 pauses on tool change.
- I manually change the tool, move Z axis to position then click I click "ZERO Z" button.
- Then I click cycle start to continue the program.
- Program continues and the Z axis dives into the part and crashes.

I tried the same code on my cnc router with Mach3 but it works good.

The tool change line in the code is:
N115 T2 M6 D2 H2

Note: The M6.mcs is attached

What could cause this?

Thanks in advance,
Suat

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #1 on: April 01, 2022, 05:44:38 PM »
Forum wont let me attach the M6.mcs file somehow. But here it is:

function m6()

   local inst = mc.mcGetInstance()
   local selectedTool = mc.mcToolGetSelected(inst)
   selectedTool = math.tointeger(selectedTool)
   local currentTool = mc.mcToolGetCurrent(inst)
   currentTool = math.tointeger(currentTool)
   
   if selectedTool == currentTool then
      mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
   else
      mc.mcSpindleSetDirection(inst, 0)
      --Remove this line if you would not like the Z axis to move
      --mc.mcCntlGcodeExecute(inst, "G90 G53 G0 Z0.0");--Move the Z axis all the way up
      mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
      mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
      mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
      mc.mcToolSetCurrent(inst, selectedTool)
   end
end

if (mc.mcInEditor() == 1) then
   m6()
end

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #2 on: April 02, 2022, 02:53:54 PM »
OK I added a quick video.

In the video I used a simplified g-code. It starts with a drill operation. After drilling is complete (at second 0:42) Mach4 pauses and waits for me to change the tool. Once I change the tool I move the Z Axis to the location then I hit Zero Z. Now I hit Cycle Start to continue then I expect the Z axis to go and stop at -1 but it actually goes to -33 (and crashes).

It is really annoying and I need to know why Mach4 does this.

https://www.youtube.com/watch?v=tklMVuiullY
Re: Crash after tool change
« Reply #3 on: April 02, 2022, 03:39:59 PM »
Hi,
my only guess is that you have tool length offset active.

I notice that while you change to tool number two, the tool length stays the same as tool one.

Try putting a g44 at the top of the code and try again.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Crash after tool change
« Reply #4 on: April 02, 2022, 03:45:27 PM »
Hi,
just had a much closer look at your video and you have a line:
N50 H43 H1 Z2

That's where your tool length offset is being applied. Tool length offsets work really well PROVIDED you keep clear in your mind what offset is being
applied at any given time. If you don't keep a track of it the DON'T use them.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #5 on: April 02, 2022, 05:05:59 PM »
Hey Craig,
Which line exactly?


%
O1 (CYCLOIDAL WHEEL)
N5 G0 G40 G49 G80 G21 (Initialisation)
N10 G0 Z0 (Retour aux origines machine)
N15 G0 X0 Y0
N20 (Outil n° 1 - Diametre 6.0 D1 H1)
N25 T1 M6 D1 H1
N30 S2000 M3
N35 M8
N40 (D-drill1)
N45 G0 G54 X-14.141 Y-14.036
N50 G43 H1 Z2.
N55 G83 Z-8. R2. Q2. P0 F150
N60     X-19.999 Y0.106
N100 G80
N105 G0 Z25.
N110 (Outil n° 2 - Diametre 6.0 D2 H2)
N115 T2 M6 D2 H2
N120 S3000 M3
N125 M8
N130 (P-contour)
N135 G0 G54 X-14.848 Y-14.743
N140 G43 H2 Z25.
N145 G0 Z-1
N104385 G0 X0 Y0 M5
M30
%
Re: Crash after tool change
« Reply #6 on: April 02, 2022, 07:36:53 PM »
Hi,
I can see two lines, N50 and N140, they both have a g43 in them. Do you really intend to use tool length offsets?

Your zeroing procedure is like my own, because I have a manual change mill I have touch off each and every tool,
and I zero the z axis but specifically DO NOT USE tool length offsets.

With an ATC mill each tool is measured and ascribed a tool length offset from the master tool and stored in the tool table.
Each time that tool is called and fitted into the machine you use a g43 hnnn, where nnn is the new tool number, and that tool length offset
is applied such that the tip of the tool is exactly where the tip of the master tool would be. Is that want you want
to do?.  If not then get rid of any and all g43's....they will cause crashes UNLESS you specifically require them and use them as intended.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #7 on: April 03, 2022, 07:21:54 AM »
Hi Craig,

Removing G43 from the code didn't help. Then I've removed whole N50 and N140 but didn't help too.

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #8 on: April 03, 2022, 10:00:47 AM »
Very interesting. I did a fresh install on another PC and it does the same. I removed G43 and also tried to add G49 but it just behaves the same.
Re: Crash after tool change
« Reply #9 on: April 03, 2022, 02:55:02 PM »
Hi,

Try editing this line:

Code: [Select]
N115 T2 M6 D2 H2
Remove the D2 and H2, they apply the tool length and tool diameter offsets.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'