RoboDK Forum
Generating a robot program that uses python code可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Generating a robot program that uses python code (/Thread-Generating-a-robot-program-that-uses-python-code)



Generating a robot program that uses python code-petsven-11-18-2020

I am using a 30 trail version of this software. In my Kuka station, I have a Python script (called MyRobotScript) and regular program that calls the python script. When I click "Generate robot program" on the regular program, a file called "prog2.scr" shows up in my "Documents\RoboDK" folder. This file contains an external call to MyRobotScipt:
Code:
;External program calls:
EXT MyRobotScript()

Code:
;箴gram generated by RoboDK v5.1.2 for KUKA KR 20 R1810 on 18/11/2020 16:45:33
;Using nominal kinematics.
MyRobotScript()
END
I am wondering where the "MyRobotScript" external program is located. I don't see any other files in the "Documents\RoboDK" folder.

Also if I right click on the python script and click "Generate robot program", message shows up at the bottom saying "Running Python script...". This message never goes away and no script is generated as far as I can see.

In options, my python interpreter is:
Quote:C:\Users\[My Name]\AppData\Local\Programs\Python\Python39\pythonw.exe



RE: Generating a robot program that uses python code-petsven-11-20-2020

I think I have answered my own question. Should I be using program.MoveJ to add movements to my program instead of using robot.moveJ to do the movements in Python? It looks like robot.moveJ are not added to the generated program, but program.MoveJ commands are.


RE: Generating a robot program that uses python code-Jeremy-11-20-2020

Hi Petsven,

You are right, the .MoveJ command has different behavior if it's associated with a robot item or a program item.

program.MoveJ(Target) will add a MoveJ to the program.

Jeremy