Navigation

This documentation presents the RoboDK API for Python.
With the RoboDK API it is possible to create simulations with robots and mechanisms as well as generating brand-specific programs for robots.
Whereas you can use the graphical user interface to create programs, you can extend its capabilities using a programming language such as Python.
The RoboDK API for Python integrates all the offline programming features of the RoboDK simulator and allows you to deploy automated applications for a large variety of robots and mechanisms.

robolink Module: this module is the link between RoboDK and Python. Any item from the RoboDK item tree can be retrieved. Items are represented by the object Item. An item can be a robot, a reference frame, a tool, an object or a specific project.

With the RoboDK API it is possible to simulate and program robots for applications as simple as pick and place or as complex as synchronizing the movements of many robots.
RoboDK API example using Python:

fromrobolinkimport*# import the robolink library (bridge with RoboDK)RDK=Robolink()# establish a link with the simulatorrobot=RDK.Item('Robot')# retrieve the robotrobot.setJoints([0,0,0,0,0,0])# set all robot axes to zerotarget=RDK.Item('Target')# retrieve the Target itemrobot.MoveJ(target)# move the robot to the target# calculate a new approach position 100 mm along the Z axis of the tool with respect to the targetfromrobodkimport*# import the robodk library (robotics toolbox)approach=target.Pose()*transl(0,0,-100)robot.MoveL(approach)# linear move to the approach position

The same script used for simulation can be used for offline programming, which means that the appropriate program can be generated for the robot being used.
RoboDK supports a large number of robot controllers and it is easy to include compatibility for new robot controllers using Post Processors.
A quick overview of RoboDK Processors is provided in the following video:
https://robodk.com/help#PostProcessor

RoboDK uses Python 3 by default. The robodk package also works with Python 2.

Download and install RoboDK: https://robodk.com/download
Follow these steps to verify if Python is working properly:
1. Start RoboDK.
2. Select Program-AddPythonProgram. A new Python item will appear called Prog1.
3. Double click the new Python program. A message should be displayed, provoked by an error raised inside the script. The message should list all items available in the station.
4. Right click the new program and select “Edit Python script” to modify it.

If a different message is displayed it means that RoboDK does not detect Python. If Python was installed properly it is possible to adjust the following settings for RoboDK to use Python properly:
Tools-Options-Other

If you alredy installed RoboDK for Windows you should have Python 3 installed. Otherwise, install Python from the following link:
https://www.python.org/downloads/windows/
When RoboDK is started for the first time, the robodk Module and robolink Module modules are automatically copied to the folder:
C:/Python34/
Alternatively, these files can be copied manually from the folder:
C:/RoboDK/Python/

RoboDK and Python must be installed separately on Mac computers. Download Python for Mac here:
https://www.python.org/downloads/mac-osx/
Python 2 might be already installed on recent Mac computers. In that case it is not required to install Python.