RoboDK API - Documentation
RoboDK Class Reference

This class is the iterface to the RoboDK API. With the RoboDK API you can automate certain tasks and operate on items. Interactions with items in the station tree are made through Items (IItem). An item is an object in the RoboDK tree (it can be either a robot, an object, a tool, a frame, a program, ...). More...

#include <robodk_api.h>

Public Types

enum  {
  ITEM_TYPE_ANY = -1 , ITEM_TYPE_STATION = 1 , ITEM_TYPE_ROBOT = 2 , ITEM_TYPE_FRAME = 3 ,
  ITEM_TYPE_TOOL = 4 , ITEM_TYPE_OBJECT = 5 , ITEM_TYPE_TARGET = 6 , ITEM_TYPE_PROGRAM = 8 ,
  ITEM_TYPE_INSTRUCTION = 9 , ITEM_TYPE_PROGRAM_PYTHON = 10 , ITEM_TYPE_MACHINING = 11 , ITEM_TYPE_BALLBARVALIDATION = 12 ,
  ITEM_TYPE_CALIBPROJECT = 13 , ITEM_TYPE_VALID_ISO9283 = 14
}
 Tree item types. More...
 
enum  {
  INS_TYPE_INVALID = -1 , INS_TYPE_MOVE = 0 , INS_TYPE_MOVEC = 1 , INS_TYPE_CHANGESPEED = 2 ,
  INS_TYPE_CHANGEFRAME = 3 , INS_TYPE_CHANGETOOL = 4 , INS_TYPE_CHANGEROBOT = 5 , INS_TYPE_PAUSE = 6 ,
  INS_TYPE_EVENT = 7 , INS_TYPE_CODE = 8 , INS_TYPE_PRINT = 9
}
 Instruction types. More...
 
enum  { MOVE_TYPE_INVALID = -1 , MOVE_TYPE_JOINT = 1 , MOVE_TYPE_LINEAR = 2 , MOVE_TYPE_CIRCULAR = 3 }
 Movement types. More...
 
enum  {
  RUNMODE_SIMULATE = 1 , RUNMODE_QUICKVALIDATE = 2 , RUNMODE_MAKE_ROBOTPROG = 3 , RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD = 4 ,
  RUNMODE_MAKE_ROBOTPROG_AND_START = 5 , RUNMODE_RUN_ROBOT = 6
}
 Script execution types used by IRoboDK.setRunMode and IRoboDK.RunMode. More...
 
enum  { PROGRAM_RUN_ON_SIMULATOR = 1 , PROGRAM_RUN_ON_ROBOT = 2 }
 Program execution type. More...
 
enum  { CALIBRATE_TCP_BY_POINT = 0 , CALIBRATE_TCP_BY_PLANE = 1 }
 TCP calibration types. More...
 
enum  { CALIBRATE_FRAME_3P_P1_ON_X = 0 , CALIBRATE_FRAME_3P_P1_ORIGIN = 1 , CALIBRATE_FRAME_6P = 2 , CALIBRATE_TURNTABLE = 3 }
 Reference frame calibration types. More...
 
enum  {
  PROJECTION_NONE = 0 , PROJECTION_CLOSEST = 1 , PROJECTION_ALONG_NORMAL = 2 , PROJECTION_ALONG_NORMAL_RECALC = 3 ,
  PROJECTION_CLOSEST_RECALC = 4 , PROJECTION_RECALC = 5
}
 projection types (for AddCurve) More...
 
enum  {
  JOINT_FORMAT = -1 , EULER_RX_RYp_RZpp = 0 , EULER_RZ_RYp_RXpp = 1 , EULER_RZ_RYp_RZpp = 2 ,
  EULER_RZ_RXp_RZpp = 3 , EULER_RX_RY_RZ = 4 , EULER_RZ_RY_RX = 5 , EULER_QUEATERNION = 6
}
 Euler type. More...
 
enum  {
  WINDOWSTATE_HIDDEN = -1 , WINDOWSTATE_SHOW = 0 , WINDOWSTATE_MINIMIZED = 1 , WINDOWSTATE_NORMAL = 2 ,
  WINDOWSTATE_MAXIMIZED = 3 , WINDOWSTATE_FULLSCREEN = 4 , WINDOWSTATE_CINEMA = 5 , WINDOWSTATE_FULLSCREEN_CINEMA = 6
}
 State of the RoboDK window. More...
 
enum  {
  INSTRUCTION_CALL_PROGRAM = 0 , INSTRUCTION_INSERT_CODE = 1 , INSTRUCTION_START_THREAD = 2 , INSTRUCTION_COMMENT = 3 ,
  INSTRUCTION_SHOW_MESSAGE = 4
}
 Instruction program call type: More...
 
enum  { FEATURE_NONE = 0 , FEATURE_SURFACE = 1 , FEATURE_CURVE = 2 , FEATURE_POINT = 3 }
 Object selection features: More...
 
enum  { SPRAY_OFF = 0 , SPRAY_ON = 1 }
 Spray gun simulation: More...
 
enum  { COLLISION_OFF = 0 , COLLISION_ON = 1 }
 Collision checking state. More...
 
enum  {
  EVENT_SELECTION_TREE_CHANGED = 1 , EVENT_ITEM_MOVED = 2 , EVENT_REFERENCE_PICKED = 3 , EVENT_REFERENCE_RELEASED = 4 ,
  EVENT_TOOL_MODIFIED = 5 , EVENT_CREATED_ISOCUBE = 6 , EVENT_SELECTION_3D_CHANGED = 7 , EVENT_3DVIEW_MOVED = 8 ,
  EVENT_ROBOT_MOVED = 9 , EVENT_KEY = 10 , EVENT_ITEM_MOVED_POSE = 11
}
 
enum  {
  FLAG_ROBODK_TREE_ACTIVE = 1 , FLAG_ROBODK_3DVIEW_ACTIVE = 2 , FLAG_ROBODK_LEFT_CLICK = 4 , FLAG_ROBODK_RIGHT_CLICK = 8 ,
  FLAG_ROBODK_DOUBLE_CLICK = 16 , FLAG_ROBODK_MENU_ACTIVE = 32 , FLAG_ROBODK_MENUFILE_ACTIVE = 64 , FLAG_ROBODK_MENUEDIT_ACTIVE = 128 ,
  FLAG_ROBODK_MENUPROGRAM_ACTIVE = 256 , FLAG_ROBODK_MENUTOOLS_ACTIVE = 512 , FLAG_ROBODK_MENUUTILITIES_ACTIVE = 1024 , FLAG_ROBODK_MENUCONNECT_ACTIVE = 2048 ,
  FLAG_ROBODK_WINDOWKEYS_ACTIVE = 4096 , FLAG_ROBODK_NONE = 0 , FLAG_ROBODK_ALL = 0xFFFF , FLAG_ROBODK_MENU_ACTIVE_ALL = FLAG_ROBODK_MENU_ACTIVE | FLAG_ROBODK_MENUFILE_ACTIVE | FLAG_ROBODK_MENUEDIT_ACTIVE | FLAG_ROBODK_MENUPROGRAM_ACTIVE | FLAG_ROBODK_MENUTOOLS_ACTIVE | FLAG_ROBODK_MENUUTILITIES_ACTIVE | FLAG_ROBODK_MENUCONNECT_ACTIVE
}
 RoboDK Window Flags. More...
 
enum  {
  FLAG_ITEM_SELECTABLE = 1 , FLAG_ITEM_EDITABLE = 2 , FLAG_ITEM_DRAGALLOWED = 4 , FLAG_ITEM_DROPALLOWED = 8 ,
  FLAG_ITEM_ENABLED = 32 , FLAG_ITEM_AUTOTRISTATE = 64 , FLAG_ITEM_NOCHILDREN = 128 , FLAG_ITEM_USERTRISTATE = 256 ,
  FLAG_ITEM_NONE = 0 , FLAG_ITEM_ALL = 64 + 32 + 8 + 4 + 2 + 1
}
 RoboDK Item Flags. More...
 

Public Member Functions

 RoboDK (const QString &robodk_ip="", int com_port=-1, const QString &args="", const QString &path="")
 
quint64 ProcessID ()
 
quint64 WindowID ()
 
bool Connected ()
 
bool Connect ()
 
void Disconnect ()
 Disconnect from the RoboDK API. This flushes any pending program generation. More...
 
void Finish ()
 Disconnect from the RoboDK API. This flushes any pending program generation. More...
 
Item getItem (QString name, int itemtype=-1)
 Returns an item by its name. If there is no exact match it will return the last closest match. More...
 
QStringList getItemListNames (int filter=-1)
 Returns a list of items (list of names or Items) of all available items in the currently open station in RoboDK. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_TYPE_ROBOT)) More...
 
QList< ItemgetItemList (int filter=-1)
 Returns a list of items (list of names or pointers) of all available items in the currently open station in RoboDK. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_CASE_ROBOT)) More...
 
