RoboDK Forum
Add program 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: Add program code (/Thread-Add-program-code)



Add program code-ivanmatskevich-01-30-2020

Hi, I make standart SampleOfflineProgramming_GUI.py and when i generate robot program there are no global variables as: approach, radius, .. How can i generate program that have parameters in the head of the program, and have all addictions in robot moves.
I want to generate program and then correct parameters in generated program, no in RoboDK, because i want to make my own GUI. Thanks a lot.


RE: Global parameters-Albert-01-31-2020

You can useRunInstructionto add program calls and customized code in your program.

Example:
Code:
# Add a program call or specific code in the program:
program.RunInstruction('ChangeTool(2)',INSTRUCTION_CALL_PROGRAM)
program.RunInstruction('ChangeTool(2);',INSTRUCTION_INSERT_CODE)

More information and examples here:
//www.sinclairbody.com/doc/en/PythonAPI/robolink.html#robolink.Robolink.AddProgram