Discussion

Left ArrowBack to discussions page
ZachZach Posts: 3 Apprentice
I have been assigned a task where we will want to have a pop up where an operator can assign a variable.  Essentially we would want the operator to enter a variable into a popup and that would call for a specific sub program.  Just trying to make one program that can accomplish multiple tasks.

Thanks in advance!!!

Comments

  • ZachZach Posts: 3 Apprentice
    Edit:  I know how to create a user set variable, but I am wanting to do something a little more advanced.  I want to the user to type A2 and have the robot complete the A program and then the 2 portion of the program. 
  • matthewd92matthewd92 Posts: 901Founding Pro, Tactile Sensor Beta Testers Handy
    So are you asking how to split the string "A2" for example into and A and a 2?
  • ZachZach Posts: 3 Apprentice
    Yes exactly.
  • matthewd92matthewd92 Posts: 901Founding Pro, Tactile Sensor Beta Testers Handy
    There are currently no tools available on the robot that do string manipulation, and I do not believe you can access individual characters in the string using array methods either because the string is not stored as a list of any sorts, last I checked.  I just tried in version 3.6 and its not there, may be coming in future releases as there have been a lot of requests to UR to add some string manipulation tools
  • GrantG_1GrantG_1 Posts: 2 Recruit
    Matthwe92, but how do you write to a simple variable from a pop-up
  • GrantG_1GrantG_1 Posts: 2 Recruit
    Answering my own question.  I did a message popup with instructions to enter the integer on the next pop-up.  The next line of code was operator assignment of a variable which automatically pops up number field entry screen.  All is well.
  • Kaleb_RodesKaleb_Rodes Posts: 60Founding Pro, Partner, Beta Tester VIsion 1.1 Program, Tactile Sensor Beta Testers, Beta Tester Camera URCap 1.2.0-beta Handy
    @GrantG_1 you could use the script code function: str_at(src, index) which provides direct access to the bytes of a string. Where src: source string, and index: integer specifying the position inside the source string.

    Example:
    str_at("A2", 0)
    - returns "A"
    str_at("A2", 1)
    - returns "2"
    Kaleb Rodes
    Applications Engineer
    Behco
  • samshasamsha Posts: 1 Recruit
    I want to separate the contents of string 
    Example: (132.78, 45.7, 78.9)
    How can I do this ?
  • David_GouffeDavid_Gouffe Posts: 38Vacuum Beta tester Apprentice
    Hi, 

    The short answer is that you compare each character with the search character and you store the position of it. 
    For example:
    "(" will be found only at the beginning. 
    ")" will be found only at the end.
    "," will be found at each end of a parameter. 

    Then you need to build up each parameters. 

    This is a short answer but this is long to do programming each possibility with what "Kaleb" proposed : "str_at("A2", 0) " . 

    Maybe it would be easier to use I/O inputs or to have a PC with a simple interface to send socket messages. 

    The other way is the easiest and was proposed by "GrantG_1 "
    Make a sequence of popup to ask and retrieve answers. 
    "I did a message popup with instructions to enter the integer on the next pop-up.  The next line of code was operator assignment of a variable which automatically pops up number field entry screen. "

    String management can be time consuming, I suggest trying a work around that match production needs to "Start Production Faster". 

    Hope this helps. 

    Regards,

    David Gouffé
    Integration Coach
    Coach en intégration

    Robotiq is now into packaging, palletizing and sanding applications. Learn more about our new Vacuum Grippers and the Robotiq Sanding Kit.

    1-888-ROBOTIQ #275 (762-6847)
    1-418-380-2788 #275 (Outside US and Canada)
    1-418-655-9221 (Cell)

    Follow us on

    facbook-iconepng linkedin-iconepng twitter-iconepng google-iconepng Youtube-iconepng

    Visit us:  
  • matthewd92matthewd92 Posts: 901Founding Pro, Tactile Sensor Beta Testers Handy
    @samsha are you sending that string in from another device like a PC or camera?  If so, simply change the () to [] and the robot will receive a list and then you can simply use the index position of each of the three elements (0,1,2). We do this from cameras and other devices to make getting to the data very simple. If the operator is entering that, simply have them change the () to [] and it should work the same way
Sign In or Register to comment.
Left ArrowBack to discussions page