Item ItemUserPick (const QString &message="Pick one item", int itemtype=-1)
 Shows a RoboDK popup to select one object from the open RoboDK station. An item type can be specified to filter desired items. If no type is specified, all items are selectable. More...
 
void ShowRoboDK ()
 Shows or raises the RoboDK window. More...
 
void HideRoboDK ()
 Hides the RoboDK window. RoboDK will continue running in the background. More...
 
void CloseRoboDK ()
 Closes RoboDK window and finishes RoboDK execution More...
 
QString Version ()
 Return the vesion of RoboDK as a 4 digit string: Major.Minor.Revision.Build More...
 
void setWindowState (int windowstate=WINDOWSTATE_NORMAL)
 Set the state of the RoboDK window More...
 
void setFlagsRoboDK (int flags=FLAG_ROBODK_ALL)
 Update the RoboDK flags. RoboDK flags allow defining how much access the user has to certain RoboDK features. Use FLAG_ROBODK_* variables to set one or more flags. More...
 
void setFlagsItem (Item item, int flags=FLAG_ITEM_ALL)
 Update item flags. Item flags allow defining how much access the user has to item-specific features. Use FLAG_ITEM_* flags to set one or more flags. More...
 
int getFlagsItem (Item item)
 Retrieve current item flags. Item flags allow defining how much access the user has to item-specific features. Use FLAG_ITEM_* flags to set one or more flags. More...
 
void ShowMessage (const QString &message, bool popup=true)
 Show a message in RoboDK (it can be blocking or non blocking in the status bar) More...
 
void Copy (const Item &tocopy)
 Makes a copy of an item (same as Ctrl+C), which can be pasted (Ctrl+V) using Paste(). More...
 
Item Paste (const Item *paste_to=nullptr)
 Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy(). It returns the newly created item. More...
 
Item AddFile (const QString &filename, const Item *parent=nullptr)
 Loads a file and attaches it to parent. It can be any file supported by RoboDK. More...
 
void Save (const QString &filename, const Item *itemsave=nullptr)
 Save an item to a file. If no item is provided, the open station is saved. More...
 
Item AddShape (tMatrix2D *trianglePoints, Item *addTo=nullptr, bool shapeOverride=false, Color *color=nullptr)
 Adds a shape provided triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally. More...
 
Item AddCurve (tMatrix2D *curvePoints, Item *referenceObject=nullptr, bool addToRef=false, int ProjectionType=PROJECTION_ALONG_NORMAL_RECALC)
 Adds a curve provided point coordinates. The provided points must be a list of vertices. A vertex normal can be provided optionally. More...
 
Item AddPoints (tMatrix2D *points, Item *referenceObject=nullptr, bool addToRef=false, int ProjectionType=PROJECTION_ALONG_NORMAL_RECALC)
 Adds a list of points to an object. The provided points must be a list of vertices. A vertex normal can be provided optionally. More...
 
void ProjectPoints (tMatrix2D *points, tMatrix2D **projected, Item objectProject, int ProjectionType=PROJECTION_ALONG_NORMAL_RECALC)
 Projects a point given its coordinates. The provided points must be a list of [XYZ] coordinates. Optionally, a vertex normal can be provided [XYZijk]. More...
 
void CloseStation ()
 Close the current station without asking to save. More...
 
Item AddTarget (const QString &name, Item *itemparent=nullptr, Item *itemrobot=nullptr)
 Adds a new target that can be reached with a robot. More...
 
Item AddFrame (const QString &name, Item *itemparent=nullptr)
 Adds a new Frame that can be referenced by a robot. More...
 
Item AddProgram (const QString &name, Item *itemrobot=nullptr)
 Adds a new Frame that can be referenced by a robot. More...
 
Item AddStation (const QString &name)
 Add a new empty station. It returns the station item added. More...
 
Item AddMachiningProject (const QString &name="Curve follow settings", Item *itemrobot=nullptr)
 Add a new robot machining project. Machining projects can also be used for 3D printing, following curves and following points. It returns the newly created Item containing the project settings. Tip: Use the macro /RoboDK/Library/Macros/MoveRobotThroughLine.py to see an example that creates a new "curve follow project" given a list of points to follow(Option 4). More...
 
QList< ItemgetOpenStation ()
 Returns the list of open stations in RoboDK. More...
 
void setActiveStation (Item stn)
 Set the active station (project currently visible). More...
 
Item getActiveStation ()
 Returns the active station item (station currently visible). More...
 
int RunProgram (const QString &function_w_params)
 Adds a function call in the program output. RoboDK will handle the syntax when the code is generated for a specific robot. If the program exists it will also run the program in simulate mode. More...
 
int RunCode (const QString &code, bool code_is_fcn_call=false)
 Adds code to run in the program output. If the program exists it will also run the program in simulation mode. More...
 
void RunMessage (const QString &message, bool message_is_comment=false)
 Shows a message or a comment in the output robot program. More...
 
void Render (bool always_render=false)
 Update the scene. More...
 
void Update ()
 Update the screen. This updates the position of all robots and internal links according to previously set values. More...
 
bool IsInside (Item object_inside, Item object_parent)
 Check if an object is fully inside another one. More...
 
int setCollisionActive (int check_state=COLLISION_ON)
 Turn collision checking ON or OFF (COLLISION_OFF/COLLISION_OFF) according to the collision map. If collision checking is activated it returns the number of pairs of objects that are currently in a collision state. More...
 
bool setCollisionActivePair (int check_state, Item item1, Item item2, int id1=0, int id2=0)
 Set collision checking ON or OFF (COLLISION_ON/COLLISION_OFF) for a specific pair of objects. This allows altering the collision map for Collision checking. Specify the link id for robots or moving mechanisms (id 0 is the base). More...
 
int Collisions ()
 Returns the number of pairs of objects that are currently in a collision state. More...
 
int Collision (Item item1, Item item2)
 Returns 1 if item1 and item2 collided. Otherwise returns 0. More...
 
QList< ItemgetCollisionItems (QList< int > link_id_list)
 Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state. More...
 
void setSimulationSpeed (double speed)
 Sets the current simulation speed. Set the speed to 1 for a real-time simulation. The slowest speed allowed is 0.001 times the real speed. Set to a high value (>100) for fast simulation results. More...
 
double SimulationSpeed ()
 Gets the current simulation speed. Set the speed to 1 for a real-time simulation. More...
 
void setRunMode (int run_mode=1)
 Sets the behavior of the RoboDK API. By default, RoboDK shows the path simulation for movement instructions (run_mode=1=RUNMODE_SIMULATE). Setting the run_mode to RUNMODE_QUICKVALIDATE allows performing a quick check to see if the path is feasible. if robot.Connect() is used, RUNMODE_RUN_FROM_PC is selected automatically. More...
 
int RunMode ()
 Returns the behavior of the RoboDK API. By default, RoboDK shows the path simulation for movement instructions (run_mode=1). More...
 
QList< QPair< QString, QString > > getParams ()
 Gets all the user parameters from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" User parameters can be added or modified by the user More...
 
QString getParam (const QString &param)
 Gets a global or a user parameter from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" Some available parameters: PATH_OPENSTATION = folder path of the current .stn file FILE_OPENSTATION = file path of the current .stn file PATH_DESKTOP = folder path of the user's folder Other parameters can be added or modified by the user More...
 
void setParam (const QString &param, const QString &value)
 Sets a global parameter from the RoboDK station. If the parameters exists, it will be modified. If not, it will be added to the station. The parameters can also be modified by right clicking the station and selecting "shared parameters". More...
 
QString Command (const QString &cmd, const QString &value="")
 Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events. More...
 
bool LaserTrackerMeasure (tXYZ xyz, tXYZ estimate, bool search=false)
 Takes a laser tracker measurement with respect to its own reference frame. If an estimate point is provided, the laser tracker will first move to those coordinates. If search is True, the tracker will search for a target. More...
 
bool CollisionLine (tXYZ p1, tXYZ p2)
 Checks the collision between a line and any objects in the station. The line is composed by 2 points. Returns the collided item. Use Item.Valid() to check if there was a valid collision. More...
 
void setVisible (QList< Item > itemList, QList< bool > visibleList, QList< int > visibleFrames)
 Set a list of items visibile (faster than the default setVisible())
 
void ShowAsCollided (QList< Item > itemList, QList< bool > collidedList, QList< int > *robot_link_id=nullptr)
 Show a list of items as collided. More...
 
void CalibrateTool (tMatrix2D *poses_joints, tXYZ tcp_xyz, int format=EULER_RX_RY_RZ, int algorithm=CALIBRATE_TCP_BY_POINT, Item *robot=nullptr, double *error_stats=nullptr)
 Calibrate a tool (TCP) given a number of points or calibration joints. Important: If the robot is calibrated, provide joint values to maximize accuracy. More...
 
Mat CalibrateReference (tMatrix2D *poses_joints, int method=CALIBRATE_FRAME_3P_P1_ON_X, bool use_joints=false, Item *robot=nullptr)
 Calibrate a Reference Frame given a list of points or joint values. Important: If the robot is calibrated, provide joint values to maximize accuracy. More...
 
