Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: softselect on November 01, 2008, 04:17:07 PM
-
Hi Everyone,
I am trying to write a macro that will move to a home or tool change position for milling
it looks like this
Feed=GetDRO(18)
ofset=GetDRO(0) - This must read which coordinate is active G54, g55, g56 etc.
code "g54" - This must set G54 (Machine coordinates
Code "g00 Z0" - This must move Z home (or tool change position)
code "g00 x0 y0" - This must home X and Y
SetDRO(18,Feed) - this must restore feedrate
setDRO(0,ofset) - This must restore coordinate that was used before homing (this line seems to be the problem)
sadly this macro doesn't work
can anyone please help
-
There are a lot better at VB and G Code than me but give this a go and see if it does what you want. I am not sure if you actually need to set your feedrate DRO as you have because they shouldnt really change anyway.
Hood
Feed=GetDRO(18)
ofset=GetDRO(0) 'This must Read which coordinate is active G54, g55, g56 etc.
Code ("G53 G0 Z0") 'This must move Z home (Or tool change position)
While IsMoving
Sleep (10)
Wend
code ("g53 G0 x0 y0") ' This must home X And Y
While IsMoving
Sleep (10)
Wend
Call SetDRO(18,Feed) 'this must restore feedrate
Call setDRO(0,ofset) 'This must restore coordinate that was used before homing (this Line seems To be the problem)
-
Just been messing with it, maybe this would be better but again I dont really know what I am doing so test with caution.
Hood
Feed=GetDRO(18)
ofset=GetDRO(46) 'This must Read which coordinate is active G54, g55, g56 etc.
Code ("G53 G0 Z0") 'Moves Z to Machine CoOrds Zero
While IsMoving
Sleep (10)
Wend
code ("g53 G0 x0 y0") ' Moves X and Y to Machine CoOrds Zero
While IsMoving
sleep (10)
Wend
Call SetDRO(18,Feed) 'Sets feedrate DRO (Not sure this is really needed)
Code ("ofset") 'Sets back to previous offset
End
-
but again I dont really know what I am doing so test with caution.
Welcome to my world - :D
Dave
-
Thanks Hood, thats done the trick ;D