1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

UserTech : SETVAR not working for struc field of type STRING (CHAR[]) in KFDc

  • lionpeloux
  • March 15, 2019 at 8:46 AM
  • Thread is Resolved
  • lionpeloux
    Reactions Received
    1
    Trophies
    3
    Posts
    47
    • March 15, 2019 at 8:46 AM
    • #1

    Hello,

    KRC2, KSS5.6, KR5002MT + track KL1500-3 + turntable

    I've been successfully using UserTech KFD files to get custom menus. However, I have an error when trying to write (with a script) to a STRING (CHAR[]) field of a custom STRUC.

    This is how my STRUC is defined :

    Code
    DEFDAT MdiManager PUBLIC
    
    
    	GLOBAL STRUC MDIACTION_T CHAR Module[8], INT ID, MDICONTEXT_T Context, BOOL AutoQuit
    	DECL GLOBAL MDIACTION_T requestedAction = {ID 0, Module[] " "}
    
    
    ENDDAT

    I can change the ID (INT) field by mean of this script :

    Code
    DEFSCRIPT NewMDI_2001
    	SETVAR(FULLPATH[] "requestedAction.ID", VALUE[] "2001")
    ENDSCRIPT

    But neither of these script will work on the field Module[] (String) :

    Code
    DEFSCRIPT NewMDI_2001
    	SETVAR(FULLPATH[] "requestedAction.Module[]", VALUE[] "CELL")
    ENDSCRIPT
    DEFSCRIPT NewMDI_2003
    	SETVAR(FULLPATH[] "requestedAction.Module", VALUE[] "CELL")
    ENDSCRIPT
    DEFSCRIPT NewMDI_2004
    	SETVAR(FULLPATH[] "MdiManager/requestedAction.Module[]", VALUE[] "CELL")
    ENDSCRIPT

    So my question are :


      • Is it possible to set string fields through SETVAR in KFD scripts ?

      • What is the proper syntax for FULLPATH[] ? Is it documented somewhere ?

    Thanks,

    Images

    • Capture d’écran 2019-03-15 à 08.47.51.png
      • 101.84 kB
      • 955 × 842
      • 29

    Files

    Capture d’écran 2019-03-15 à 08.47.51.png_thumb 13.42 kB – 96 Downloads

    Edited once, last by lionpeloux (March 15, 2019 at 8:55 AM).

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • March 16, 2019 at 4:23 AM
    • #2
    Quote from lionpeloux


    So my question are :


      • Is it possible to set string fields through SETVAR in KFD scripts ?

      • What is the proper syntax for FULLPATH[] ? Is it documented somewhere ?


    * yes it is
    * you already used it successfully so you should know correct syntax

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • March 16, 2019 at 4:25 PM
    • #3

    [size=1em]first of all, UserTech is not another (independent) programming language... Kuka robots are programmed in KRL and ultimately that is what always need to be kept in mind. [/size][size=1em]UserTech has own syntax but... everything you want to do in a script, still need to be intact and match what KRL expects. I m talking about variable names and values. if you cannot use them correctly in KRL, you will not be able to use them in UserTech.[/size]


    [size=1em]For example you used:[/size]

    Quote
    Code
    SETVAR(FULLPATH[] "requestedAction.ID", VALUE[] "2001")


    [size=1em]that works because it correctly uses names and values that KRL expects. In KRL you could do the same with following line:
    [/size]

    Code
    requestedAction.ID = 2001


    [size=1em]NOTE:
    * Whatever variable name and value works in KRL, it need to be surrounded by quotation marks when it is used in KFD scripts. always
    * If something in KRL needs quotations, those quotations do not disappear just because you need to use this in a KFD scripts. they are still needed - always[/size]
    [size=1em]
    basically in KRL you could do:
    [/size]

    Code
    requestedAction.Module[]="CELL"


    [size=1em]therefore equivalent KFD script should be [/size]

    Quote
    Code
    SETVAR(FULLPATH[] "requestedAction.Module[]", VALUE[] ""CELL"")

    [size=1em]but... take a closer look at ""CELL'""[/size]


    [size=1em]this will create a conflict with UserTech syntax since it does not understand the difference - quotations look like quotations.[/size] [size=1em]that's the thing with computers, they need programmers to tell them what to do and how to interpret things. Without programmers influence UserTech would simply expect that first pair of quotations before CELL are important (and see them as an empty string value). Rest would be unexpected and considered superfluous (CELL"").[/size]

    [size=1em]it is programmers job to inform UserTech that outer pair of quotations are the "normal pair" and those outer quotations will stay "as is".[/size]


    [size=1em]but those inner quotations are not to be parsed or interpreted by UserTech, they are not for UserTech - they are needed by KRL.[/size]

    [size=1em]in other words from UserTech perspective they are special characters that need to be there but should be ignored (not treated as UserTech quotation). [/size]

    [size=1em]According to UserTech manual, this is done by placing forward-slash before each of them,[/size] [size=1em]so the final version is:[/size]

    Quote
    Code
    SETVAR(FULLPATH[] "requestedAction.Module[]", VALUE[] "/"CELL/"")

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

    Edited once, last by panic mode (March 16, 2019 at 6:15 PM).

  • lionpeloux
    Reactions Received
    1
    Trophies
    3
    Posts
    47
    • March 18, 2019 at 9:17 AM
    • #4

    Thank you for this clarification !

    It is much more clear to me now and I understand the logic of escaping the double quote in the KFD.
    I've been reading the manual several times before asking but I must say it's quite "smoggy".

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • March 18, 2019 at 1:23 PM
    • #5

    UserTech is notoriously challenging for many users. I guess it could have more examples and explanations.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • lionpeloux
    Reactions Received
    1
    Trophies
    3
    Posts
    47
    • March 22, 2019 at 11:56 AM
    • #6

    Still struggling with this ...
    Now I want to have a softkey with the following label : "Butée >|". "|" is a valid ASCII character.

    The "|" character is not displayed and leads to a blank softkey (kicking out the last softkey I defined). Escaping like this "Butée >/|" does not work either.

    EDIT : the syntax "/|" seems to be reserved for parametrized output ...

    Quote

    In the case of parameterized outputs, the parameters must be tagged on to the key, separated by the characters "/|". The translated text and the parameters are then combined in the language database.

    Any idea to achieve this ?

    Code
    DEFSCRIPT SetTrackPosition
    SWITCH DIALOG "Choisir une position prédéfinie pour le track (unité linaire)."		
        CASE ">>" 			DO SetTrackPosition_N
        CASE "Butée N >|"		DO MDIAction_400_SOFTN
        CASE "Milieu" 		DO MDIAction_400_MID
        CASE "<<0 mm" 		DO MDIAction_400_0
        CASE "< Butée P" 	        DO MDIAction_400_SOFTP
        CASE "" 			DO CancelAction
        CASE "Annuler" 	        DO CancelAction
      ENDSWITCH
    ENDSCRIPT
    Display More

    Images

    • Capture d’écran 2019-03-22 à 11.54.00.png
      • 125.77 kB
      • 1,164 × 1,032
      • 25

    Files

    Capture d’écran 2019-03-22 à 11.54.00.png_thumb 12.31 kB – 95 Downloads

    Edited once, last by lionpeloux (March 22, 2019 at 12:21 PM).

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download