int ProgramStart (const QString &progname, const QString &defaultfolder="", const QString &postprocessor="", Item *robot=nullptr)
 Defines the name of the program when the program is generated. It is also possible to specify the name of the post processor as well as the folder to save the program. This method must be called before any program output is generated (before any robot movement or other instruction). More...
 
void setViewPose (const Mat &pose)
 Set the pose of the wold reference frame with respect to the user view (camera/screen). More...
 
Mat ViewPose ()
 Get the pose of the wold reference frame with respect to the user view (camera/screen). More...
 
Item Cam2D_Add (const Item &item_object, const QString &cam_params, const Item *cam_item=nullptr)
 Add a simulated 2D or depth camera as an item. Use Delete to delete it. More...
 
int Cam2D_Snapshot (const QString &file_save_img, const Item &cam_item, const QString &params="")
 Take a snapshot of a simulated camera and save it as an image. More...
 
int Cam2D_SetParams (const QString &cam_params, const Item &cam_item)
 Set the camera parameters. More...
 
bool setRobotParams (Item *robot, tMatrix2D dhm, Mat poseBase, Mat poseTool)
 Set the nominal robot parameters. More...
 
Item getCursorXYZ (int x=-1, int y=-1, tXYZ xyzStation=nullptr)
 Returns the position of the cursor as XYZ coordinates (by default), or the 3D position of a given set of 2D coordinates of the window (x & y coordinates in pixels from the top left corner) The XYZ coordinates returned are given with respect to the RoboDK station(absolute reference). If no coordinates are provided, the current position of the cursor is retrieved. More...
 
