Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Davek0974 on August 01, 2014, 09:06:27 AM

Title: A Get It Out Of The Way button???
Post by: Davek0974 on August 01, 2014, 09:06:27 AM
In the standard Mach3 Plasma setup, is there a keyboard button or shortcut lurking anywhere that can be pressed to rapid the gantry to Ymax position???

My little machine is front loading and the torch parks at 0/0 which is right in the way.

Thought it would be handy to have a F button or something that just shoots the gantry to the furthest position.


Dave
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 01, 2014, 11:58:05 AM
Just thought, I can add a button to my screen but what's the best code to put in it?

It would need to jog to the same max Y point as manually jogging would, preferably using the safe deceleration zone near the limit as well.
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 01, 2014, 05:37:00 PM
G53G0Y***

Where the *** is the position in machine coords you want to move to.

Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 02, 2014, 03:27:51 AM
Many thanks, knew there would be a way :)
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 05:47:51 AM
That works perfectly.

Is there a code snippet I can precede that code with to disable the move if the table has not been homed yet???
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 06:10:16 AM
Yep, put this in the button and it should work.


If GetOemLED(807) and GetOemLED(808) and GetOemLED(809) Then
MsgBox"Axes not referenced, home axes and try again"
Else
Code "G53G0Y0"
End If



That is assuming you have X Y and Z axes, if not then remove the one you dont have, X is 807 Y808 etc.

Hood

Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 06:28:40 AM
Hmm likely my fault, I removed the 809 part as I dont zero Z. and also reworded the msg text but kept the same formatting.

I get an error "Null missing after newline, Block......" message when pressing the button

Any ideas?

Dave
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 06:39:54 AM
paste the code you have.

Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 06:44:14 AM
If GetOemLED(807) and GetOemLED(808) Then
MsgBox"Machine Not Homed, Home Axes And Try Again"
Else
Code "G53 G0 Y600"
End If
 

Thats all, I had to cut/paste into a txt doc then transfer via usb stick, could have typed it but thought it safer to cut/paste :)

I spaced the G-code out as my original code was spaced and that worked fine.
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 06:54:29 AM
Looks fine and works fine here.
If you cant get it working attach your xml and I will test with that.
Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 07:03:05 AM
Files below,

many thanks

Dave
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 07:20:58 AM
Which button do you have the code in?
Hood
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 07:22:33 AM
Ok I see now, Park Gantry button.
You will have to alter it to a VB button in the screen designer. I think you have it as a code button and for that you can only have one line of code, so that is likely your problem.
Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 07:32:59 AM
Hmm, ok thanks.

I can't see how that's done in Machscreen, I must admit that that program is a difficult piece of work, for me at least. :(

I see no VB button feature at all, just "Button".
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 07:37:59 AM
Double click your button and you will see similar to below, just choose the VB option. Once saved then go into Mach again then on Operator menu choose Edit Button Script. Your button will be flashing, click it and the editor will open, paste your code in then File and Save and then exit the editor.

Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 07:48:11 AM
Is that from MachScreen?

I can't double-click anything in my version, clicking just brings up a little box with the image name, button name etc in it.

No double-click option.

I have version 1.60
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 07:53:56 AM
Its Screen4, I dont use MachScreen so dont know how to do it in that.

Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 08:29:07 AM
Excellent, downloaded, edited, working nicely now :)

Many thanks
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 08:55:13 AM
One little thing, is there a way to get the button text on two lines in screen4??

The "Lines" box is greyed out.
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 09:10:01 AM
If you are meaning the actual Text on the button then I dont think so. I always use Image buttons so can not be 100% sure though.
If it can be done in MachScreen then just open your screenset in it and alter.
Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 09:31:42 AM
Ok, then it seems not.

Machscreen seems to have no multiline control either.


Its working anyway so that's what counts.


One last point on this button, is it possible to code it as a "toggle" feature :-

Press once to park the gantry
Press again to return to X & Y zero positions.

Just wondering :)

I'm guessing it would need to toggle an LED on/off and check the state of that LED first????


Dave
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 09:49:15 AM
You could do it with the LED or you could also have it look at the Y position in machine coords and if it is at Y600 then do the move you want.

Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 10:24:29 AM
Ok

I have added another if-then-else loop which checks GetOemDRO(84) for a position >599

that makes sense to me as even if i tell it to go to 600 it seems to stop around 599.99995

BUT

what is the code to actually move the gantry X & Y to the Origin or work zero co-odinates??

I cant see a move command in the books, probably looking for the wrong thing, or is it coded as something else???

Basically the same as GotoZ but only on X & Y.
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 10:45:40 AM
I tried a G28 X0 Y0 but that moved first to my chosen point and then moved swiftly on to machine zero point?

Is there a way to stop it at the work zero or origin point???
Title: Re: A Get It Out Of The Way button???
Post by: Hood on August 11, 2014, 11:53:10 AM
Code "G0X0Y0"

Will send it to the offset zero position.

Might also be worthwhile putting a

While IsMoving()
Wend

After any code that moves an axis, especially if you have further commands after it.



Hood
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 11, 2014, 03:04:02 PM
As simple as that :)

Excellent and many thanks again for the speedy help.

Dave
Title: Re: A Get It Out Of The Way button???
Post by: Davek0974 on August 12, 2014, 03:07:35 AM
Code added, works exactly as i wanted - press once gets the gantry out the way, press again returns to work zero.

A very useful button indeed :)


Thanks for the help.