Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: 7ofclubs on June 09, 2011, 10:12:48 PM
-
Several years ago I decided to try Mach3 but couldn't get it to run. Decided to download and try again and so far it looks promising. I am very used to TurboCNC.
In TurboCNC there is a command ASK#1, the program will stop running and ask you for a value that will be put into the variable #1. Is there a way to input a variable during runtime with Mach3?
-=7ofclubs=-
-
You can use MDI and type #1=5, but you'd need to pause or stop first I think.
But that's probably not what you want.
-
You can use MDI and type #1=5, but you'd need to pause or stop first I think.
But that's probably not what you want.
No that doesn't work. Another question for you though, is there a way to test the value of a parameter?
Here is an example that doesn't seem to work in Mach3
If #1 < 0 then P1000
Is there a syntax for this I am missing?
-
Yes to the ASK#1 question and NO to the conditional Gcode question.
Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)
But for your simple conditional statement yes it could be done as long as it only contains a max of 2 conditions and 1 jump statement.
(;-) TP
-
Yes to the ASK#1 question and NO to the conditional Gcode question.
Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)
But for your simple conditional statement yes it could be done as long as it only contains a max of 2 conditions and 1 jump statement.
(;-) TP
Sweet! Would you happen to have any code examples?
-
For the Ask#1` replacement you would use a macro call Lets say it was M901. Macros allow up to 3 parameters to be called with the macro call
M901 P# Q# R # The # would be numbers
You would create theM901 macro like this:
SetVar(Param2(),Param3())
While ISMoving()
Sleep(10)
Wend
This would set the Gcode #var (Q parameter) to the R parameter
Easy enough
Next to use a conditional statement you would use a macro say M902
The macro would look like this:
SetVar(2,Param3())
If Getvar(Param1()) = Param2() Then
Sleep(10)
Code"M98 P#2"
While Ismoving()
sleep(10)
Wend
end if
The macro sets up the conditional statement and the parametrs PQR call the comparing values and the JUMP to number
THE GCODE program it is called from looks like this
G0 X0 Y0
M901 Q1 R100 <------------------- This will set #1=100
G1 X5 F100
M902 P1 Q100 R2 <------------------- This will allow the program to skip down to the o2 line and proceed
M1
G0X100
(endof test)
o2
(done Deal)
G1 X0Y0
m30
NOT a very easy way to have to do it But that is the best I can do SEEING how Mach cannot do conditional Gcode.
I have a set of macros set up for all the normal conditional calls that I normally would use.
NOT very conventional BUT it does work in a pinch.
Hope that helps (:-) TP
****** The above statement "Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)" Should have been"Sorry but MACH does NOT do conditional Gcode unlike most modern controllers (;-)"