Page 1 of 1

Lost Arc, Backup Distance

PostPosted: Sun Jul 23, 2017 10:13 am
by Robertspark
Keith raised an interesting point (something at the time he raised it earlier, I did not understand how it could possibly be done [less macro / plugin knowlege])

However, I thought I'd start a thread as a brainstorming session and something may come of it, hence this thread.

Keith asked about reversing / backing up a toolpath a specified distance from a lost arc position I think it was [correct me if I'm wrong].
_____________________________________________________________________________________________________________________
I was wondering...

Given Field # 866 ( Setnextlinefield ) gives the next line number (therefore the current line is technically Setnextlinefield + 1 if you are actually counting line numbers as Field 866 starts at line zero)

Hence Setnextlinefield - 1 would give you the previous line (which is the start point for the current g-code line).

Given we know the current co-ordinates with:
Field# 226 (XDRO) and Field#227 (YDRO)

We could backtrack a given distance to the previous line from our current position {in theory --> see complications #1 & #2}

We would also need to know what the current Group 01 modal command is (presumed to be G1, G2 or G3 only as this is a plasma only application)

This could be done by parsing field#877 (active modal) which will provide the currant group 01 modal command {---> see complications #3}

G1 backup will no doubt be the easiest.... (straight line to previous co-ordinates)

G2 & G3 will require knowing the present co-ordinates, the commanded I & J + correcting for the current co-ordinates offset from the previous co-ordinates start point (previous line X&Y), and then flipping the direction of motion from say G2 to G3 to visa versa for the backup...... and if the backup distance is insufficent.... carry over to the next line up.

.................................................

Given the complications over working out the backup distance in relation to the current co-ordinates, previous g-code line desitination and insufficent backup distance, it may be easier just to backup a few lines (of unknown distance) and insert a code snippet which inserts those previous lines, and an M10 at the correct Lost Arc position, and then insert a run from here which co-encides with the line where the lost arc occured.... (note once and M3 / M10 is given the torch will fire, but it will take a [unknown] while before the ArcOK signal is recieved and the arc stabalises, and the cut is correctly resumed).
______________________________________
Complications:
1) this is hoping that the previous line is a X Y co-ordinate.... not a Z co-ordinate or an M3 or M11 or some other Mcode.....
2) this presumes that the backup distance is less than the distance from the present co-ordinates to the previous G-code line end co-ordinates (otherwise we need to back up another line)
3) as item 1 above (current line and an X Y destination co-ordinate) + add to that although we know the current X & Y co-ordinates and hoping that the current Group#1 modal command is G1, G02 or G03 and not some M-code (which means we would need to backup a line).

Bit of code here to show the use of streamreader with the currently loaded gcode file, and also splitting a string (Field#877 [active modal]), and the use of carriage return in a message box (or two line space)

Code: Select all
MessageBox.Show( "Previous File Line Read " + fnStreamToLine( AS3.Getfield(866), exec.Getgcodefilename() )  + "\r\r" +
                "Current Co-Ordinates " + "X " + AS3.Getfield(226) + " Y" + AS3.Getfield(227) + "\r" +
                "Current Active Modal Groups " + AS3.Getfield(877)   + "\r" +
                "Current Group 01 Mode Active " + fnModalGp(1)
            );

#Events

private string fnStreamToLine(string strLineNumber , string GcodeFilename)
{
   int intLineNumber = Convert.ToInt32(strLineNumber);
    System.IO.StreamReader reader = new System.IO.StreamReader(@GcodeFilename);

    for (int i = 0; i < intLineNumber - 1; i++)
    {
        reader.ReadLine();
    }

    string line = reader.ReadLine();
    reader.Close();

    return line;
}

private string fnModalGp(int intGroup)
{
      string s = AS3.Getfield(877);
        // Split string on "|".
        string[] modalgroups = s.Split('|');
   
   return modalgroups[intGroup-1];
}

Re: Lost Arc, Backup Distance

PostPosted: Sun Jul 23, 2017 7:37 pm
by beefy
Hi Rob,

just fell out of bed and will be going to work soon so not much time to study everything you've written, but I'll explain why I think this would be a great feature.

Imagine these blocks of gcode during a plasma cut:

X0
X2400

i.e. a single straight line 2.4m long (BUT this could be a huge arc, or diagonal line, etc)

Oh no, I get a flameout at X2300. To do a dry run with RUN FROM HERE the torch has to go all the way back to X0 and travel 2300mm before reaching the flameout point. If the plate is not perfectly flat over that distance or has warped from the cutting, the torch could easily drag on the plate over that distance.

Also doing a dry run of 2300mm is not great when it would be much more preferable to start the dry run say 100mm before the flameout point. We could touch off at the flameout point (if necessary) then reverse say 100mm along the already cut path, turn off THC, press cycle start, and just before the flameout point press M3 (M10 would have to be programmed in the gcode), then finally turn THC back on.

Therefore if the run buffer could keep a small distance of the already cut path, and in a macro we could program a "reverse move" for a specified distance from the current position, that would be a great feature for mid cut restarts with plasma.

An even greater feature to also add would be a macro function to refire the torch a few mm ALONG THE CUT PATH before the flameout point (saved XY co-ordinates along the path). Moreso if this could be the synchronous laser output it would ensure "pauseless" motion at the point of torch fire during the dry run approach.

Recovering from a flameout is quite a common occurrence in plasma cutting.

Keith.