EasyManua.ls Logo

Tormach 1500MX - Do;While; If;Elseif;Else;Endif; Looping Subroutines Reference; Repeating Subroutines Reference

Tormach 1500MX
288 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
If/endif example:
o100 sub
(notice that the if-endif block uses a different
number)
o110 if [#2 GT 5]
(some code here)
o110 endif
(some more code here)
o100 endsub
if/elseif/else/endif
The if/elseif/else/endif conditional will execute the block of
code following the if keyword when its argument evaluates to
true. If the argument evaluates to false, then the code
following each elseif is executed as long as the associated
elseif argument evaluates to true. If no elseif keywords are
present, or if all elseif arguments evaluate to false, than the
code following the else keyword is executed.
If/elseif/endif example:
o102 if [#2 GT 5] (if parameter #2 is greater than
5 set F100)
F100
o102 elseif [#2 LT 2] (else if parameter #2 is
less than 2 set F200)
F200
o102 else (else if parameter #2 is 2 through 5 set
F150)
F150
o102 endif
Repeating Subroutines Reference
Subroutines can be repeated a finite number of times using
the repeat/endrepeat keyword.
Repeat example:
(Mill 5 diagonal shapes)
G91 (Incremental mode)
o103 repeat [5]
... (insert milling code here)
G00 X1 Y1 (diagonal move to next position)
o103 endrepeat
G90 (Absolute mode)
Looping Subroutines Reference
Subroutines can be looped using the do/while or
while/endwhile keyword constructs.
do/while
The do/while loop executes a block of code once and continues
to execute the code block until the while argument evaluates
to true.
Do/while loop example:
#1 = 0 (assign parameter #1 the value of 0)
o100 do
(debug, parameter 1 = #1)
o110 if [#1 EQ 2]
#1 = 3 (assign the value of 3 to parameter #1)
(msg, #1 has been assigned the value of 3)
o100 continue (skip to start of loop)
o110 endif
(some code here)
#1 = [#1 + 1] (increment the test counter)
o100 while [#1 LT 3]
M02
while/endwhile
The while/endwhile repeats a set of statements an indefinite
number of times, as long as the while argument evaluates to
true.
While/endwhile example:
(draw a sawtooth shape)
G00 X1 Y0 (move to start position)
#1 = 1 (assign parameter #1 the value of 0)
F25 (set a feed rate)
o101 while [#1 LT 10]
G01 X0
G01 Y[#1/10] X1
#1 = [#1+1] (increment the test counter)
o101 endwhile
M02 (end program)
The following statements cause an error message and abort
the interpreter:
l A return or endsub not within a sub definition
l A label on repeat which is defined elsewhere
l A label on while which is defined elsewhere and not
referring to a do
l A label on if defined elsewhere
l A undefined label on else or elseif
l A label on else, elseif or endif not pointing to a matching
if
©Tormach® 2024
Specifications subject to change without notice.
Page 200 UM10811: 1500MX Operator's Manual (Version 0424A)
For the most recent version, see tormach.com/support
9: PROGRAMMING

Table of Contents