Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.

Robot writin on desk

Hello everyone, At first I'm sorry for my English.
I want do program that robot IRB 120 write on table word that person write on flexpendant. How I should this do ? I think I should do one letter-one module and then call individual letter. But I dont know how I should do that one string ex.("Hello") program generate module for every letter.

Comments

  • Hello

    You can have different procs/routines for each letter which you can call with a another proc that reads the input string of the word you want to write

    Here is example:

    MODULE PROG
        PERS string sText;



        PROC main()

            prWriteText "Hi";

        ENDPROC


        PROC prWriteText(string sText)
            VAR string sStringPart;
            VAR num nLenght;

            nLenght:=StrLen(sText);

            FOR i FROM 1 TO nLenght DO



                sStringPart:=StrPart(sText,i,1);

                IF sStringPart="H" OR sStringPart="h" THEN

                    prMotion_for_H;

                ELSEIF sStringPart="I" OR sStringPart="i" THEN

                    prMotion_for_I;

                ENDIF


            ENDFOR

        ENDPROC

        PROC prMotion_for_H()

            !Robot motions for H letter 


        ENDPROC

        PROC prMotion_for_I()

            !Robot motions for I letter 


        ENDPROC
  • Thanks Pavel for response, I'm going try it and then I ask again if I will have doubt. And one more question, How I do that the next letter is moved by a set distance ?
  • Hello St4rk 

    You can add an offset to the FOR loop, so for each loop cycle it will add 100mm offset starting from 0.
    See example:

    MODULE PROG
        PERS string sText;
        PERS num nLetterDistance;
        PERS robtarget pWrite_H_1;


        PROC main()

            prWriteText "Hi";

        ENDPROC


        PROC prWriteText(string sText)
            VAR string sStringPart;
            VAR num nLenght;

            nLenght:=StrLen(sText);

            FOR i FROM 1 TO nLenght DO

                nLetterDistance:=(i-1)*100;


                sStringPart:=StrPart(sText,i,1);

                IF sStringPart="H" OR sStringPart="h" THEN

                    prMotion_for_H;

                ELSEIF sStringPart="I" OR sStringPart="i" THEN

                    prMotion_for_I;

                ENDIF


            ENDFOR

        ENDPROC

        PROC prMotion_for_H()

            !Robot motions for H letter 

            MoveL Offs(pWrite_H_1,nLetterDistance,0,0),v1000,z50,tool0\WObj:=wobj0;

        ENDPROC

        PROC prMotion_for_I()

            !Robot motions for I letter 


        ENDPROC

    ENDMODULE