I have built a cnc lathe, with gang tooling, which runs ok with turbocnc.
But, what I have found is that "there is no cheap software for generating gcode for a lathe" in high level language.
There is "ACE converter", and it is a great utility, but I want to do more with less effort (in "daily" basis - hobby machine).
So I learned about "machine by features" (great concept), and I'm trying to make something like it. But I have to learn Gcode and have a template.
First of all, I'm using the XY plane for a lathe. I know, its wrong, but I have to use it for now, because the drawing software (2d cad).
This template will be used as a starting point for a gcode generator. So I made a g-code script that has some subroutines (M98/M99 - "gosub/return").
How it works:
The first thing was to define many variables like "part size - length", "raw material diameter", "Tooling offsets and types", "facing options", "parting options", and others.
Next step is zero (g92) in machine coordinates (g53). The X axis (Z in lathe coordinates) is user defined when the script is first run (g92 X0). And the Y axis (X in lathe coordinates) is zeroed by g28 (sensor).
When tools are sharpened, I use a subroutine to Check Tools Positions (N300) and align it, otherwise this line is kept commented (; ).
After that it procceds to Position Raw Material (N500). This consists in placing the Left Cutting Tool at Part Length (#1120) + facing options (#1520) and pausing (M00).
Then the part is faced #1522 times, removing #1521 mm in each pass.
Only now the part is made (N3000).
And after that starts the parting sequence (N900), with parting options (#1530/#1531).
What doesn't work:
Following this method, I made a subroutine to cut threads.
As I'm using the XY plane the only way to thread is using G33 (one pass thread). To make many passes, must use a repeat until or while arrangement (IF/M97).
It is done in N2000 to N2090.
THE PROBLEM: It threads ok, when it gets to the M99 (N2090), it gives an error that says:
"Searching for return line N3040...
Runtime error 207 at 001A:0D57.
And dumps to DOS, exiting turbocnc badly.
I looked at yahoo group "turbocnc" but the reported "error 207" doesnt seem to apply to my problem.
Can anybody help? Or have a template that works?
Ps: there is two files attached, one that "works.txt", and doesnt have the threading routine.
And the other that doesnt work ("notwork.txt"), and I want to fix it.