RobotStudio event

How do I do I treat the name of a data record as an alias

Options
I'm working with Production Manager on a material handling cell.   The individual parts that selected in PM run the same code each time but, they load different offsets and load data for that part.   

I am trying to stream line the new part setup of production manager by moving the data in each of our parts to advanced part data that would be loaded with each different part.  The data for each part would be filled out with a custom screen on the pendant.  

I think have most of this worked out other than one probably simple aspect that I don't know how to do.  That is exact the name of the advantage data currently selected and update it with my screen values.

I can extract the name of the part data that is currently selected by PM with.

My custom record for the advanced datatype that I will pollute form a screen and then write with a trap.

Declaration of my advanced part data type

    RECORD test1
        num nRack_Y_offset_local1;
        num nRack_Z_Rotation_local1;
        num nHolder_LX_offset_local1;
        num nHolder_LY_offset_local1;
        num nHolder_LZ_rotation_local1;
        num nHolder_UX_offset_local1;
        num nHolder_UY_offset_local1;
        num nHolder_UZ_rotation_local1;
        num nOutfeed_X_offset_local1;
        num nOutfeed_Y_offset_local1;
        num nOutfeed_Z_rotation_local1;
        string stPartName_local1;
        num nPartLenght_loca1l;
        num nPartWidth1;
        num nPartThick_local1;
        num nPartMass_local1;
        num nNumPartsOnArm_local1;
    Endrecord

Example PM partdata and advanced part data.

   TASK PERS partdata pd_rTestAdvanced_Stn1:="TestAdvancedPartdata","testpart","",2,0,"","testpart"];
   
TASK PERS test1 testpart:=[1,2,3,4,5,6,7,8,9,0,1,"",0,0,0,0,0];


I can pull the name of the name pf the active partdata with this PM instruction to get the string format of the name.
 
        VAR string stPartDataName;
        VAR partdata pdTmpWrite;

        PMgrGetNextPart station,pdTmpChk\InstanceName:=stPartDataName;

What I don't know how to do is use this string of the active part "stPartDataName" to select the active advanced part data.  Below is what I think it would look like is but, I need to use the name in stPartDataName  replace the pdTmpWrite below.  
     
pdTmpWrite.advPart:=(nRack_Y_offset, nRack_Z_Rotation, .......etc)

effective what I have below but, this obviously doesn't work.

"stPartDataName".advpart:=(nRack_Y_offset, nRack_Z_Rotation, .......etc)

This is probably simple and obvious but, I've looked for several hours for an example of this and not luck.   I know some advanced things in rapid but, the simple things stump me.  Thanks in advance for any input.

Best Answer

  • Tompanhuhu
    Tompanhuhu ✭✭
    Answer ✓
    Options
    The partdata only stores the name of the advpart.
    Not the actual advpart.
    You have to search the system for that variable with a GetDataVal instruction.

    Currently on my phone so I can't provide any more instructions atm. 
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:

Answers

  • RayM
    Options
    I found and tested the GetDataVal and SetDataVal instructions shortly after the Post.  I tried to remove it but, wasn't successful apparently.  Thanks for reading thru my gibberish.  This following is what ended up working.  I don't show the advanced part data delcartion but pdatemp is the format.

        PROC rWriteAdvPartDataStn1()
            var num station:=1;
            VAR string stAPD_Name;
            VAR string stPartDataName;
            VAR partdata pdTmpChk;
            VAR advpartdata pdaTemp;
            
            PMgrGetNextPart station,pdTmpChk\InstanceName:=stPartDataName;

            pdatemp:=[nRack_Y_offset,nRack_Z_Rotation,nHolder_LX_offset,nHolder_LY_offset, nHolder_LZ_rotation,nHolder_UX_offset,nHolder_UY_offset,nHolder_UZ_rotation,nOutfeed_X_offset,nOutfeed_Y_offset,nOutfeed_Z_Rotation,Part_Name,Part_Length,Part_Width,Part_Thickness,nNoOfPartsOnArm];  
            GetDataVal stPartDataName,pdTmpChk;

            stAPD_Name:=pdTmpChk.advPart;        

            SetDataVal stAPD_Name,pdatemp;


    What I've been trying to do with a combination of Production Screen and custom Screens is create an interface to create parts with a custom advanced part data specifically for that part, without RobotStudio.  We struggle with the talent to adding parts with are done every couple days of several of the systems that we have.   It's a Material handling application that runs exactly the same code each time but, offsets the moves and updated the mass and inertia of the EOA with the custom Record referenced by the advanced data.

    I still see 2 hurtles that I don't know how to do. 

    When adding a New part in Production Screen, I can type in an Advanced Data name but, it of course doesn't create the declaration.  This weekend I plan on looking in .xml file for Production Screen to see if I can decipher how the Routine and partdata is automatically created.  If I can see it I was hoping to create a blank Advanced Data with the Entered name the same way.

    The second thing is when the routine is created by production screen/production manager.  I need to populate it with a couple lines of default code.  I haven't found any example of this as well. 

    If I can figure out this stuff, I look back at may of the systems that we have done in the last couple years and I can really dumb it down for people as that won't need to get into Robot studio and do the copy and pasting that we have them do today. 

    If you have any thoughts it's much appreciated.   Either way thanks again for your response earlier. 

    Ray 
  • Tompanhuhu
    Options
    Hi.

    I have parts of the source code for production manager flexpendant app, and there is an embedded module file that is used to generate a module. 
    MODULE {0}
      {2}PROC {1}()
        ! For error handling Use:
        !  RecoveryPosSet and RecoveryPosReset
        !
        !  There is a limitation to the use of RecoveryPosSet. The Pathrecorder can not be turned on
        !  with RecoveryPosSet before a WaitSyncTask instruction, i.e. the robot can never escape past
        !  a WaitSyncTask instruction. Therefore, make sure that RecoveryPosSet is always used after
        !  the WaitSyncTask instruction in the RAPID program.
        !
        <SMT>
      ENDPROC
    ENDMODULE
    I don't think there is a way to modify this output if you want to use gap, the other option is to make a custom system completly. 

    Regarding filling the advpart, you could store all advpart data in files on the robot hdd, when a program is selected and executed you check for the file.
    If it dosen't exist ask the operator to fill all values with UiNumEntry or other dialog instructions, then store all values in the file and use it next time. 
    This way you don't have to use the AdvPart at all, just check for the file with the correct program name, load all parameters and then execute your program. 

    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile: