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

Generation of robotprogram

#1
Hey there

我试图提高sp的后处理程序ecific robot model, I had to find out how exactly a robot program is being generated.
In my example I only work with a python-script, which has classes and functions. This script ist then generated viaGenerate robot program (F6)with a specific post processor.

I already found out, that roboDK.exe creates a temporary file in the C:\AppData\Local\Temp\Post%Projectname%.py which is called to create the robot program with the selected postprocessor. In this temp file, all of the movements are listed linear and classes and functions are already translated into this linear format. (This is also explained in the documentation://www.sinclairbody.com/doc/en/Post-Processor...efPostProc)

But I was wondering where the step from the RoboDK-python-script with classes and functions to the linear independent temp file is made. And is this even manipulatable? Where does RoboDK takes the information about which robot is used, which frame is selected etc.?

I'm thankful for any information!
Janis
#2
Hi Janis,

Most of you finding are right.

When you generate a program (F6), RDK will automatically create a Python file in Temp named Post%Projectname%.py.

Quote: Where does RoboDK takes the information about which robot is used, which frame is selected etc.?

This Python script will be populated by the program you choose to generate in RoboDK.

Quote: where the step from the RoboDK-python-script with classes and functions to the linear independent temp file is made.

When you right-click the program in RoboDK, you can "Select post-processor". This will bring the list of posts available in C:/RoboDK/Posts.
The selected post will appear on top of the Post%Projectname%.py file and use it to translate the Post%Projectname%.py file to the specific robot program.

Jeremy
Find useful information about RoboDK and its features by visiting our2022世界杯32强赛程表时间 and by watching tutorials on ourYoutube Channel.


#3
Hi Jeremy

Thanks for your fast reply. What you explained is what I already found out, but I can't find out how RoboDK creates this temp File.

By clicking generate roboter file, RoboDK generates this temp file in the folder .../temp. But ist there anywhere a script, which does this translation from the Pythonscript inside RoboDK (with classes and methods) to this temp file (Only linear function calls)?

Thanks
Janis
#4
Hi Janis,

No, you can't control that temp file.
This part is proprietary to RoboDK. You can start customizing from there.

Why would you want to modify that? All instructions in RoboDK should reach the temp file by themself.

Jeremy
Find useful information about RoboDK and its features by visiting our2022世界杯32强赛程表时间 and by watching tutorials on ourYoutube Channel.


#5
Hi Jeremy

Thanks again for your information, so there is no chance to manipulate this.

The thing is, that RoboDK converts classes, methods and loops into linear code. A for-loop with 5 runs would just generate the content of the loop 5 times in the temp-file. So for example, an endless while-loop isn't possible to generate, cause this would end in a temp-file with infinity code lines. And therefore it is not possible to create an endless program. (Or maybe I just don't see how to handle this?)

It's also not possible to generate individual functions, cause they are all ignored.

So maybe you got some other inputs here, otherwise I'm thankfull for your support!
#6
Hi Janis,

I see. For-while-loop are not supported as we speak.
What you can do though is use "program call" with whatever keyword you want. You can then retrieve that keyword in the "RunCode" section of the post-processor.

Here's an example for ABB with IF/ELSE:

Code:
def RunCode(self, code, is_function_call = False):
"""Adds code or a function call"""
if code.startswith('END') or code.startswith('ELSEIF'):
# remove tab after ENDWHILE or ENDIF
self.TAB = self.TAB[:-len(ONETAB)]

self.addline(code.replace('\t',' '))# replace each tab by 2 spaces

if code.startswith('IF ') or code.startswith('ELSEIF ') or code.startswith('WHILE '):
# add tab (one tab = two spaces)
self.TAB = self.TAB + ONETAB

But this part here surprises me:
Quote: It's also not possible to generate individual functions, cause they are all ignored.


Can you precise? Because that shouldn't be the case.

Jeremy
Find useful information about RoboDK and its features by visiting our2022世界杯32强赛程表时间 and by watching tutorials on ourYoutube Channel.


#7
Hi Jeremy

I haven't noticed this RunCode-Function. This may make everything a bit easier to handle, thanks! I tried to work with it and it seems that even endless while-loops could be generated with this function. I think this is the best possible solution for this problem.

再次感谢你对我的帮助with this.

Janis
#8
It's a pleasure Janis!

Have a great day.

Jeremy
Find useful information about RoboDK and its features by visiting our2022世界杯32强赛程表时间 and by watching tutorials on ourYoutube Channel.






Users browsing this thread:
1 Guest(s)