Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: JMF on January 13, 2014, 08:56:08 PM
-
Hi,
I wanted to modify the Ref All button to Home my X,Y and Z, then move to my actual table 0,0 (X,Y) then set the X and Y DRO's to Zero,
I came up with this code and it seems to do exactly what I want, but I just wanted to make sure it is the correct way of doing it.
Thanks,
John
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
While (IsMoving())
Sleep(100)
Wend
DoOEMButton(1008) 'Work X Zero
DoOEMButton(1009) 'Work Y Zero
DoOEMButton(1010) 'Work Z Zero
DoOEMButton(1011) 'Work A Zero
While (IsMoving())
Sleep(100)
Wend
Code("F100")
Code("G00 X0.1543 Y.2534")
While (IsMoving())
Sleep(100)
Wend
DoOEMButton(1008) 'Work X Zero
DoOEMButton(1009) 'Work Y Zero
DoOEMButton(1010) 'Work Z Zero
DoOEMButton(1011) 'Work A Zero
While (IsMoving())
Sleep(100)
Wend
DoOEMButton(160) 'Regen Display
-
You don't need the sleep(100) 's that you have.
And there's an easier way to do what you're trying to do.
Set Home Offsets for X and Y.
Set X to -.1543 and set Y to -.2534
Then, if your X and Y offsets are always set to zero, then all you would need is this:
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
While IsMoving()
Wend
Code "G53 G0 X0 Y0"
While IsMoving()
Wend
This is how my machine is setup, as I never change my X0 Y0 positions.
-
I do mine the same as you Gerry but I learned the hard way to do it like this. I did set the home off distance to a negative value. This value was the distance I wanted to be away from the switch when at machine 0. This was on an OEMs machine. The reason I needed this was the hardware it was using stopped immediately after coming off the switch. It was a very tight machine but if I didn't do one axis and move away when the other started to home it would throw the limit for the other that was at this point just insanely close to making the limit/home switch (the one that just finished homing). Another note (if your using soft limits) is that you will likely need to adjust your soft limit Mins. to what ever you set your - values and decrease the soft limit max by the same amount.
DoButton( 24 )
DoButton( 23 )
While IsMoving()
Wend
Code "G53 G0 Y0"
While IsMoving()
Wend
DoButton( 22 )
While IsMoving()
Wend
Code "G53 G0 X0"
While IsMoving()
Wend
DoButton( 25 )
Brett
-
Thank you guys very much, I just started learning this stuff earlier today and just wasn't sure,
I appreciate the code, I will change it tomorrow, thanks again guys !!
-
Ger21, tried your code today and it works like a charm, thanks again.