Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyton: Specific post processor and run mode for machining project
#1
Hi,
I am using a Python script to generate a 3D-printing project. As of yet I have not figured out how to use the ProgramStart, AddProgram, RunCode or MakeProgram methods correctly. The procedure is roughly this:
- user is prompted to choose a geometry file
- object is loaded into RoboDK using

Code:
PrintPart=RDK.AddFile(GeomFile, parent=frame)
- a machining project is added using

Code:
PrintProject=RDK.AddMachiningProject(name,robot)
- the object is added to the machining project:

Code:
PrintProject.setMachiningParameters(part=PrintPart)
This way the printing object is attached to the machining project and RoboDK automatically generates a RoboDK-program. So far so good.
I would now like to translate the RoboDK program into a real robot program. This raises two questions.
1) How can I do this, using a specific post processor?
I am currently using MakeProgram to save the robot program to a folder. This works but is not satisfying, because it uses the KRC2 post processor per default. I need to use another one.
2) I actually do not want to safe the program to a folder, so MakeProgram could be entirely wrong. I would either like to
   a) send the program to and run it on the robot. This should refer to RunMode = 6 as I understand it. Or
   b) send the program to and run it on the robot independently from RoboDK and the laptop. This should be RunMode = 5 if I got that right.

Please let me know if I left out any crucial information. I can not see which method to use to achieve these goals.
I already tried ProgramStart as it is shown in the API documentation, but it does not seem to work for the automatically generated printing program. On the other side it seems to be the only method that allows me to choose the post processor.
Any advice where to go from here is appreciated.

Best regards
David
#2
Hi David,

It is not possible to create a 3D print project through the API. We'll try to add this as a new feature in a timely manner. At this moment, the following call creates a curve follow project or a point follow project if the object has curves or points:
PrintProject.setMachiningParameters(part=PrintPart)

To specify the robot post processor you can change the post processor manually (right click the program and select Select Post processor) and save the project. In that case, it will use the last post processor selected.

You can also specify the robot post processor using ProgramStart. For example:
RDK.ProgramStart('ProgramName','C:/MyProgramFolder/', "KUKA_KRC4", robot)
However, this assumes you are generating the program directly from Python (not using MakeProgram). In the worst case, with the current version you can generate a dummy/empty program to change the post processor if you don't want to do it manually (post processor settings are stored in the RDK files and robot files).

If you have your path/machining project ready you can do the following to generate a program and send it to the robot automatically:

update_result = PrintProject.Update()
program = PrintProject.getLink(ITEM_TYPE_PROGRAM)
run_mode = RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD
program.MakeProgram(path_folder, run_mode)

This is the same as right clicking your program and selecting "Send Program to Robot".
#3
Hi Albert,
thanks for your explanations. You are right, I have not been completely accurate there, what I meant is a follow point project.
However, selecting a post processor manually is not an option. I have to use the API. Your suggestion to create a dummy program in order to change the settings for the robot sounds fair to me. Sadly it does not seem to work the way I tried it (see attachment).
The script opens RoboDK, adds my robot and creates an empty program in the folder of my choice. That is all fine,
but if I check the settings of the robot it still uses the KRC2 post processor.
Can you tell me what is wrong with my procedure?


Attached Files
.py   Command_tester.py (Size: 615 bytes / Downloads: 2)
Best regards
David
#4
Hi David,
There is a new update available since yesterday that will allow you to only change the post processor. You should use setParam. For example:

Code:
robot.setParam("PostProcessor", "KUKA_KRC4")
You can take the latest version here:
https://robodk.com/downloads/Win64
#5
That is just perfect, thank you very much!
Best regards
David
  




Users browsing this thread:
1 Guest(s)