QString License ()
 Returns the license as a readable string (same name shown in the RoboDK's title bar, on top of the main menu). More...
 
QList< ItemSelection ()
 Returns the list of items selected (it can be one or more items). More...
 
void setSelection (QList< Item > list_items)
 Sets the selection in the tree (it can be one or more items). More...
 
void PluginLoad (const QString &pluginName, int load=1)
 Load or unload the specified plugin (path to DLL, dylib or SO file). If the plugin is already loaded it will unload the plugin and reload it. Pass an empty plugin_name to reload all plugins. More...
 
QString PluginCommand (const QString &pluginName, const QString &pluginCommand, const QString &pluginValue="")
 Send a specific command to a RoboDK plugin. The command and value (optional) must be handled by your plugin. It returns the result as a string. More...
 
Item Popup_ISO9283_CubeProgram (Item *robot=nullptr, tXYZ center=nullptr, double side=-1, bool blocking=true)
 Show the popup menu to create the ISO9283 path for position accuracy, repeatability and path accuracy performance testing. More...
 
bool FileSet (const QString &file_local, const QString &file_remote="", bool load_file=true, Item *attach_to=nullptr)
 Send file from the current location to the RoboDK instance. More...
 
bool FileGet (const QString &path_file_local, Item *station=nullptr, const QString path_file_remote="")
 Retrieve a file from the RoboDK running instance. More...
 
bool EmbedWindow (QString window_name, QString docked_name="", int size_w=-1, int size_h=-1, quint64 pid=0, int area_add=1, int area_allowed=15, int timeout=500)
 
bool EventsListen ()
 
bool WaitForEvent (int &evt, Item &itm)
 
bool Event_Receive_3D_POS (double *data, int *valueCount)
 
bool Event_Receive_Mouse_data (int *data)
 
bool Event_Receive_Event_Moved (Mat *pose_rel_out)
 
bool Event_Connected ()
 

Private Member Functions

bool _connected ()
 
bool _connect ()
 
bool _connect_smart ()
 
void _disconnect ()
 
bool _check_connection ()
 
bool _check_status ()
 
bool _waitline (QTcpSocket *com=nullptr)
 
QString _recv_Line (QTcpSocket *com=nullptr)
 
bool _send_Line (const QString &string, QTcpSocket *com=nullptr)
 
int _recv_Int (QTcpSocket *com=nullptr)
 
bool _send_Int (const qint32 value, QTcpSocket *com=nullptr)
 
Item _recv_Item (QTcpSocket *com=nullptr)
 
bool _send_Item (const Item *item)
 
bool _send_Item (const Item &item)
 
Mat _recv_Pose (QTcpSocket *com=nullptr)
 
bool _send_Pose (const Mat &pose)
 
bool _recv_XYZ (tXYZ pos)
 
bool _send_XYZ (const tXYZ pos)
 
bool _recv_Array (double *values, int *psize=nullptr, QTcpSocket *com=nullptr)
 
bool _send_Array (const double *values, int nvalues)
 
bool _recv_Array (tJoints *jnts)
 
bool _send_Array (const tJoints *jnts)
 
bool _send_Array (const Mat *mat)
 
bool _recv_Matrix2D (tMatrix2D **mat)
 
bool _send_Matrix2D (tMatrix2D *mat)
 
void _moveX (const Item *target, const tJoints *joints, const Mat *mat_target, const Item *itemrobot, int movetype, bool blocking)
 
void _moveC (const Item *target1, const tJoints *joints1, const Mat *mat_target1, const Item *target2, const tJoints *joints2, const Mat *mat_target2, const Item *itemrobot, bool blocking)
 

Private Attributes

QTcpSocket * _COM
 
QTcpSocket * _COM_EVT
 
QString _IP
 
int _PORT
 
int _TIMEOUT
 
qint64 _PROCESS
 
QString _ROBODK_BIN
 
QString _ARGUMENTS
 

Friends

class RoboDK_API::Item
 

Detailed Description

This class is the iterface to the RoboDK API. With the RoboDK API you can automate certain tasks and operate on items. Interactions with items in the station tree are made through Items (IItem). An item is an object in the RoboDK tree (it can be either a robot, an object, a tool, a frame, a program, ...).

Definition at line 762 of file robodk_api.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Tree item types.

Enumerator
ITEM_TYPE_ANY 

Any item type.

ITEM_TYPE_STATION 

Item of type station (RDK file).

ITEM_TYPE_ROBOT 

Item of type robot (.robot file).

ITEM_TYPE_FRAME 

Item of type reference frame.

ITEM_TYPE_TOOL 

Item of type tool (.tool).

ITEM_TYPE_OBJECT 

Item of type object (.stl, .step or .iges for example).

ITEM_TYPE_TARGET 

Target item.

ITEM_TYPE_PROGRAM 

Program item.

ITEM_TYPE_INSTRUCTION 

Instruction.

ITEM_TYPE_PROGRAM_PYTHON 

Python macro.

ITEM_TYPE_MACHINING 

Robot machining project, curve follow, point follow or 3D printing project.

ITEM_TYPE_BALLBARVALIDATION 

Ballbar validation project.

ITEM_TYPE_CALIBPROJECT 

Robot calibration project.

ITEM_TYPE_VALID_ISO9283 

Robot path accuracy validation project.

Definition at line 1325 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Instruction types.

Enumerator
INS_TYPE_INVALID 

Invalid instruction.

INS_TYPE_MOVE 

Linear or joint movement instruction.

INS_TYPE_MOVEC 

Circular movement instruction.

INS_TYPE_CHANGESPEED 

Set speed instruction.

INS_TYPE_CHANGEFRAME 

Set reference frame instruction.

INS_TYPE_CHANGETOOL 

Set the tool (TCP) instruction.

INS_TYPE_CHANGEROBOT 

Set the robot instruction (obsolete).

INS_TYPE_PAUSE 

Pause instruction.

INS_TYPE_EVENT 

Simulation event instruction.

INS_TYPE_CODE 

Program call or raw code output.

INS_TYPE_PRINT 

Display message on the teach pendant.

Definition at line 1370 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Instruction program call type:

Enumerator
INSTRUCTION_CALL_PROGRAM 

Instruction to call a program.

INSTRUCTION_INSERT_CODE 

Instructio to insert raw code (this will not provoke a program call).

INSTRUCTION_START_THREAD 

Instruction to start a parallel thread. Program execution will continue and also trigger a thread.

INSTRUCTION_COMMENT 

Comment output.

INSTRUCTION_SHOW_MESSAGE 

Instruction to pop up a message on the robot teach pendant.

Definition at line 1553 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Object selection features:

Enumerator
FEATURE_NONE 

No selection.

FEATURE_SURFACE 

Surface selection.

FEATURE_CURVE 

Curve selection.

FEATURE_POINT 

Point selection.

Definition at line 1571 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Spray gun simulation:

Enumerator
SPRAY_OFF 

Activate the spray simulation.

Definition at line 1586 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Collision checking state.

Enumerator
COLLISION_OFF 

Do not use collision checking.

COLLISION_ON 

Use collision checking.

Definition at line 1593 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Definition at line 1602 of file robodk_api.h.

◆ anonymous enum

anonymous enum

RoboDK Window Flags.

Enumerator
FLAG_ROBODK_TREE_ACTIVE 

Allow using the RoboDK station tree.

FLAG_ROBODK_3DVIEW_ACTIVE 

Allow using the 3D navigation.

FLAG_ROBODK_LEFT_CLICK 

Allow left clicks on the 3D navigation screen.

FLAG_ROBODK_RIGHT_CLICK 

Allow right clicks on the 3D navigation screen.

FLAG_ROBODK_DOUBLE_CLICK 

Allow double clicks on the 3D navigation screen.

FLAG_ROBODK_MENU_ACTIVE 

Enable/display the menu bar.

FLAG_ROBODK_MENUFILE_ACTIVE 

Enable the file menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_MENUEDIT_ACTIVE 

Enable the edit menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_MENUPROGRAM_ACTIVE 

Enable the program menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_MENUTOOLS_ACTIVE 

Enable the tools menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_MENUUTILITIES_ACTIVE 

Enable the utilities menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_MENUCONNECT_ACTIVE 

Enable the connect menu (FLAG_ROBODK_MENU_ACTIVE must be allowed).

FLAG_ROBODK_WINDOWKEYS_ACTIVE 

Allow using keyboard shortcuts.

FLAG_ROBODK_NONE 

Disallow everything.

FLAG_ROBODK_ALL 

Allow everything (default).

FLAG_ROBODK_MENU_ACTIVE_ALL 

Allow using the full menu.

Definition at line 1618 of file robodk_api.h.

◆ anonymous enum

anonymous enum

RoboDK Item Flags.

Enumerator
FLAG_ITEM_SELECTABLE 

Allow selecting RoboDK items.

FLAG_ITEM_EDITABLE 

Allow modifying RoboDK items.

FLAG_ITEM_DRAGALLOWED 

Allow draggin an item.

FLAG_ITEM_DROPALLOWED 

Allow dropping to an item.

FLAG_ITEM_ENABLED 

Enable the item.

FLAG_ITEM_AUTOTRISTATE 

Allow having nested items, expand and collapse the item.

FLAG_ITEM_NOCHILDREN 

Do not allow adding nested items.

FLAG_ITEM_NONE 

Disallow everything.

FLAG_ITEM_ALL 

Allow everything (default).

Definition at line 1669 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Movement types.

Enumerator
MOVE_TYPE_INVALID 

Invalid robot movement.

MOVE_TYPE_JOINT 

Joint axes movement (MoveJ).

MOVE_TYPE_LINEAR 

Linear movement (MoveL).

MOVE_TYPE_CIRCULAR 

Circular movement (MoveC).

Definition at line 1406 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Script execution types used by IRoboDK.setRunMode and IRoboDK.RunMode.

Enumerator
RUNMODE_SIMULATE 

Performs the simulation moving the robot (default)

RUNMODE_QUICKVALIDATE 

Performs a quick check to validate the robot movements.

RUNMODE_MAKE_ROBOTPROG 

Makes the robot program.

RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD 

Makes the robot program and updates it to the robot.

RUNMODE_MAKE_ROBOTPROG_AND_START 

Makes the robot program and starts it on the robot (independently from the PC).

RUNMODE_RUN_ROBOT 

Moves the real robot from the PC (PC is the client, the robot behaves like a server).

Definition at line 1421 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Program execution type.

Enumerator
PROGRAM_RUN_ON_SIMULATOR 

Set the robot program to run on the simulator.

PROGRAM_RUN_ON_ROBOT 

Set the robot program to run on the robot.

Definition at line 1442 of file robodk_api.h.

◆ anonymous enum

anonymous enum

TCP calibration types.

Enumerator
CALIBRATE_TCP_BY_POINT 

Calibrate the TCP by poses touching the same point.

CALIBRATE_TCP_BY_PLANE 

Calibrate the TCP by poses touching the same plane.

Definition at line 1451 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Reference frame calibration types.

Enumerator
CALIBRATE_FRAME_3P_P1_ON_X 

Calibrate by 3 points: [X, X+, Y+] (p1 on X axis).

CALIBRATE_FRAME_3P_P1_ORIGIN 

Calibrate by 3 points: [Origin, X+, XY+] (p1 is origin).

CALIBRATE_FRAME_6P 

Calibrate by 6 points.

CALIBRATE_TURNTABLE 

Calibrate turntable.

Definition at line 1461 of file robodk_api.h.

◆ anonymous enum

anonymous enum

projection types (for AddCurve)

Enumerator
PROJECTION_NONE 

No curve projection.

PROJECTION_CLOSEST 

The projection will the closest point on the surface.

PROJECTION_ALONG_NORMAL 

The projection will be done along the normal.

PROJECTION_ALONG_NORMAL_RECALC 

The projection will be done along the normal. Furthermore, the normal will be recalculated according to the surface normal.

PROJECTION_CLOSEST_RECALC 

The projection will be the closest point on the surface and the normals will be recalculated.

PROJECTION_RECALC 

The normals are recalculated according to the surface normal of the closest projection. The points are not changed.

Definition at line 1476 of file robodk_api.h.

◆ anonymous enum

anonymous enum

Euler type.

Enumerator
JOINT_FORMAT 

joints.

EULER_RX_RYp_RZpp 

Staubli, Mecademic.

EULER_RZ_RYp_RXpp 

ABB RobotStudio.

EULER_RZ_RYp_RZpp 

Kawasaki, Adept, Staubli.

EULER_RZ_RXp_RZpp 

CATIA, SolidWorks.

EULER_RX_RY_RZ 

Fanuc, Kuka, Motoman, Nachi.

EULER_RZ_RY_RX 

CRS.

EULER_QUEATERNION 

ABB Rapid.

Definition at line 1497 of file robodk_api.h.

◆ anonymous enum

anonymous enum

State of the RoboDK window.

Enumerator
WINDOWSTATE_HIDDEN 

Hide the RoboDK window. RoboDK will keep running as a process.

WINDOWSTATE_SHOW 

Display the RoboDK window.

WINDOWSTATE_MINIMIZED 

Minimize the RoboDK window.

WINDOWSTATE_NORMAL 

Display the RoboDK window in a normal state (not maximized)

WINDOWSTATE_MAXIMIZED 

Maximize the RoboDK Window.

WINDOWSTATE_FULLSCREEN 

Make the RoboDK window fullscreen.

WINDOWSTATE_CINEMA 

Display RoboDK in cinema mode (hide the toolbar and the menu).

WINDOWSTATE_FULLSCREEN_CINEMA 

Display RoboDK in cinema mode and fullscreen.

Definition at line 1525 of file robodk_api.h.

Constructor & Destructor Documentation

◆ RoboDK()

RoboDK ( const QString &  robodk_ip = "",
int  com_port = -1,
const QString &  args = "",
const QString &  path = "" 
)

Definition at line 2102 of file robodk_api.cpp.

◆ ~RoboDK()

~RoboDK ( )

Definition at line 2122 of file robodk_api.cpp.

Member Function Documentation

◆ _check_connection()

bool _check_connection ( )
private

Definition at line 3413 of file robodk_api.cpp.

◆ _check_status()

bool _check_status ( )
private

Definition at line 3424 of file robodk_api.cpp.

◆ _connect()

bool _connect ( )
private

Definition at line 3499 of file robodk_api.cpp.

◆ _connect_smart()

bool _connect_smart ( )
private

Definition at line 3465 of file robodk_api.cpp.

◆ _connected()

bool _connected ( )
private

Definition at line 3408 of file robodk_api.cpp.

◆ _disconnect()

void _disconnect ( )
private

Definition at line 3457 of file robodk_api.cpp.

◆ _moveC()

void _moveC ( const Item target1,
const tJoints joints1,
const Mat mat_target1,
const Item target2,
const tJoints joints2,
const Mat mat_target2,
const Item itemrobot,
bool  blocking 
)
private

Definition at line 3854 of file robodk_api.cpp.

◆ _moveX()

void _moveX ( const Item target,
const tJoints joints,
const Mat mat_target,
const Item itemrobot,
int  movetype,
bool  blocking 
)
private

Definition at line 3827 of file robodk_api.cpp.

◆ _recv_Array() [1/2]

bool _recv_Array ( double *  values,
int *  psize = nullptr,
QTcpSocket *  com = nullptr 
)
private

Definition at line 3732 of file robodk_api.cpp.

◆ _recv_Array() [2/2]

bool _recv_Array ( tJoints jnts)
private

Definition at line 3711 of file robodk_api.cpp.

◆ _recv_Int()

int _recv_Int ( QTcpSocket *  com = nullptr)
private

Definition at line 3580 of file robodk_api.cpp.

◆ _recv_Item()

Item _recv_Item ( QTcpSocket *  com = nullptr)
private

Definition at line 3606 of file robodk_api.cpp.

◆ _recv_Line()

QString _recv_Line ( QTcpSocket *  com = nullptr)
private

Definition at line 3554 of file robodk_api.cpp.

◆ _recv_Matrix2D()

bool _recv_Matrix2D ( tMatrix2D **  mat)
private

Definition at line 3774 of file robodk_api.cpp.

◆ _recv_Pose()

Mat _recv_Pose ( QTcpSocket *  com = nullptr)
private

Definition at line 3639 of file robodk_api.cpp.

◆ _recv_XYZ()

bool _recv_XYZ ( tXYZ  pos)
private

Definition at line 3680 of file robodk_api.cpp.

◆ _send_Array() [1/3]

bool _send_Array ( const double *  values,
int  nvalues 
)
private

Definition at line 3760 of file robodk_api.cpp.

◆ _send_Array() [2/3]

bool _send_Array ( const Mat mat)
private

Definition at line 3720 of file robodk_api.cpp.

◆ _send_Array() [3/3]

bool _send_Array ( const tJoints jnts)
private

Definition at line 3714 of file robodk_api.cpp.

◆ _send_Int()

bool _send_Int ( const qint32  value,
QTcpSocket *  com = nullptr 
)
private

Definition at line 3596 of file robodk_api.cpp.

◆ _send_Item() [1/2]

bool _send_Item ( const Item item)
private

Definition at line 3635 of file robodk_api.cpp.

◆ _send_Item() [2/2]

bool _send_Item ( const Item item)
private

Definition at line 3625 of file robodk_api.cpp.

◆ _send_Line()

bool _send_Line ( const QString &  string,
QTcpSocket *  com = nullptr 
)
private

Definition at line 3570 of file robodk_api.cpp.

◆ _send_Matrix2D()

bool _send_Matrix2D ( tMatrix2D mat)
private

Definition at line 3807 of file robodk_api.cpp.

◆ _send_Pose()

bool _send_Pose ( const Mat pose)
private

Definition at line 3666 of file robodk_api.cpp.

◆ _send_XYZ()

bool _send_XYZ ( const tXYZ  pos)
private

Definition at line 3699 of file robodk_api.cpp.

◆ _waitline()

bool _waitline ( QTcpSocket *  com = nullptr)
private

Definition at line 3542 of file robodk_api.cpp.

◆ AddCurve()

Item AddCurve ( tMatrix2D curvePoints,
Item referenceObject = nullptr,
bool  addToRef = false,
int  ProjectionType = PROJECTION_ALONG_NORMAL_RECALC 
)

Adds a curve provided point coordinates. The provided points must be a list of vertices. A vertex normal can be provided optionally.

Parameters
curve_pointsmatrix 3xN or 6xN -> N must be multiple of 3
reference_objectobject to add the curve and/or project the curve to the surface
add_to_refIf True, the curve will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projection_typeType of projection. For example: PROJECTION_ALONG_NORMAL_RECALC will project along the point normal and recalculate the normal vector on the surface projected.
Returns
added object/curve (null if failed)
Parameters
curvePointsmatrix 3xN or 6xN -> N must be multiple of 3
referenceObjectobject to add the curve and/or project the curve to the surface
addToRefIf True, the curve will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projectionTypeType of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.
Returns
added object/curve (use item.Valid() to check if item is valid.)

Definition at line 2474 of file robodk_api.cpp.

◆ AddFile()

Item AddFile ( const QString &  filename,
const Item parent = nullptr 
)

Loads a file and attaches it to parent. It can be any file supported by RoboDK.

Loads a file and attaches it to parent. It can be any file supported by robodk.

Parameters
filenameAbsolute path of the file.
parentParent to attach. Leave empty for new stations or to load an object at the station root.
Returns
Newly added object. Check with item.Valid() for a successful load.
Parameters
filenameabsolute path of the file
parentparent to attach. Leave empty for new stations or to load an object at the station root
Returns
Newly added object. Check with item.Valid() for a successful load

Definition at line 2401 of file robodk_api.cpp.

◆ AddFrame()

Item AddFrame ( const QString &  name,
Item itemparent = nullptr 
)

Adds a new Frame that can be referenced by a robot.

Parameters
nameName of the reference frame.
itemparentParent to attach to (such as the robot base frame).
Returns
The new reference frame created.
Parameters
namename of the reference frame
itemparentparent to attach to (such as the robot base frame)
Returns
the new reference frame created

Definition at line 2569 of file robodk_api.cpp.

◆ AddMachiningProject()

Item AddMachiningProject ( const QString &  name = "Curve follow settings",
Item itemrobot = nullptr 
)

Add a new robot machining project. Machining projects can also be used for 3D printing, following curves and following points. It returns the newly created Item containing the project settings. Tip: Use the macro /RoboDK/Library/Macros/MoveRobotThroughLine.py to see an example that creates a new "curve follow project" given a list of points to follow(Option 4).

Add a new robot machining project. Machining projects can also be used for 3D printing, following curves and following points. It returns the newly created :class:.IItem containing the project settings. Tip: Use the macro /RoboDK/Library/Macros/MoveRobotThroughLine.py to see an example that creates a new "curve follow project" given a list of points to follow(Option 4).

Parameters
nameName of the project settings.
itemrobotRobot to use for the project settings(optional). It is not required to specify the robot if only one robot or mechanism is available in the RoboDK station.
Returns
Parameters
nameName of the project settings
itemrobotRobot to use for the project settings(optional). It is not required to specify the robot if only one robot or mechanism is available in the RoboDK station.
Returns

Definition at line 2603 of file robodk_api.cpp.

◆ AddPoints()

Item AddPoints ( tMatrix2D points,
Item referenceObject = nullptr,
bool  addToRef = false,
int  ProjectionType = PROJECTION_ALONG_NORMAL_RECALC 
)

Adds a list of points to an object. The provided points must be a list of vertices. A vertex normal can be provided optionally.

Parameters
pointslist of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors)
reference_objectitem to attach the newly added geometry (optional)
add_to_refIf True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projection_typeType of projection.Use the PROJECTION_* flags.
Returns
added object/shape (0 if failed)
Parameters
pointslist of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors)
referenceObjectitem to attach the newly added geometry (optional)
addToRefIf True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projectionTypeType of projection.Use the PROJECTION_* flags.
Returns
added object/shape (0 if failed)

