Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started 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
-
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.
-
G53G0Y***
Where the *** is the position in machine coords you want to move to.
Hood
-
Many thanks, knew there would be a way :)
-
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???
-
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
-
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
-
paste the code you have.
Hood
-
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.
-
Looks fine and works fine here.
If you cant get it working attach your xml and I will test with that.
Hood
-
Files below,
many thanks
Dave
-
Which button do you have the code in?
Hood
-
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
-
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".
-
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
-
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
-
Its Screen4, I dont use MachScreen so dont know how to do it in that.
Hood
-
Excellent, downloaded, edited, working nicely now :)
Many thanks
-
One little thing, is there a way to get the button text on two lines in screen4??
The "Lines" box is greyed out.
-
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
-
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
-
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
-
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.
-
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???
-
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
-
As simple as that :)
Excellent and many thanks again for the speedy help.
Dave
-
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.