Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Davek0974 on April 02, 2014, 05:07:56 AM

Title: Button Reprogramming...
Post by: Davek0974 on April 02, 2014, 05:07:56 AM
I have a "Origin" button on my plasma screen, it sets all the work DRO's to zero from my pendant.

Is there a way to have this button also press the "Regen Toolpath" button after it does its reset??

This would stop getting soft limit errors when using the pendant to start a job.
Title: Re: Button Reprogramming...
Post by: mbele on April 02, 2014, 05:57:42 AM
- edit button script from mach via menu, or modify screenset with machscreen app
- regen toolpath with:
DoOEMButton(160)
at the end of the button script (160 is OEM button code of regen toolpath button)
- if you need to wait for machine to stop moving, put this before regen toolpath:
while isMoving()
sleep(100)
wend

I haven't tested it, but that should be the concept. There is lot of useful info in
http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf (http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf)
if you're interested.


Title: Re: Button Reprogramming...
Post by: Davek0974 on April 02, 2014, 06:04:15 AM
Brilliant i will give it a go later on.


Thanks

Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 03:59:42 AM
Hmm, if I try to edit button script, the only buttons that flash are "ref all home" and "display mode", I can't edit the "Origin" button, Is there another easy way in??
Title: Re: Button Reprogramming...
Post by: mbele on April 03, 2014, 04:47:17 AM
Probably there's no script attached to that button, and the button just executes one preprogramed function.
Check
http://www.kd-dietz.com/klausphp/pages/eng/machscreen/description/ms_description.html
Make backup of your mach instalation, and open screenset file with machscreen. When you select "origin" button, properties edit window will be populated with button properties. Note which function code it executes, then edit the script and execute same function via script, then add your custom code after that. Again that's the concept, but if your pendant is executing mach function, rather then emulating button press, it will not work. In that case, you'll have to find out how mach interprets pendant signals, and change the behavior(mach response) there - sorry, I know nothing about pendants.
Good luck
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 05:17:35 AM
Well I've downloaded and got machscreen running but its way over my head i think.

All i could gather was the the Origin button has a short-cut of Ctrl-O, calls function 1007 and that's about it.

Is there a way I can add this simple command ?
Title: Re: Button Reprogramming...
Post by: Hood on April 03, 2014, 07:20:16 AM
1007 is the OEM code for "ZeroAll", if you open the screenset in the screen designer then you can double click the button and change it to a VB button. When you then open in Mach it will be a VB button and you can add the code you wish.
Hood
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 08:05:33 AM
Any idea how i do that. I'm not seeing any "convert to VB" features mentioned????
Title: Re: Button Reprogramming...
Post by: mbele on April 03, 2014, 08:16:29 AM
:)
...or click exec code in property editor (in second column), click basic script, and put your code there:
DoOEMButton(1007)
DoOEMButton(160)
Title: Re: Button Reprogramming...
Post by: Hood on April 03, 2014, 08:33:55 AM
I dont use MachScreen so not sure how you do it there, in Screen4 the option is there.
As mbele has pointed out you could use the Code function to do it as long as it allows multiple line code.
Hood
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 08:55:40 AM
Hmm, getting in a mess now (got backup copy though)

I have added the codes dooembutton(1007) zero all
and dooembutton(160) regen toolppath

but now it zeros the dro's then regens the path but then sends the dro's back to somewhere else leaving them non-zero?
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 09:16:22 AM
It puts the DRO values back to exactly where they were before pressing the button.

i.e. its not storing them.
Title: Re: Button Reprogramming...
Post by: Hood on April 03, 2014, 09:18:03 AM
You really want a pause between calls
Sleep 500
would give you 1/2 second delay between calls.


Hood
Title: Re: Button Reprogramming...
Post by: Hood on April 03, 2014, 09:27:04 AM
BTW are you doing it via code in the screen designer?
If so are you able to do multiple lines? If not then likely that is your issue, doing it in a VB button would be best.
Hood
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 09:31:30 AM
I will add the sleep command

Once I added the script in machscreen, it saved a custom macro, I can now edit that macro with notepad :)

Machscreen is a very "odd" program ;)
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 09:39:26 AM
That fixed it, it seems that although it creates a macro file it does not use it but instead embeds the code?

Anyway its working nicely now

Thanks all
Title: Re: Button Reprogramming...
Post by: mbele on April 03, 2014, 09:47:28 AM
You're right, I've tested it, and it seems that it behaves weird. Anyhow, here's the script that works for me:
SetOEMDRO(800,0)
SetOEMDRO(801,0)
SetOEMDRO(802,0)
It will automaticaly regenerate toolpath.
I think that when DROs are defined as "standard" (codes 0,1,2) path will not be regenerated by default.
(jog follow must be turned on, i think)
Title: Re: Button Reprogramming...
Post by: Davek0974 on April 03, 2014, 10:01:50 AM
That's good, at least two ways of doing it then :)