RobotStudio event

move my robot whit a .nc file

hi i need to use my robot whit a .nc file to paint a piece of iron.
i can open my .nc file but i dont know of to get the x and the y coordinates
tyCry

Comments

  • Jetman
    Jetman ✭✭
    Hello Korum,
     

    Basically what you need is to search for the strings you want in the file.

    It's more a computer programming job than a robot programming job.

     

    Here is an example of how it can be done with a CNC file named Dragon.nc webwiz/530/Dragon.zip

     

    MODULE MainModule
     PERS tooldata Crayon:=[TRUE,[[146.384,1.05238,33.398],[0.0155533,0.708021,0.00727686,0.705982]],[1.6,[12.5,0,-50.5],[1,0,0,0],0,0,0.118]];

     

     CONST robtarget Origine_Dragon:=[[235,380,-0.7],[0.000532811,0.999984,0.00545403,-0.000924032],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

     VAR iodev VariableIodev;
     VAR string StringLue := "";
     VAR bool ConversionOK := FALSE;
     VAR num X := 0;
     VAR num Y := 0;
     PROC main()

       Open "HOME"File:="Dragon.nc", VariableIodevRead;
      ! Open "/bd0/" File:="Dragon.nc", VariableIodev Read; !IF ON ROBOT'S USB FILE
      ! Open "C:" File:="Dragon.nc", VariableIodevRead;  !IF ON DISC C: OF VC

      !Search and discard until F200. Found
      WHILE StringLue <> "F200." DO
              StringLue := ReadStr(VariableIodevdelim:=" 9"RemoveCRDiscardHeaders);
      ENDWHILE
      
      !Search and process until G0 found
      WHILE StringLue <> "G0" DO


           !Lookup for first X thus eliminating Nxxx
           StringLue := ReadStr(VariableIodevdelim:="X"RemoveCRDiscardHeaders);
       
           !Lookup for Y, getting the numbers between X and Y

            StringLue := ReadStr(VariableIodevdelim:="Y"RemoveCRDiscardHeaders);
           ConversionOk:=StrToVal(StringLue,X);

     

           !Lookup for LineFeed, getting the numbers between Y and the EOL.       
           StringLue := ReadStr(VariableIodevRemoveCR);
           ConversionOk:=StrToVal(StringLue,Y);

     

           !Make it's move with the X and Y Offset + a 25.4 Scalling
            MoveJ Offs(Origine_Dragon,25.4*X,25.4*Y,0), v50, Z1, Crayon;  

      ENDWHILE


      Close VariableIodev;

     ENDPROC
    ENDMODULE

     

    Hope it helps,

     

    Jet
    Jetman2009-05-12 19:49:15
    Jet,
    Janin Delorme, Ing. (P.Eng)
  • Klaus
    Klaus ✭✭
    Fine Exambel Jetman but remember G02 G03 G12 and G13. (Full and Half circles)
    The exambel only handels lineary movement not Circles

     

    Another tink i saw is that the movement is A'made during the read of file.

    I have tried with a program i made with reading from file during movement and is courses stop like fine points. I changed the program to read all target beforre movement.

    In painting it will be bad with fien points

     

    BR Klaus

     

     

     

     
    Best Regards

    Klaus Soenderhegn
    www.cadalysator.dk
  • Jetman
    Jetman ✭✭
    Hello Klaus,
     

    The thing is I know nothing about CNC codes! Big smile

    I just opened a CNC file and saw the X and Y coordinates and started from there.

     

    My program was reading the file during movment it was not stopping though, it went real smooth. Were you going at speed higher than V50 or doing large movments?. I was using V50 and Z0.

     

    Jet
    Jet,
    Janin Delorme, Ing. (P.Eng)