Changing postpocessors through a python API for varying robot programs- Printable Version +- 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: Changing postpocessors through a python API for varying robot programs (/ Thread-Changing-postpocessors-through-a-python-API-for-varying-robot-programs) |
Changing postpocessors through a python API for varying robot programs-Pradnil Kamble-01-19-2022 Hi RoboDK team, I want to ouput multiple robot programs for a single robot movementes through a python API. For example, a particular block of robot movements should be exported through KR C4 whereas other block of robot movements should be exported to a Kuka.CNC program. to explain: // defined parameter: imports, robot, robot_base, path etc. RDK.setRunMode(3) post_processor = "KUKA_KRC4" robot.setParam("PostProcessor", post_processor) RDK.ProgramStart('Prog1', path, post_processor, robot) ... // movements for Prog1 ... RDK.Finish() //finish the movements for Prog1 and export a KR C4 program RDK.setRunMode(3) post_processor = "KUKA_CNC" robot.setParam("PostProcessor", post_processor) RDK.ProgramStart('Prog2', path, post_processor, robot) ... // movements for Prog2 ... RDK.Finish()//finish the movements for Prog1 and export a KUKA_CNC program ... / /进一步的行动 ... RE: Changing postpocessors through a python API for varying robot programs-Albert-01-20-2022 This should be possible. The sample code you shared looks like you are heading in the right direction. What issues did you have? RE: Changing postpocessors through a python API for varying robot programs-Pradnil Kamble-01-25-2022 Hi Albert, Thanks for the response. I tried a code similar to my sample code and realized, the program exports just the prog1 and neglects everything after the first RDK.Finish() command. I mean, the movements of prog1 are only exported as the .src, I dont get Kuka_CNC. I believe it should work if I create multiple functions that export particular robot program. Like Def prog1(movements_for_prog1) Def prog2(movements_for_prog1). But I would like to have it similar to the one I described above. RE: Changing postpocessors through a python API for varying robot programs-Jeremy-01-25-2022 Can you share your script here with a demo station, this will help us help you. Jeremy RE: Changing postpocessors through a python API for varying robot programs-Pradnil Kamble-01-26-2022 Attached is a demo example. The station has a example program (python) that switches in between the postprocessors. I have added some comments, the code throws a error when RDK.Finish() is called, if I comment the RDK.Finish() function in between the code the, simulation works smooth however the desired output i.e. 3 seperate robot programs are not produced instead a single robot program (KRL) is obtained. Please let me know! P.S. Please define a output path in the python program main Best, Pradnil S Kamble RE: Changing postpocessors through a python API for varying robot programs-Albert-02-02-2022 You can fix the issues in your script by making these modifications:
Code:
# Use the KUKA CNC post
RE: Changing postpocessors through a python API for varying robot programs-Pradnil Kamble-11-24-2022 Thanks Albert and Jeremy! This is now resolved. |