AngyalRobert

gCode converter

Dec 29th, 2019
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure TForm2.BitBtn2Click(Sender: TObject);
  2. var I: Integer; Line: string; Found: Integer;
  3. begin
  4.   I:= 0;
  5.   Found:= 0;
  6.   while I< AdvMemo1.Lines.Count do begin
  7.     if Found= 0 then
  8.       if Pos( 'G1 E-', AdvMemo1.Lines[I])= 1 then
  9.         if Pos( '; process Color', AdvMemo1.Lines[I+1])= 1 then
  10.           if Pos( 'G1 E', AdvMemo1.Lines[I+ 6])= 1 then begin
  11.             Found:= 1;
  12.             Line:= AdvMemo1.Lines[I+ 6];
  13.           end;
  14.     I:= I+ 1;
  15.   end;
  16.   I:= 0;
  17.   while I< AdvMemo1.Lines.Count do begin
  18.     if Found= 1 then
  19.       if Pos( 'G1 E-', AdvMemo1.Lines[I])= 1 then
  20.         if Pos( '; process Color', AdvMemo1.Lines[I+1])= 1 then
  21.           if Pos( 'G1 X', AdvMemo1.Lines[I+ 6])= 1 then begin
  22.             Found:= 2;
  23.             AdvMemo1.Lines.Insert( I+ 6, Line);
  24.             Line:= AdvMemo1.Lines[I+ 6];
  25.             AdvMemo1.ActiveLine:= I+ 6;
  26.           end;
  27.     I:= I+ 1;
  28.   end;
  29.   if Found= 2 then BitBtn2.Enabled:= False;
  30.  
  31. end;
RAW Paste Data