Hello Guest it is March 28, 2024, 06:50:55 AM

Author Topic: The basics of making a switch run a script?  (Read 16079 times)

0 Members and 1 Guest are viewing this topic.

The basics of making a switch run a script?
« on: June 28, 2006, 03:34:59 PM »
Hi All

A very new user here, with a big router that has some push-button switches on the gantry. First I'll tell you what took me all day to figure out, so you can see my "expertise"....

Have 4 pushbutton switches and 1 probe (Normally Open). Got the red switch to do E-stop - easy. Then a few hours on getting the Green switch to do equivalent of Alt-R with OEM trig on Ports&Pins and External Buttons-OEM Codes on SystemHotkeysSetup (1000). 5 minutes to setup the Yellow feedhold OEM 1001.

Now to the problem at hand. The last pushbutton must plunge the z and zero the z off the probe switch. I have the probe working in Ports&Pins, and can get an OEM Trig to work off that switch. I have been told I must execute the following script when hitting the black switch:

code "g31 z-10 f50"
While IsMoving()
Wend
code "G92 Z0"
code "G0Z3"
While IsMoving()
Wend
code "g92z0"

Where do I save this code? Is it with the M12**.m1s files? Can I call an M.....m1s file with an OEM trig?

Thanks for any hints!

G

Re: The basics of making a switch run a script?
« Reply #1 on: June 28, 2006, 07:39:05 PM »
There is a way to call a script from an OEMtrig ... I can't think of it at this point :( I will get back to you
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #2 on: June 28, 2006, 08:24:07 PM »
You need to set the Macro to be called with a VBscript... SetTriggerMacro (450) would set it to M450

And put 177 for the OEM code .. Or 277.. it is one of them ... All this is in the manual if you would like to know more :) And if you have any trouble please feel free to ask!

Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #3 on: June 29, 2006, 09:29:21 AM »
I feel almost too shy to confess that I understand little of what you said. I went backwards and forwards through Using Mach3 Mill and think I am further lost now. Are you perhaps talking of some other manual?
Re: The basics of making a switch run a script?
« Reply #4 on: June 29, 2006, 12:05:40 PM »
I think this should work...

In the Ports and Pins config menu, go to inputs, select an input or an OEM trigger, put your pin and port settings for the switch you are using, and assign a hotkey to that input. Now go and create a button on screendesigner, make that button run the sI thicript you want and assign that buttin the same hotkey you set on the input ports and pins. I think its in the ScanCode box. Now if you dont want that button to show up on your screen use screen designer to drag the button out of the workarea.

I think that might work, havent tried it, please let me know.
Regards
Fernando
Re: The basics of making a switch run a script?
« Reply #5 on: June 29, 2006, 12:41:46 PM »
Sorry about that :(

look in the Mach2 Customization manual

thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #6 on: June 29, 2006, 01:10:59 PM »
The OEM code that you need to put into the OEMTrig box is 301.. This will call the Macro that you set with the Call SetTriggerMacro

IF you upload your XML I will make it work :)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #7 on: June 30, 2006, 07:59:08 AM »
Hi Brian

Thanks for the offer! Here is the file:


G
Re: The basics of making a switch run a script?
« Reply #8 on: June 30, 2006, 08:36:40 AM »
Here you go :)

Copy in this new XML and copy the M450 and M451 Macros in to the macros/Mach3Mill directory.... The M450 is the one that you can put you VB code in, and I have it set to work with  OEMTrig#4
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #9 on: June 30, 2006, 09:20:40 AM »
Thanks Brian!

G