Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Regarding RunProgram

#3
(04-03-2020, 09:16 PM)Albert Wrote:What program are you trying to call?

When you use RunProgram in simulation mode, it will trigger that program if you have it available in your RoboDK station. If that program you triggered is a Python program, you can collect the parameters as if you passed them as arguments (like command line arguments).

When you generate code for your robot controller, the parameters will be passed as arguments. Usually the post processor will handle the way these parameters are passed (some controllers do not allow passing parameters).

Hi Albert,

I was hoping you could elaborate on how exactly you pass multiple arguments into a python program through the RunProgram call (now using the RunCode method). I am using the C# api to execute an existing python script.

The RunCode documentation asks for a list of strings as its input. In the code below, the line "SCRIPT.RunCode(inputs)" gives me the error "Cannot convert List to 'string' ".
Code:
RoboDK.Item SCRIPT = RDK.getItem(scriptName);
List inputs = new List();
inputs.Add(numEdges);
inputs.Add(radius);
inputs.Add(TCPspeed);
SCRIPT.RunCode(inputs);

My current work around is assembling the inputs into a single string through the code below and passing that into the python script. The python script then splits the string based on space delamination; however, it would be nice to use "sys.argv[n]" call in the python code to gather inputs.

Code:
RoboDK.Item SCRIPT = RDK.getItem(scriptName);
string inputs = numEdges + " " + radius + " " + TCPspeed;
SCRIPT.RunCode(inputs);

Run Code Reference
//m.sinclairbody.com/doc/en/PythonAPI/robo...em.RunCode

任何帮助都是赞赏,或只是让我知道哟u need more information!
Trevor


Messages In This Thread
Regarding RunProgram - byshrichandini- 04-03-2020, 06:03 AM
RE: Regarding RunProgram - byAlbert- 04-03-2020, 09:16 PM
RE: Regarding RunProgram - bytrevorb- 10-08-2020, 09:05 PM



Users browsing this thread:
1 Guest(s)