Definition at line 2495 of file robodk_api.cpp.

◆ AddProgram()

Item AddProgram ( const QString &  name,
Item itemrobot = nullptr 
)

Adds a new Frame that can be referenced by a robot.

Parameters
nameName of the program.
itemrobotRobot that will be used.
Returns
the new program created
Parameters
namename of the program
itemparentrobot that will be used
Returns
the new program created

Definition at line 2585 of file robodk_api.cpp.

◆ AddShape()

Item AddShape ( tMatrix2D trianglePoints,
Item addTo = nullptr,
bool  shapeOverride = false,
Color color = nullptr 
)

Adds a shape provided triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.

Parameters
trianglePointsList of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)
addToitem to attach the newly added geometry (optional). Leave empty to create a new object.
shapeOverrideSet to true to replace any other existing geometry
colorOptionally specify the color as RGBA [0-1]
Returns
Added or modified item
Parameters
trianglePointsList of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)
addToitem to attach the newly added geometry (optional). Leave empty to create a new object.
shapeOverrideSet to true to replace any other existing geometry
colorColor of the added shape
Returns
added object/shape (use item.Valid() to check if item is valid.)

Definition at line 2438 of file robodk_api.cpp.

◆ AddStation()

Item AddStation ( const QString &  name)

Add a new empty station. It returns the station item added.

Add a new empty station.

Parameters
nameName of the station (the title bar will be renamed to match the station name).
Parameters
nameName of the station
Returns
Newly created station IItem

Definition at line 2523 of file robodk_api.cpp.

◆ AddTarget()

Item AddTarget ( const QString &  name,
Item itemparent = nullptr,
Item itemrobot = nullptr 
)

Adds a new target that can be reached with a robot.

Parameters
nameName of the target.
itemparentParent to attach to (such as a frame).
itemrobotMain robot that will be used to go to self target.
Returns
the new target created
Parameters
namename of the target
itemparentparent to attach to (such as a frame)
itemrobotmain robot that will be used to go to self target
Returns
the new target created

Definition at line 2552 of file robodk_api.cpp.

◆ CalibrateReference()

Mat CalibrateReference ( tMatrix2D poses_joints,
int  method = CALIBRATE_FRAME_3P_P1_ON_X,
bool  use_joints = false,
Item robot = nullptr 
)

Calibrate a Reference Frame given a list of points or joint values. Important: If the robot is calibrated, provide joint values to maximize accuracy.

Parameters
jointspoints as a 3xN matrix or nDOFsxN) - List of points or a list of robot joints.
methodtype of algorithm(by point, plane, ...) CALIBRATE_FRAME_...
use_jointsuse points or joint values. The robot item must be provided if joint values is used.
robotRobot used for the identification (if using joint values).
Returns
Parameters
jointspoints as a 3xN matrix or nDOFsxN) - List of points or a list of robot joints
methodtype of algorithm(by point, plane, ...) CALIBRATE_FRAME_...
use_jointsuse points or joint values. The robot item must be provided if joint values is used.
robot
Returns

Definition at line 3026 of file robodk_api.cpp.

