The following warnings occurred:
Warning[2] session_start(): open(/opt/alt/php74/var/lib/php/session/sess_63acb264f7c5a3e348cd75b232611130, O_RDWR) failed: Disk quota exceeded (122) - Line: 402 - File: inc/plugins/myfbconnect.php PHP 7.4.33 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/myfbconnect.php 402 session_start
/inc/class_plugins.php 142 myfbconnect_global
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning[2] session_start(): Failed to read session data: files (path: /opt/alt/php74/var/lib/php/session) - Line: 402 - File: inc/plugins/myfbconnect.php PHP 7.4.33 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/myfbconnect.php 402 session_start
/inc/class_plugins.php 142 myfbconnect_global
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LIMITATIONS ON ITEM.SETNAME() AND ITEM.SETVALUE()
#1
I have an application where it would be useful to store custom information with RoboDK's target objects. (The information is related to the state of the broader machine when it reaches a certain target.) This way, the information would persist across saves of the .rdk workstation rather than becoming unlinked from the robolink.Item handles associated with those targets when my robolink.Robolink() connection closes.

To this end, I have two questions:
1. Is the robolink.Item.setValue() method in active use right now? Or might I be able to co-opt it? If it's user-available, does it work like a Python dict? (Or would you be able to share other additional documentation for the function of .setValue()?)
2. What is the character limit for robolink.Item.Name()? (As a plan-B, I can dump the data I want into a string and store it in the target name.)

As a workaround, it's possible to store the target handle / target data link as pickled data in a file, but it makes it tricky and somewhat indeterminate if targets get modified in the workstation without Python's knowledge.
#2
You can store custom binary data by using item.setParam("parameter", bytevalue), and you can retrieve it by using item.getParam("parameter").

This feature was added for this purpose and at RoboDK we use it internally to create apps and new products.

Example:
Code:
mydata = b'custom byte array'
item.setParam("MyData", mydata) # Save binary data

# ... you can save, close your RDK file and open it again

mydata = item.getParam("MyData")
# mydata = b'custom byte array'
When you have custom data stored in items you can see what's stored by right clicking on the station and selectingStation Parameters(you'll see it at the bottom of the Constant parameters section). You can only read and edit this data by using the API. This data can be deleted if you selectClear allin this menu.

item.setParam has a different behavior when the second parameter is a string. More information here:
//www.sinclairbody.com/doc/en/PythonAPI/robo...m.getParam
#3
Thanks, Albert. That's exactly what I was looking for.




Users browsing this thread:
1 Guest(s)