How can I convert a .script file into a .urp file using Python?

For my Capstone Project, I’m currently trying to create a Python program that can turn drawing inputs from a tablet into a program that the UR10e Cobot can run to reproduce the drawing.

Using RoboDK, I can produce a .script file containing the program I need the Cobot to run and I can reproduce it in Python. But the UR10e Cobot doesn’t seem to be able to run a .script file.

RoboDK uses a post processor in order to convert a .script file into a .urp file but whenever I view the .urp file it shows the following:

‹•¦•aÿProg1 ÅV{â6ÿ?Å4+U q!†<ÈVZÝÝž¶Õ‰Õ²«¶ªN‘IH›8‘íÐãÛ×v¶×Ru ìñ¼~ãñÌÌ_žy±å4‡˜#•˜<°…5µÛ± £B®èþ„ÆhŽKË’”c,~XX¶)’f•i¡øÜÐ*“ÖíÀ<Þ¥Y‘éÚ~¤)kÍòŠ-YvX²X镼BòB«x>”Šò±Ø㏈1YXÄvÜ€„çú^øÐ8Æyc–ØÓПøS×!^è¹þTqTïb™îñùíãÂÚÐL U{òÊ5CZÅ<-%HãÀ}š¹k ï0y[0‰LŠ[L<ÃeÅv
²bM3(©‚‡¹ÐämM48¢\hEpì‰çœršˆú0è˜JRIbOœW‡ZR¼>\gȌڴQn4;9žsÜDeí«:*sFÝ÷“âшÞ|ñcðÞ% Pv€æÆATë²¾\;äh˜îø™æe†#$\ÝaPتP—ȁ
µ)ÛTTiTÇRa÷CÍ-KdmŒlÛ6+…Mÿ›õûÚ@_¿(9=À¶bZNk[iÂ’ ö4«ÐhÓ’*E@îÕ8à ¨dYÉšãÝ2Z=>ÝýªBäBºix*ž7Mz”‘z,¡<‰’t›ª÷)5ƒV|÷:û††ÕêÉgõ6AYÿ~5S¡VO)AÞ¢~ßì/„Ý¡ü>“?q^ƒEÙy…FŸS.Ï:¯ë¬êûÛÈ™NèÏ©h\×àNm/¿±»_VÑ¢¦<œSNà}å=Ö*N.Ò੽ú™¦6*×e)U•Gb¼£l‹:0[ö?UíAlÿÎ\ʝÃCønÑ<†ÄÅƒÖƒë:°_ŸU-ŽcZ}eÆÞ¿£è%Ë?ן6›tOiH]#Ú³E¦Û&°>ÀS±.Þý{ÏV
E—óac#e”…ÀHrÊÄ 0Òîû³`6óŒ>âªÕL›s}יƇ‰NjËíª#~Žº5jÛœ2{Ú}.ðÁ±§Á4œLõÊóüÙ,ü?\p‰KmÍq¦þ‰µoゾ‰Àñ|sñ¡ºaúßù j0K Ø@Þ{<W¦±4ÍÕÕ||6ïôG¡zø·†Õfhš

The following is the .script file that the prior pasted text is converted from

def Program1():

Global parameters:

global speed_ms = 0.250
global speed_rads = 0.750
global accel_mss = 1.200
global accel_radss = 1.200
global blend_radius_m = 0.001
global ref_frame = p[0,0,0,0,0,0]


Add any default subprograms here

For example, to drive a gripper as a program call:

def Gripper_Open():


Example to drive a spray gun:

def SprayOn(value):
# use the value as an output:
if value == 0:
set_standard_digital_out(DO_SPRAY, False)
set_standard_digital_out(DO_SPRAY, True)

Example to drive an extruder:

def Extruder(value):
# use the value as an output:
if value < 0:
# stop extruder
# start extruder

Example to move an external axis

def MoveAxis(value):
# use the value as an output:
DO_AXIS_1 = 1
DI_AXIS_1 = 1
if value <= 0:
set_standard_digital_out(DO_AXIS_1, False)

  # Wait for digital input to change state
  #while (get_standard_digital_in(DI_AXIS_1) != False):
  #  sync()
  set_standard_digital_out(DO_AXIS_1, True)
  # Wait for digital input to change state
  #while (get_standard_digital_in(DI_AXIS_1) != True):
  #  sync()


Main program:

Program generated by RoboDK v5.3.0 for UR10e on 19/11/2021 10:51:42

Using nominal kinematics.

ref_frame = p[0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000]
movej([0.006279, -1.569058, -1.580212, 0.007678, 1.564517, -0.000000],accel_radss,speed_rads,0,0)
movel(pose_trans(ref_frame,p[0.687885, -0.177384, 0.476310, -1.209200, 1.209200, -1.209200]),accel_mss,speed_ms,0,blend_radius_m)
movel(pose_trans(ref_frame,p[0.687885, 0.214064, 0.563335, -1.209200, 1.209200, -1.209200]),accel_mss,speed_ms,0,blend_radius_m)
movel(pose_trans(ref_frame,p[0.687885, 0.193313, 0.969911, -1.209200, 1.209200, -1.209200]),accel_mss,speed_ms,0,blend_radius_m)
movel(pose_trans(ref_frame,p[0.687885, -0.168872, 0.895841, -1.209200, 1.209200, -1.209200]),accel_mss,speed_ms,0,blend_radius_m)

End of main program



How is it possible to convert this .script file into the .urp file above?

I do not know of a way to convert a .script to a .urp file, but the UR10e should be able to run a script file using the “Script” Node under Programs → Advanced → Script. In this node you can choose between line or a file in the top right corner. From there you just click Edit → Open and then select the .script file you are wanting to use.


I haven’t seen anything that’s enabled a script file to go to a .urp program but as nrivas said you can run a standard script file on the robot using the “Script” node.
Additionally the first thing that came to mind for this was using the “Toolpath URCap” which can take GCode and run it directly on the robot. Many people have used this to implement drawing functionality on the robot either by using Fusion360/Solidworks and extracting the gcode or just providing the gcode to the robot directly through other software.

Essentially if you could take the “drawing inputs from a tablet” and extract that as GCode then send that to the robot you should be able to accomplish what you’re looking for. Links to articles below that might be helpful:

UR+: Remote TCP & Toolpath URCap
Support Site: Remote TCP & Toolpath URCap - URScript Functions and Examples
Support Site: Remote TCP & Toolpath URCap - Instructional Videos
Support Site: Remote TCP & Toolpath URCap: Post-Processor Configuration using Autodesk Fusion 360 on eSeries
Support Site: Universal Robots Toolpath Generator for Solidworks