RobotStudio event

variable use to move X

So.... Just got back into robots after a couple of years away. I am a machinist by trade with 31 years in the biz... I also have done Parametric programming for 20+ years.... 

I have a family of parts that start at 10ft long and goes to 44ft long in increments of 0.125. I want to set the program up to where the operator enters the size of the part with a variable/parameter from the main screen. The math would be done with tvariables going into the x position BOLD spots: 


 PROC ColumnTop_Med()
        !!1 1/16" Holes!!
        !------------------------------------------------------------------------------------------------
        VAR robtarget pRightEnd:=[[3444.92,13.06,-8.79],[0.486852,-0.512594,0.514645,0.485143],[-1,-1,0,1],[3855.18,9E+09,9E+09,9E+09,9E+09,9E+09]];
        VAR robtarget pColumnCTR:=[[10104.12,-1606.93,856.53],[0.488507,0.509356,0.507896,-0.493922],[0,0,-1,1],[9263.22,9E+09,9E+09,9E+09,9E+09,9E+09]];
        !------------------------------------------------------------------------------------------------
        !!Cut Off!!
        !! Right End - Center Sheet 


my line of thought would be the variable going like this:


 PROC ColumnTop_Med()
        !!1 1/16" Holes!!
        !------------------------------------------------------------------------------------------------
        VAR robtarget pRightEnd:=[[XPOS1,13.06,-8.79],[0.486852,-0.512594,0.514645,0.485143],[-1,-1,0,1],[XPOS2,9E+09,9E+09,9E+09,9E+09,9E+09]];
        VAR robtarget pColumnCTR:=[[XPOS3,-1606.93,856.53],[0.488507,0.509356,0.507896,-0.493922],[0,0,-1,1],[XPOS4,9E+09,9E+09,9E+09,9E+09,9E+09]];
        !------------------------------------------------------------------------------------------------
        !!Cut Off!!
        !! Right End - Center Sheet

I have been looking through the books and have not found it so I came here, is this possible? TIA

Comments

  • PROC ColumnTop_Med()

    PERS num XPOS1:= 100;

    PERS robtarget pRightEnd := [[0,0,0], [0,0,0],[0,0,0,0], [9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

    pRightEnd.trans.x:=XPOS1;

    ENDPROC

    You can use something like TPReadNum to read the current x position and enter a new one

  • I will give it a try... thank you....
  • Okay that worked awesome so here is my next question: trans.x is how you change the offset but what is the variable name for current position of X? 
  • Whatever you choose to make it.
      VAR num nMyX_Trans;
      VAR pos posMyCurrentPos;
       posMyCurrentPos:=CPos(\Tool:=MyTool \Wobj:=MyWobj);
      nMyX_Trans:=posMyCurrentPos.x;
    Lee Justice
  • Sweet!!! thank you!!! one more question? What if I want the Y position?
  • VAR num nMyY_Trans; 

    nMyY_Trans:=posMyCurrentPos.y;

  • I didnt think it was that easy.... lol... Thank you!!!