In this thread I finally managed to get a drill to do a radial hole on a lathe.
Now I'm looking for a way to automatically do this a number of times, so I'm looking into subroutine/macro programming.
Again, I look to the Haasmanual for answers and there's a section on the WHILE DO END Iteration/Looping.
(for information purposes, I'm using a Haas OL-1 Lathe with the Live-Tooling and C axis option)
There is less than one quarter of a page's worth of information on it, however. It basically has this:
////////
"Macros allow flexibility with the WHILE-DO-END construct. For example:
WHILE [<conditional expression>]DOn;
<statements>;
ENDn;
This executes the statements between DOn and ENDn as long as the conditional expression evaluates to True. The brackets in the expression are necessary. If the expression evaluates to False, then the block after ENDn is executed next. WHILE can be abbreviated to WH. The DOn-ENDn portion of the statement is a matched pair. The value of n is 1-3. This means that there can be no more than three nested loops per subroutine. A nest is a loop within a loop.
Although nesting of WHILE statements can only be up to three levels, there really is no limit since each subroutine can have up to three levels of nesting. If there is a need to nest to a level greater than 3, then the segment containing the three lowest levels of nesting can be made into a subroutine therefore overcoming the limitation.
////////
As explained in the other thread, the goal here is to drill some holes into the outer diameter of a workpiece, but the book says that there is no canned cycle that does this, so I'm attempting to make one using Macros.
The variables that I'm changing are only the Degrees the C-axis has to rotate to.
This code, for example, would try to put a hole into 0, 90, 180, and 270 degrees in the OD and would look something like this:
;
T101; (pick tool 1)
M14; (clamp spindle brake)
M154; (c axis engage)
G98 (feed/minute)
G00 X1.0 (rapid T101 to x1.0)
#101=0; (variable for c axis degree)
WH [#101LT360] DO1;
G01 C#101 F500; (rotate spindle #101 degrees at 500RPM)
G01 X0.75 F2.; (drill into OD down to 0.75")
G00 X1.0; (retract)
#101=#101+90
END1; (end of loop)
G01 C0. F500.; (return C axis to zero)
M15; (unclamp spindle brake)
M155; (c axis disengage)
;
I cannot seem to enter the WH into the control when in MDI mode, however. As soon as I hit the enter/insert key after the WH (or) WHILE, or after the #101=0, I get a "Bad code" error.
I have not tried putting the program in a file and loading it that way (in case it's just MDI that doesn't allow for parameter passing).
I know I bug you guys with a lot of questions, but I'm willing to try stuff and learn and wouldn't wanna break anything... so I'm careful and check usually here or with software before running....