◆ CalibrateTool()

void CalibrateTool ( tMatrix2D poses_joints,
tXYZ  tcp_xyz,
int  format = EULER_RX_RY_RZ,
int  algorithm = CALIBRATE_TCP_BY_POINT,
Item robot = nullptr,
double *  error_stats = nullptr 
)

Calibrate a tool (TCP) given a number of points or calibration joints. Important: If the robot is calibrated, provide joint values to maximize accuracy.

Parameters
poses_jointsmatrix of poses in a given format or a list of joints
error_statsstats[mean, standard deviation, max] - Output error stats summary.
formatEuler format. Optionally, use JOINT_FORMAT and provide the robot.
algorithmtype of algorithm (by point, plane, ...)
robotRobot used for the identification (if using joint values).
Returns
TCP as [x, y, z] - calculated TCP
Parameters
poses_jointsmatrix of poses in a given format or a list of joints
error_statsstats[mean, standard deviation, max] - Output error stats summary
formatEuler format. Optionally, use JOINT_FORMAT and provide the robot.
algorithmtype of algorithm (by point, plane, ...)
robotRobot used for calibration (if using joint values)
Returns
TCP as [x, y, z] - calculated TCP

Definition at line 2997 of file robodk_api.cpp.

◆ Cam2D_Add()

Item Cam2D_Add ( const Item item_object,
const QString &  cam_params,
const Item cam_item = nullptr 
)

Add a simulated 2D or depth camera as an item. Use Delete to delete it.

Parameters
item_objectReference or object to attach the camera
cam_paramsCamera settings as described here: https://robodk.com/doc/en/PythonAPI/robodk.html#robodk.robolink.Robolink.Cam2D_Add
cam_itemProvide an existing camera item to modify it
Returns
Camera item

Definition at line 3106 of file robodk_api.cpp.

◆ Cam2D_SetParams()

int Cam2D_SetParams ( const QString &  cam_params,
const Item cam_item 
)

Set the camera parameters.

Parameters
cam_paramsCamera parameters: The same parameters that can be set using Cam2D_Add()
cam_itemCamera item
Returns
Returns 1 if success, 0 otherwise

Definition at line 3129 of file robodk_api.cpp.

◆ Cam2D_Snapshot()

int Cam2D_Snapshot ( const QString &  file_save_img,
const Item cam_item,
const QString &  params = "" 
)

Take a snapshot of a simulated camera and save it as an image.

Parameters
file_save_imgfile path to save. Formats supported include PNG, JPEG, TIFF, ...
cam_itemCamera item
paramsadditional options (use, "Grayscale", "Depth" or "Color" to modify the output of a camera snapshot)
Returns
Returns 1 if success, 0 otherwise

Definition at line 3116 of file robodk_api.cpp.

◆ CloseRoboDK()

void CloseRoboDK ( )

Closes RoboDK window and finishes RoboDK execution

Definition at line 2274 of file robodk_api.cpp.

◆ CloseStation()

void CloseStation ( )

Close the current station without asking to save.

Closes the current station without suggesting to save

Definition at line 2539 of file robodk_api.cpp.

◆ Collision()

int Collision ( Item  item1,
Item  item2 
)

Returns 1 if item1 and item2 collided. Otherwise returns 0.

Parameters
item1
item2
Returns
0 if no collisions are found.
Parameters
item1
item2
Returns

Definition at line 2789 of file robodk_api.cpp.

◆ CollisionLine()

bool CollisionLine ( tXYZ  p1,
tXYZ  p2 
)

Checks the collision between a line and any objects in the station. The line is composed by 2 points. Returns the collided item. Use Item.Valid() to check if there was a valid collision.

Parameters
p1Start point of the line (absolute coordinates).
p2End point of the line (absolute coordinates).
xyz_collisionCollided point.
Returns
True if collision found.

◆ Collisions()

int Collisions ( )

Returns the number of pairs of objects that are currently in a collision state.

Returns
0 if no collisions are found.
Returns

Definition at line 2775 of file robodk_api.cpp.

◆ Command()

QString Command ( const QString &  cmd,
const QString &  value = "" 
)

Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events.

Parameters
cmdCommand Name, such as Trace, Threads or Window.
valueComand value (optional, not all commands require a value)
Returns
Command result.
Parameters
cmdCommand Name, such as Trace, Threads or Window.
valueComand value (optional, not all commands require a value)
Returns

Definition at line 2938 of file robodk_api.cpp.

◆ Connect()

bool Connect ( )

Definition at line 2145 of file robodk_api.cpp.

◆ Connected()

bool Connected ( )

Definition at line 2141 of file robodk_api.cpp.

◆ Copy()

void Copy ( const Item tocopy)

Makes a copy of an item (same as Ctrl+C), which can be pasted (Ctrl+V) using Paste().

Parameters
tocopyItem to copy

Definition at line 2374 of file robodk_api.cpp.

◆ Disconnect()

void Disconnect ( )

Disconnect from the RoboDK API. This flushes any pending program generation.

Returns

Definition at line 2152 of file robodk_api.cpp.

◆ EmbedWindow()

bool EmbedWindow ( QString  window_name,
QString  docked_name = "",
int  size_w = -1,
int  size_h = -1,
quint64  pid = 0,
int  area_add = 1,
int  area_allowed = 15,
int  timeout = 500 
)

Definition at line 3319 of file robodk_api.cpp.

◆ Event_Connected()

bool Event_Connected ( )

Definition at line 3401 of file robodk_api.cpp.

◆ Event_Receive_3D_POS()

bool Event_Receive_3D_POS ( double *  data,
int *  valueCount 
)

Definition at line 3375 of file robodk_api.cpp.

◆ Event_Receive_Event_Moved()

bool Event_Receive_Event_Moved ( Mat pose_rel_out)

Definition at line 3388 of file robodk_api.cpp.

◆ Event_Receive_Mouse_data()

bool Event_Receive_Mouse_data ( int *  data)

Definition at line 3380 of file robodk_api.cpp.

◆ EventsListen()

bool EventsListen ( )

Definition at line 3341 of file robodk_api.cpp.

◆ FileGet()

bool FileGet ( const QString &  path_file_local,
Item station = nullptr,
const QString  path_file_remote = "" 
)

Retrieve a file from the RoboDK running instance.

Definition at line 3296 of file robodk_api.cpp.

◆ FileSet()

bool FileSet ( const QString &  file_local,
const QString &  file_remote = "",
bool  load_file = true,
Item attach_to = nullptr 
)

Send file from the current location to the RoboDK instance.

Definition at line 3269 of file robodk_api.cpp.

◆ Finish()

void Finish ( )

Disconnect from the RoboDK API. This flushes any pending program generation.

Returns

Definition at line 2159 of file robodk_api.cpp.

◆ getActiveStation()

Item getActiveStation ( )

Returns the active station item (station currently visible).

Returns the active station item (station currently visible)

Returns

Definition at line 2635 of file robodk_api.cpp.

◆ getCollisionItems()

QList< Item > getCollisionItems ( QList< int >  link_id_list)

Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state.

Parameters
link_id_listList of robot link IDs that are in collision (0 for objects and tools).
Returns
List of items that are in a collision state.

Definition at line 2799 of file robodk_api.cpp.

◆ getCursorXYZ()

Item getCursorXYZ ( int  x = -1,
int  y = -1,
tXYZ  xyzStation = nullptr 
)

Returns the position of the cursor as XYZ coordinates (by default), or the 3D position of a given set of 2D coordinates of the window (x & y coordinates in pixels from the top left corner) The XYZ coordinates returned are given with respect to the RoboDK station(absolute reference). If no coordinates are provided, the current position of the cursor is retrieved.

Parameters
xX coordinate in pixels
yY coordinate in pixels
xyzStation
Returns
Item under the mouse cursor.

Definition at line 3139 of file robodk_api.cpp.

◆ getFlagsItem()

int getFlagsItem ( Item  item)

Retrieve current item flags. Item flags allow defining how much access the user has to item-specific features. Use FLAG_ITEM_* flags to set one or more flags.

Parameters
item
Returns

Definition at line 2337 of file robodk_api.cpp.

◆ getItem()

Item getItem ( QString  name,
int  itemtype = -1 
)

Returns an item by its name. If there is no exact match it will return the last closest match.

Parameters
nameItem name
itemtypeFilter by item type RoboDK.ITEM_TYPE_...
Returns
Item or nullptr if no item was found
Parameters
nameItem name
typeFilter by item type RoboDK.ITEM_TYPE_...
Returns

Definition at line 2171 of file robodk_api.cpp.

◆ getItemList()

QList< Item > getItemList ( int  filter = -1)

Returns a list of items (list of names or pointers) of all available items in the currently open station in RoboDK. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_CASE_ROBOT))

Returns a list of items (list of name or pointers) of all available items in the currently open station in robodk. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_CASE_ROBOT))

Parameters
filterITEM_TYPE
Returns
List of items with a match
Parameters
filterITEM_TYPE
Returns

