Just an FYI for the archives.
I just finished writing an M Code macro and was reminded of lessons learned using another CNC software program.
I could step through my macro using VB editor no problem. Could run the macro in VB editor not quite as well, and using the compiled M Code in G Code went all to hell.
Embedding M Code inside M Code has one effect. Writing longhand logic of the same process inside an M Code has another.
When Mach lookahead is set above a threshold, sometimes the program just blows by logic statements or the programatic sequence plays out funny. Not ha-ha funny though.
I wanted to call a tool (Txx) and have the offsets update (Hxx, Dxx) and then getoemdro to use the values in a G01 statement. To update the DROs I first used M6 but that left a flashing ToolChg led on the screen. I replaced the sequence
M06 T20
G43 H20 D20
with
T20
tool = GetSelectedTool()
SetCurrentTool( tool )
G43 H20 D20
to avoid the flashing led.
The tool call had no effect when positioned on the fourth or fifth line similar to the placement one might expect in a Gcode file. Moving the first three lines of the logic snipet to the top of the file did work since I'm assuming was the first logic read.


LinkBack URL
About LinkBacks




