Posts: 8
Threads: 2
Joined: Nov 2023
Reputation:
0
03-19-2025, 05:41 PM
(This post was last modified: 03-19-2025, 10:20 PM by Albert.)
I'm working in a 3D Printer Project with RoboDK. I was able to configure my station and generating the program for the robot. Currently we are using a UR3 robot.
I'm experiencing troubles with the Program Events Tab. I want to customize the Call M code event, to send that instructions to the extruder controller. The problem that I get is when I change the parameters for the function call, the result in the script obtained from the postprocesor doesn't separate the parameters, so it's imposible to use it.
In the help of that particular event, I can read several examples: for a M106 P1 S0.8
RunCode_M('%2') should generate RunCode_M('106 P1 S0.8"), but in my case I obtain something like M_RunCode("1040225") (the name of the function doesn't matter) it's G-Code M104 P0 S225, but the parameters are not properly separated with commas or spaces.
I tried several options but neither of them are working, I can not obtain the parameters separated with spaces or commas either like numbers or strings.
Are there something related to this, where I can found a solution, or it's maybe a bug of my versión of the postprocesor or RoboDK.
Any help it's welcomed I'm stuck in this point.
I have also problems with the Extruder event too. That's a extract of the G-Code of the object that i want to print:
Code: G1 X-0.222 Y-3.196 E0.37006
G1 X0.933 Y-4.014 E0.62214
G1 X2.799 Y-5.058 E1.00308
G1 X4.055 Y-5.601 E1.24695
And the corresponding script code, as you can see the Extruder function lost the units point, i don't know if that's related with the above problem or not.
Code: Extruder("037006")
movel(pose_trans(ref_frame,p[-0.000222, -0.003196, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Extruder("062214")
movel(pose_trans(ref_frame,p[0.000933, -0.004014, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Extruder("100308")
movel(pose_trans(ref_frame,p[0.002799, -0.005058, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Extruder("124695")
Kind Regards,
Miguel
Posts: 4,068
Threads: 2
Joined: Apr 2018
Reputation:
186
What do you mean by it doesn't separate the parameters? Can you provide us with a sample RoboDK project file?
In any case, you can customize output with your post processor by filtering program calls. You can find an example post processor modification here:
https://robodk.com/doc/en/Post-Processor...amesFilter
Posts: 8
Threads: 2
Joined: Nov 2023
Reputation:
0
03-20-2025, 04:05 PM
(This post was last modified: 03-20-2025, 05:33 PM by miguel_lopez.)
I mean that when I am expecting to get in the script of the robot:
Code: RunCode_M('106 P1 S0.8") or RunCode_M(106,P1,S0.8)
I've got instead:
Code: RunCode_M(106108) or RunCode_M("106108")
Where it's impossible to interpreter the parameters of the function call.
I get the solution. I have to select the post procesor Universal Robots 3D Printing, and after that I get the result separated. I had the regular "Universal Robots" and with this one the Program Event are not properly solved.
The problem now is that this post processor has a limitation of 250 lines per program and I have much more lines in my proyect.
And also I'm not getting the Extruder() call anymore, instead I get set_standard_analog_out(5, 0.267) like it was changing the Extruder calls for changing a value in an analog output of the Robot.
¿Where are all of this configurated? I'm trying to modify the postprocessor, but the .py code it's an almost blank python class derived from the base class BasePost, but not any methods that overwrite the Extruder() function. I checked the folder C:\RoboDK\Posts\ where the files are located and I found several subfolders with versions but the files there are not source .py files. Instead i get precompiled pyc files that i can edit.
I checked the difference between the files Universal_Robots.py vs Universal_Robots_3D_Printing.py and the difference are minimal. Not any clue what one is getting the Extruder function and the other the modification of the analog values
Where can I change these?
Thanks in advance.
Posts: 4,068
Threads: 2
Joined: Apr 2018
Reputation:
186
03-20-2025, 05:25 PM
(This post was last modified: 03-20-2025, 05:27 PM by Albert.)
Great, thank you for letting us know.
You should be able to customize how you output program calls by re-implementing this function in the post processor. You can find an example here:
https://robodk.com/doc/en/Post-Processor...amesFilter
You can also find an example on how to customize a post processor for 3D printing here:
https://robodk.com/doc/en/Robot-Machinin...rint3Dpost
The Universal Robots 3D Printing post processor was created so you can load very long programs to the UR robot without issues. In short, it streams a long program as smaller programs that are executed in order remotely. With this post processor you need the computer to be connected to the robot.
Contact us by email and mention this thread so we can provide you with the source code of these post processors so you can better understand how to customize output.
If you want to change the default number of lines per program you can change it here:
- Select Tools-Options
- Select the Program tab
- Check the option Maximum number of lines per program and set it to your preferred value
Posts: 8
Threads: 2
Joined: Nov 2023
Reputation:
0
Thanks for the promt answer.
I was able to change the behaviour of the Extruder intercepting the function call and overwriting the method RunCode()
Code: def RunCode(self, code, is_function_call = False):
if is_function_call:
if code.startswith("Extruder("):
# Intercept the extruder command.
# if the program call is Extruder(123.56)
longitud = code[9:-1] # Extraemos el parametro
self.addline("extruder_on(" + longitud + ")")
else:
self.addline(code)
else:
self.addline(code)
Now I'm wondering about the difference between the two post processors, I attach the two codes generated for the same object and same settings in the slicer:
Universal_Robots:
Code: # Main program:
# Program generated by RoboDK v5.9.0 for UR3e on 20/03/2025 18:59:12
# Using nominal kinematics.
blend_radius_m = 0.001
M_RunCode("M190P0S65")
M_RunCode("M104P0S225")
speed_ms = 0.083
speed_ms = 1.000
ref_frame = p[0.314000, 0.251000, 0.015000, 0.000000, 0.000000, 1.570796]
set_tcp(p[-0.072000, 0.066500, 0.037200, -0.000000, 2.221441, 2.221441])
# Mostrar extrusor_sin_tapas
movej([3.058026, -0.991007, 1.394954, -0.403948, 0.265494, 3.141593],accel_radss,speed_rads,0,0)
movel(pose_trans(ref_frame,p[-0.001782, -0.001824, 0.005000, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
M_RunCode("M109P0S225")
M_RunCode("M82P0S0")
Extruder("0.00000")
speed_ms = 0.130
movel(pose_trans(ref_frame,p[-0.001782, -0.001824, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
speed_ms = 0.030
Extruder("0.37006")
movel(pose_trans(ref_frame,p[-0.000222, -0.003196, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Extruder("0.62214")
movel(pose_trans(ref_frame,p[0.000933, -0.004014, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Extruder("1.00308")
movel(pose_trans(ref_frame,p[0.002799, -0.005058, 0.000400, 2.573442, 1.801944, -0.000000]),accel_mss,speed_ms,0,0) # end trace
Universal_Robots_3D_Printing:
Code: # Main program:
# Program generated by RoboDK v5.9.0 for UR3e on 20/03/2025 19:57:45
# Using nominal kinematics.
blend_radius_m = 0.001
M_RunCode("M190P0S65")
M_RunCode("M104P0S225")
speed_ms = 0.083
speed_ms = 1.000
# set_reference(p[0.314000, 0.251000, 0.015000, 0.000000, 0.000000, 1.570796])
set_tcp(p[-0.072000, 0.066500, 0.037200, -0.000000, 2.221441, 2.221441])
# Mostrar extrusor_sin_tapas
movej([3.058026, -0.991007, 1.394954, -0.403948, 0.265494, 3.141593],accel_radss,speed_rads,0,0)
movel(p[0.315824, 0.249218, 0.020000, 0.545532, 3.093865, -0.000000],accel_mss,speed_ms,0,0)
M_RunCode("M109P0S225")
M_RunCode("M82P0S0")
extruder_on("0.00000")
speed_ms = 0.130
set_standard_digital_out(5, 0)
movel(p[0.315824, 0.249218, 0.015400, 0.545532, 3.093865, -0.000000],accel_mss,speed_ms,0,blend_radius_m)
speed_ms = 0.030
extruder_on("0.37006")
set_standard_digital_out(5, 0)
movel(p[0.317196, 0.250778, 0.015400, 0.545532, 3.093865, 0.000000],accel_mss,speed_ms,0,0.001)
extruder_on("0.62214")
set_standard_digital_out(5, 0)
movel(p[0.318014, 0.251933, 0.015400, 0.545532, 3.093865, 0.000000],accel_mss,speed_ms,0,0.001)
extruder_on("1.00308")
set_standard_digital_out(5, 0)
movel(p[0.319058, 0.253799, 0.015400, 0.545532, 3.093865, -0.000000],accel_mss,speed_ms,0,0.001)
As we can see, now the call of the extruder is customized. But I get a call to a set_standard_digital_out(5, 0), that i don't use it. It only appears in the 3D printing post processor.
I also noticed the diference in the call of the movel instrucctions, in the 3D printing post processor the call is made using a pose in URScript, but in the other one the instrucction include a conversion of reference calling the functions pose_trans. Why are doing these difference the post processors?
I'm going to load the program directly in the UR uploading the files with a sftp and executing with the teach of the robot, i don't plan to connect RoboDK directly to the robot. Which aproach is better in terms of performance of the robot, I guess the second one, because the robot controler doesn't have to compute in everyline the calculations, but i could be wrong, or maybe I'm missing something.
Posts: 4,068
Threads: 2
Joined: Apr 2018
Reputation:
186
If you are planning on doing 3D printing of large parts with the UR robot I recommend you to find a way to stream the programs from the computer. The Universal Robots 3D printing post processor was created for this purpose and I recommend you to customize it for your needs.
I recommend you to contact us by email so we can share the source code of both post processors and you can fully customize how you generate code.
Posts: 8
Threads: 2
Joined: Nov 2023
Reputation:
0
03-21-2025, 07:57 PM
(This post was last modified: 03-22-2025, 07:14 PM by Albert.)
Ok, I've already sent an email asking for the source code of the post processors. I hope to receive it soon.
Thanks for your help.
Posts: 4,068
Threads: 2
Joined: Apr 2018
Reputation:
186
I just got back to you by email with the source code of ABB and UR post processors.
|