Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: David Thomas on April 20, 2013, 07:53:31 PM
-
I have created this macro... I want Z to move then X to move. When I write Z2 X3 Both X and Z move at the same time. If I write Z2 and X3 within the macro X moves then Stop then Z moves.
What am I doing wrong?
G Code is M178 Z3 X2
Message"Moving to Plunge Cut Position..."
Code "G0 Z #"
While IsMoving()
Sleep(250)
Wend
Code "G0 X #"
While IsMoving()
Sleep(250)
Wend
Message "Arrived at Plunge cut Position"
-
It is doing exactly what you told it to do
Z3 X2 is an interpolated move it moves both at the same time and they BOTH arrive at the destination at the same time.
Z3
X2
This would be to move Z3 first then X2
Your macro will move nowhere as it does not have a valid motion code
Code"G0Z#" is not a valid motion code you would have to use the variable with it and the variable would need to be assigned a value
Code" #1 =3" assigns #1 to a value of 3
Code"G0Z#1" Is a valid motion Code
(;-) TP
-
Thanks BR for the reply, I see that I have mis wrote my question,
I my part program I need to write G0 x(value) and G0 z(value) on two separate lines many many times. I would like to have 1 macro number say M9999 with x(variable) and z(variable) and move linear.
Example
N10 M9999 X5 Z10 = X moves to 5 then Z moves to 10
N20 M9999 X15 Z2 = X moves to 15 then Z moves to 2
N30 M9999 X11 Z22 = X moves to 11 then Z moves to 22
M30
Thanks again for your help
Dave
-
You need to pass the X and Z values as parameters to your macro.
Your M178 Z3 X2 does not do this - it calls M178 with no parameters and executes Z3 X2 with whatever modal movement command (if any) is currently active.
See section 4.4.5 in the Customizing Mach2 document.
Ian