Definition at line 2215 of file robodk_api.cpp.

◆ getItemListNames()

QStringList getItemListNames ( int  filter = -1)

Returns a list of items (list of names or Items) of all available items in the currently open station in RoboDK. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_TYPE_ROBOT))

Returns a list of items (list of name or pointers) of all available items in the currently open station in robodk. Optionally, use a filter to return specific items (example: getItemListNames(filter = ITEM_CASE_ROBOT))

Parameters
filterITEM_TYPE_...
Returns
List of item names
Parameters
filterITEM_TYPE
Returns

Definition at line 2192 of file robodk_api.cpp.

◆ getOpenStation()

QList< Item > getOpenStation ( )

Returns the list of open stations in RoboDK.

Returns

Definition at line 2616 of file robodk_api.cpp.

◆ getParam()

QString getParam ( const QString &  param)

Gets a global or a user parameter from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" Some available parameters: PATH_OPENSTATION = folder path of the current .stn file FILE_OPENSTATION = file path of the current .stn file PATH_DESKTOP = folder path of the user's folder Other parameters can be added or modified by the user

Parameters
paramRoboDK parameter
Returns
Parameter value.
Parameters
paramRoboDK parameter
Returns
value

Definition at line 2905 of file robodk_api.cpp.

◆ getParams()

QList< QPair< QString, QString > > getParams ( )

Gets all the user parameters from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" User parameters can be added or modified by the user

Returns
List of pairs of strings as parameter-value (list of a list)
Returns
list of pairs of strings as parameter-value (list of a list)

Definition at line 2880 of file robodk_api.cpp.

◆ HideRoboDK()

void HideRoboDK ( )

Hides the RoboDK window. RoboDK will continue running in the background.

Hides the RoboDK window

Definition at line 2265 of file robodk_api.cpp.

◆ IsInside()

bool IsInside ( Item  object_inside,
Item  object_parent 
)

Check if an object is fully inside another one.

Returns (1/True) if object_inside is inside the object_parent

Parameters
object_inside
object_parent
Returns
Returns true if object_inside is inside the object_parent
Parameters
object_inside
object_parent
Returns

Definition at line 2724 of file robodk_api.cpp.

◆ ItemUserPick()

Item ItemUserPick ( const QString &  message = "Pick one item",
int  itemtype = -1 
)

Shows a RoboDK popup to select one object from the open RoboDK station. An item type can be specified to filter desired items. If no type is specified, all items are selectable.

Shows a RoboDK popup to select one object from the open station. An item type can be specified to filter desired items. If no type is specified, all items are selectable.

Parameters
messageMessage to show in the pop up
itemtypeoptionally filter by RoboDK.ITEM_TYPE_*
Returns
Picked item or nullptr if the user selected Cancel
Parameters
messageMessage to pop up
itemtypeoptionally filter by RoboDK.ITEM_TYPE_*
Returns

Definition at line 2241 of file robodk_api.cpp.

◆ LaserTrackerMeasure()

bool LaserTrackerMeasure ( tXYZ  xyz,
tXYZ  estimate,
bool  search = false 
)

Takes a laser tracker measurement with respect to its own reference frame. If an estimate point is provided, the laser tracker will first move to those coordinates. If search is True, the tracker will search for a target.

Parameters
xyz
estimate
searchTrue to search near the estimated value.
Returns
True if successful.

Definition at line 2948 of file robodk_api.cpp.

◆ License()

QString License ( )

Returns the license as a readable string (same name shown in the RoboDK's title bar, on top of the main menu).

-------------------------------— add get/set robot parameters

Returns

Returns the license string (as shown in the RoboDK main window)

Returns

Definition at line 3166 of file robodk_api.cpp.

◆ Paste()

Item Paste ( const Item paste_to = nullptr)

Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy(). It returns the newly created item.

Parameters
paste_toItem to attach the copied item (optional)
Returns
New item created

Definition at line 2386 of file robodk_api.cpp.

◆ PluginCommand()

QString PluginCommand ( const QString &  pluginName,
const QString &  pluginCommand,
const QString &  pluginValue = "" 
)

Send a specific command to a RoboDK plugin. The command and value (optional) must be handled by your plugin. It returns the result as a string.

Definition at line 3219 of file robodk_api.cpp.

◆ PluginLoad()

void PluginLoad ( const QString &  pluginName,
int  load = 1 
)

Load or unload the specified plugin (path to DLL, dylib or SO file). If the plugin is already loaded it will unload the plugin and reload it. Pass an empty plugin_name to reload all plugins.

Definition at line 3208 of file robodk_api.cpp.

◆ Popup_ISO9283_CubeProgram()

Item Popup_ISO9283_CubeProgram ( Item robot = nullptr,
tXYZ  center = nullptr,
double  side = -1,
bool  blocking = true 
)

Show the popup menu to create the ISO9283 path for position accuracy, repeatability and path accuracy performance testing.

Show the popup menu to create the ISO9283 path for path accuracy and performance testing

Parameters
robot
centerXYZ position of the center of the cube with respect to the robot base, in mm.
sideCube side, in mm.
Returns
IS9283 Program or nullptr if the user cancelled.
Returns
IS9283 Program

Definition at line 3235 of file robodk_api.cpp.

◆ ProcessID()

quint64 ProcessID ( )

Definition at line 2126 of file robodk_api.cpp.

◆ ProgramStart()

int ProgramStart ( const QString &  progname,
const QString &  defaultfolder = "",
const QString &  postprocessor = "",
Item robot = nullptr 
)

Defines the name of the program when the program is generated. It is also possible to specify the name of the post processor as well as the folder to save the program. This method must be called before any program output is generated (before any robot movement or other instruction).

Parameters
prognameName of the program.
defaultfolderFolder to save the program, leave empty to use the default program folder.
postprocessorName of the post processor (for a post processor in C:/RoboDK/Posts/Fanuc_post.py it is possible to provide "Fanuc_post.py" or simply "Fanuc_post").
robotRobot to link.
Returns

Definition at line 3041 of file robodk_api.cpp.

◆ ProjectPoints()

void ProjectPoints ( tMatrix2D points,
tMatrix2D **  projected,
Item  objectProject,
int  ProjectionType = PROJECTION_ALONG_NORMAL_RECALC 
)

Projects a point given its coordinates. The provided points must be a list of [XYZ] coordinates. Optionally, a vertex normal can be provided [XYZijk].

Parameters
pointsMatrix 3xN or 6xN: list of points to project.
projectedProjected points as a null/empty matrix. A new matrix will be created
object_projectObject to project.
projection_typeType of projection. For example: PROJECTION_ALONG_NORMAL_RECALC will project along the point normal and recalculate the normal vector on the surface projected.

Definition at line 2507 of file robodk_api.cpp.

◆ Render()

void Render ( bool  always_render = false)

Update the scene.

Renders the scene. This function turns off rendering unless always_render is set to true.

Parameters
flagsSet to RenderComplete for a full update or RenderScreen to redraw the scene without internally updating dependencies.
Parameters
always_render

Definition at line 2698 of file robodk_api.cpp.

◆ RunCode()

int RunCode ( const QString &  code,
bool  code_is_fcn_call = false 
)

Adds code to run in the program output. If the program exists it will also run the program in simulation mode.

Adds code to run in the program output. If the program exists it will also run the program in simulate mode.

Parameters
code
code_is_fcn_call
Returns

Definition at line 2671 of file robodk_api.cpp.

◆ RunMessage()

void RunMessage ( const QString &  message,
bool  message_is_comment = false 
)

Shows a message or a comment in the output robot program.

Parameters
message
message_is_comment

Definition at line 2686 of file robodk_api.cpp.

◆ RunMode()

int RunMode ( )

Returns the behavior of the RoboDK API. By default, RoboDK shows the path simulation for movement instructions (run_mode=1).

Returns the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (run_mode=1)

Returns
int = RUNMODE RUNMODE_SIMULATE=1 performs the simulation moving the robot (default) RUNMODE_QUICKVALIDATE=2 performs a quick check to validate the robot movements RUNMODE_MAKE_ROBOTPROG=3 makes the robot program RUNMODE_RUN_REAL=4 moves the real robot is it is connected

Definition at line 2867 of file robodk_api.cpp.

◆ RunProgram()

int RunProgram ( const QString &  function_w_params)

Adds a function call in the program output. RoboDK will handle the syntax when the code is generated for a specific robot. If the program exists it will also run the program in simulate mode.

Parameters
function_w_paramsFunction name with parameters (if any).
Returns
Parameters
function_w_paramsFunction name with parameters (if any)
Returns

Definition at line 2661 of file robodk_api.cpp.

◆ Save()

void Save ( const QString &  filename,
const Item itemsave = nullptr 
)

Save an item to a file. If no item is provided, the open station is saved.

Parameters
filenameAbsolute path to save the file
itemsaveObject or station to save. Leave empty to automatically save the current station.
Parameters
filenameabsolute path to save the file
itemsaveobject or station to save. Leave empty to automatically save the current station.

Definition at line 2418 of file robodk_api.cpp.

◆ Selection()

QList< Item > Selection ( )

Returns the list of items selected (it can be one or more items).

Returns the list of items selected (it can be one or more items)

Returns
List of selected items.
Returns

Definition at line 3178 of file robodk_api.cpp.

◆ setActiveStation()

void setActiveStation ( Item  station)

Set the active station (project currently visible).

Set the active station (project currently visible)

Parameters
stationstation item, it can be previously loaded as an RDK file.
Parameters
stationstation item, it can be previously loaded as an RDK file

Definition at line 2647 of file robodk_api.cpp.

◆ setCollisionActive()

int setCollisionActive ( int  check_state = COLLISION_ON)

Turn collision checking ON or OFF (COLLISION_OFF/COLLISION_OFF) according to the collision map. If collision checking is activated it returns the number of pairs of objects that are currently in a collision state.

Set collision checking ON or OFF (COLLISION_OFF/COLLISION_OFF) according to the collision map. If collision check is activated it returns the number of pairs of objects that are currently in a collision state.

Parameters
check_state
Returns
Number of pairs of objects in a collision state (0 if no collisions).
Parameters
check_state
Returns
Number of pairs of objects in a collision state

Definition at line 2739 of file robodk_api.cpp.

◆ setCollisionActivePair()

bool setCollisionActivePair ( int  check_state,
Item  item1,
Item  item2,
int  id1 = 0,
int  id2 = 0 
)

Set collision checking ON or OFF (COLLISION_ON/COLLISION_OFF) for a specific pair of objects. This allows altering the collision map for Collision checking. Specify the link id for robots or moving mechanisms (id 0 is the base).

Parameters
check_stateSet to COLLISION_ON or COLLISION_OFF
item1Item 1
item2Item 2
id1Joint id for Item 1 (if Item 1 is a robot or a mechanism)
id2Joint id for Item 2 (if Item 2 is a robot or a mechanism)
Returns
Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided)

