Hello Guest it is March 28, 2024, 02:31:25 PM

Author Topic: Rookie needs some help.  (Read 5780 times)

0 Members and 1 Guest are viewing this topic.

Offline SScnc

*
  •  77 77
    • View Profile
Rookie needs some help.
« on: December 07, 2011, 09:25:25 AM »
My VB skills are not so hot but I understand the idea of basic programs. Anyways I need some help with a script.

What I'm trying to do is when a tool change is initiated I want Mach to look at the current tool and the tool being called, and if they are the same, to ignore the tool change and start running the program. If they are different, go to my selected tool change position and then wait for a cycle start. I have the code working like I want except for a little hiccup. If I have the setting to "Stop spindle, wait for cycle start" it won't automatically start the program if the tools are the same value. If I have it set to "AutoTool Changer" it works great except when the tool values are different it goes to the tool change position and then immediately starts running the program, not giving me a chance to actually change the tool and then hit cycle start. Any help will be greatly appreciated.

Here's what I have

Sub Main()
X = GetUserDRO ( 1200 )
Z = GetUserDRO ( 1201 )
NewTool = GetSelectedTool
OldTool = GetCurrentTool
If NewTool = OldTool Then
   Exit Sub
Else
   Code "G53 G0 , Z" & Z
   While IsMoving
   Wend
   Code "G53 G0 , X" & X
End If

End Sub


Thanks
 

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Rookie needs some help.
« Reply #1 on: December 07, 2011, 11:43:40 AM »
I know why it doesn't work, but I'm not sure if it can be fixed. I believe the "Wait for Cycle Start" part is hard coded into mach3, so there's no way to avoid it?

With "Stop Spindle, Wait for Cycle Start", Mach3 is running two macros. M6 Start, then wait for the user, then M6 End. There's no code to get rid of the "wait for the user" part between the macros.

When using "Auto Tool Changer", Mach3 just runs the M6 Start macro.

What you could do is add the M6 End code to the M6 Start, and add a Message Box to pop up when you need to change tools. So instead of using Cycle Start to continue, you'd click OK in the message box to continue.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline SScnc

*
  •  77 77
    • View Profile
Re: Rookie needs some help.
« Reply #2 on: December 07, 2011, 12:51:01 PM »
My M6End is empty. and the computer is not within arms reach of the machine. To have to go over and click 'okay' every time would be a PIA. Any other ideas?

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Rookie needs some help.
« Reply #3 on: December 07, 2011, 03:40:26 PM »
I already told you.

Just add the MsgBox and set it to Auto Tool Change:


Sub Main()
X = GetUserDRO ( 1200 )
Z = GetUserDRO ( 1201 )
NewTool = GetSelectedTool
OldTool = GetCurrentTool
If NewTool = OldTool Then
   Exit Sub
Else
   Code "G53 G0 , Z" & Z
   While IsMoving
   Wend
   Code "G53 G0 , X" & X
   While IsMoving
   Wend
MsgBox "Change Tool!!"
End If

End Sub
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline SScnc

*
  •  77 77
    • View Profile
Re: Rookie needs some help.
« Reply #4 on: December 08, 2011, 08:04:21 AM »
Sorry that's not how I want it setup. Thanks anyways.

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Rookie needs some help.
« Reply #5 on: December 08, 2011, 09:04:06 AM »
To me it's almost exactly what you asked for, but you click a different button than Cycle Start.

I don't think it's possible to do butyou want, but if you figure out a way, please let us know.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Rookie needs some help.
« Reply #6 on: December 08, 2011, 09:30:13 AM »
THere are ways to do what you want BUT not what I would consider SAFE ways.

You DO NOT want to be working with a spindle changing tools out when in a CB software HOLD. 

(;-) TP

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Rookie needs some help.
« Reply #7 on: December 08, 2011, 09:59:20 AM »
Yes, I probably should have mentioned that.
However, even with the normal Mach3 "Wait for Cycle Start", I prefer some type of lockout while changing tools. With some setups, if the PC happens to crash (although extremely rare) it's possible for the spindle to start if you don't have a charge pump, but I wouldn't trust the charge pump with my hands either. :)
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline SScnc

*
  •  77 77
    • View Profile
Re: Rookie needs some help.
« Reply #8 on: December 08, 2011, 04:29:57 PM »
Well that might work for me because this is on a lathe and the spindle is manual control. How can I make this work?

Offline SScnc

*
  •  77 77
    • View Profile
Re: Rookie needs some help.
« Reply #9 on: December 08, 2011, 04:32:02 PM »
Also I have a button for cycle start. Like I said the computer is not at a convenient location where I want to be pressing cycle start or clicking OK. I can see the screen from where I operate the machine but it's not within arms reach. I have all the controls I use right where I can reach them and watch the machine at the same time.