Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set timeout value.
#1
Hi 

I'm using the python API to generate a program which is quite long. Often it will timeout before its written to disk. See output below. Is there any way to increase the timeout value? I couldn't see anything in the docs or preferences window. 

Thanks

Julian

#     RL.ShowRoboDK()
#   File "/Applications/RoboDK/RoboDK.app/Contents/Python/robolink.py", line 846, in ShowRoboDK
#     self._check_status()
#   File "/Applications/RoboDK/RoboDK.app/Contents/Python/robolink.py", line 286, in _check_status
#     status = self._rec_int()
#   File "/Applications/RoboDK/RoboDK.app/Contents/Python/robolink.py", line 418, in _rec_int
#     buffer = self.COM.recv(4)
# timeout: timed out #
#2
Hi Julian,

What function do you use before calling ShowRoboDK?

You could do something like this to change the default timeout (10 seconds):

Code:
from robolink import *

RDK = Robolink()

# Change the default timeout here, in seconds:
RDK.TIMEOUT = 30 # in seconds
RDK.COM.settimeout(RDK.TIMEOUT)

# ...


Albert
#3
Hi Albert,

Thanks for this. I think the last function before the timeout is:
Code:
program.MakeProgram(timestamp_dir) 
My code builds a large program with subprograms in RoboDK, and then writes it to disk, all while the UI is in a hidden state as it seems to be much faster. When a timeout occurs, I find the program is finished but nothing was written to disk.

I will try your suggestion.  Thanks again!

julian
#4
Hi Albert,

I think I found the line that was giving me headaches. 

Code:
program.ShowInstructions(False)
It was being called while RoboDK was minimized and I think that was the cause of the crash, which gave a timeout message. If this is the case I won't need to go back to a previous version either :)

Cheers!

Julian
#5
Hi Julian,
This command can take a long time if you have a large program. I recommend you to hide the instructions before you start building your program.
Albert
#6
Thanks Albert. 

I also found it builds the program fast if I hide the UI. And I think the problem was, I was using ShowInstructions while minimized.

So I guess the best order is:

1. Create the program.
2. Set program.ShowInstructions(False).
3. Hide the UI.
4. Add all the instructions.
5  Show the UI.

I was also wondering if there's a way to collapse and expand a frame in the outline panel with python? I have up to 20 frames containing hundreds of targets each, so I'd like them to appear in a collapsed state.

Many thanks

julian
#7
Hi Julian,

We just released a new update that allows you to expand/collapse items in the tree the following way:

Code:
# Start the RoboDK API
from robolink import *
RDK = Robolink()
item = RDK.Item('Frame 1')        # Retrieve an item with some child nodes
item.setParam("Tree","Expand")    # Expand the child nodes:
item.setParam("Tree","Collapse")  # Collapse the child nodes:

Make sure to download the latest version (at this moment, Windows only):
https://robodk.com/download

Albert
  




Users browsing this thread:
1 Guest(s)