Definition at line 2758 of file robodk_api.cpp.

◆ setFlagsItem()

void setFlagsItem ( Item  item,
int  flags = FLAG_ITEM_ALL 
)

Update item flags. Item flags allow defining how much access the user has to item-specific features. Use FLAG_ITEM_* flags to set one or more flags.

Parameters
item
flagsNew flags
Parameters
item
flags

Definition at line 2324 of file robodk_api.cpp.

◆ setFlagsRoboDK()

void setFlagsRoboDK ( int  flags = FLAG_ROBODK_ALL)

Update the RoboDK flags. RoboDK flags allow defining how much access the user has to certain RoboDK features. Use FLAG_ROBODK_* variables to set one or more flags.

Update the RoboDK flags. RoboDK flags allow defining how much access the user has to RoboDK features. Use FLAG_ROBODK_* variables to set one or more flags.

Parameters
flagsstate of the window(FLAG_ROBODK_*)

Definition at line 2312 of file robodk_api.cpp.

◆ setParam()

void setParam ( const QString &  param,
const QString &  value 
)

Sets a global parameter from the RoboDK station. If the parameters exists, it will be modified. If not, it will be added to the station. The parameters can also be modified by right clicking the station and selecting "shared parameters".

Sets a global parameter from the RoboDK station. If the parameters exists, it will be modified. If not, it will be added to the station. The parameters can also be modified by right clicking the station and selecting "shared parameters"

Parameters
paramRoboDK parameter
valuevalue
Returns

Definition at line 2924 of file robodk_api.cpp.

◆ setRobotParams()

bool setRobotParams ( Item robot,
tMatrix2D  dhm,
Mat  poseBase,
Mat  poseTool 
)

Set the nominal robot parameters.

Parameters
robot
dhmD-H Modified table (Denavit Hartenberg Modified)
poseBase
poseTool
Returns

◆ setRunMode()

void setRunMode ( int  run_mode = 1)

Sets the behavior of the RoboDK API. By default, RoboDK shows the path simulation for movement instructions (run_mode=1=RUNMODE_SIMULATE). Setting the run_mode to RUNMODE_QUICKVALIDATE allows performing a quick check to see if the path is feasible. if robot.Connect() is used, RUNMODE_RUN_FROM_PC is selected automatically.

Sets the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (run_mode=1=RUNMODE_SIMULATE). Setting the run_mode to RUNMODE_QUICKVALIDATE allows performing a quick check to see if the path is feasible. if robot.Connect() is used, RUNMODE_RUN_FROM_PC is selected automatically.

Parameters
run_modeint = RUNMODE RUNMODE_SIMULATE=1 performs the simulation moving the robot (default) RUNMODE_QUICKVALIDATE=2 performs a quick check to validate the robot movements RUNMODE_MAKE_ROBOTPROG=3 makes the robot program RUNMODE_RUN_REAL=4 moves the real robot is it is connected

Definition at line 2852 of file robodk_api.cpp.

◆ setSelection()

void setSelection ( QList< Item list_items)

Sets the selection in the tree (it can be one or more items).

Returns
List of items to set as selected

Definition at line 3194 of file robodk_api.cpp.

◆ setSimulationSpeed()

void setSimulationSpeed ( double  speed)

Sets the current simulation speed. Set the speed to 1 for a real-time simulation. The slowest speed allowed is 0.001 times the real speed. Set to a high value (>100) for fast simulation results.

Parameters
speedSimulation speed ratio (1 means real time simulation)
Parameters
speed

Definition at line 2824 of file robodk_api.cpp.

◆ setViewPose()

void setViewPose ( const Mat pose)

Set the pose of the wold reference frame with respect to the user view (camera/screen).

Set the pose of the wold reference frame with respect to the view (camera/screen)

Parameters
poseView pose.
Parameters
pose

Definition at line 3057 of file robodk_api.cpp.

◆ setWindowState()

void setWindowState ( int  windowstate = WINDOWSTATE_NORMAL)

Set the state of the RoboDK window

Parameters
windowstate

Definition at line 2300 of file robodk_api.cpp.

◆ ShowAsCollided()

void ShowAsCollided ( QList< Item itemList,
QList< bool >  collidedList,
QList< int > *  robot_link_id = nullptr 
)

Show a list of items as collided.

Definition at line 2963 of file robodk_api.cpp.

◆ ShowMessage()

void ShowMessage ( const QString &  message,
bool  popup = true 
)

Show a message in RoboDK (it can be blocking or non blocking in the status bar)

Parameters
messageMessage to display
popupSet to true to make the message blocking or set to false to make it non blocking

Definition at line 2351 of file robodk_api.cpp.

◆ ShowRoboDK()

void ShowRoboDK ( )

Shows or raises the RoboDK window.

Shows or raises the RoboDK window

Definition at line 2256 of file robodk_api.cpp.

◆ SimulationSpeed()

double SimulationSpeed ( )

Gets the current simulation speed. Set the speed to 1 for a real-time simulation.

Returns
Simulation speed ratio (1 means real time simulation)
Returns

Definition at line 2835 of file robodk_api.cpp.

◆ Update()

void Update ( )

Update the screen. This updates the position of all robots and internal links according to previously set values.

Definition at line 2710 of file robodk_api.cpp.

◆ Version()

QString Version ( )

Return the vesion of RoboDK as a 4 digit string: Major.Minor.Revision.Build

Definition at line 2282 of file robodk_api.cpp.

◆ ViewPose()

Mat ViewPose ( )

Get the pose of the wold reference frame with respect to the user view (camera/screen).

Get the pose of the wold reference frame with respect to the view (camera/screen)

Returns
View pose.
Parameters
pose

Definition at line 3068 of file robodk_api.cpp.

◆ WaitForEvent()

bool WaitForEvent ( int &  evt,
Item itm 
)

Definition at line 3367 of file robodk_api.cpp.

◆ WindowID()

quint64 WindowID ( )

Definition at line 2134 of file robodk_api.cpp.

Friends And Related Function Documentation

◆ RoboDK_API::Item

friend class RoboDK_API::Item
friend

Definition at line 763 of file robodk_api.h.

Member Data Documentation

◆ _ARGUMENTS

QString _ARGUMENTS
private

Definition at line 1708 of file robodk_api.h.

◆ _COM

QTcpSocket* _COM
private

Definition at line 1700 of file robodk_api.h.

◆ _COM_EVT

QTcpSocket* _COM_EVT
private

Definition at line 1701 of file robodk_api.h.

◆ _IP

QString _IP
private

Definition at line 1702 of file robodk_api.h.

◆ _PORT

int _PORT
private

Definition at line 1703 of file robodk_api.h.

◆ _PROCESS

qint64 _PROCESS
private

Definition at line 1705 of file robodk_api.h.

◆ _ROBODK_BIN

QString _ROBODK_BIN
private

Definition at line 1707 of file robodk_api.h.

◆ _TIMEOUT

int _TIMEOUT
private

Definition at line 1704 of file robodk_api.h.


The documentation for this class was generated from the following files: