Show / Hide Table of Contents

Class RoboDK

This class is the link to allows to create macros and automate RoboDK. Any interaction is made through "items" (IItem() objects). An item is an object in the RoboDK tree (it can be either a robot, an object, a tool, a frame, a program, ...).

Inheritance
object
RoboDK
Implements
IRoboDK
IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace:RoboDk.API
Assembly: RoboDkApi.dll
Syntax
public class RoboDK : IRoboDK, IDisposable

Constructors

|Improve this Doc View Source

RoboDK()

Creates a link with RoboDK

Declaration
public RoboDK()

Fields

|Improve this Doc View Source

FILE_OPENSTATION

Declaration
public const string FILE_OPENSTATION = "FILE_OPENSTATION"
Field Value
Type Description
string
|Improve this Doc View Source

PATH_DESKTOP

Declaration
public const string PATH_DESKTOP = "PATH_DESKTOP"
Field Value
Type Description
string
|Improve this Doc View Source

PATH_OPENSTATION

Declaration
public const string PATH_OPENSTATION = "PATH_OPENSTATION"
Field Value
Type Description
string

Properties

|Improve this Doc View Source

ApiVersion

RoboDK API protocol version.

Declaration
public int ApiVersion { get; }
Property Value
Type Description
int
|Improve this Doc View Source

ApplicationDir

Filepath to the RoboDK.exe. Typically C:/RoboDK/bin/RoboDK.exe. Leave empty to use the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\RoboDK

Declaration
public string ApplicationDir { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

AutoUpdate

If AUTO_UPDATE is 1, updating and rendering objects the 3D the scene will be delayed until 100 ms after the last call. This value can be changed in Tools-Options-Other-API Render delay, or using the RoboDK.Command('AutoRenderDelay', value) and RoboDK.Command('AutoRenderDelayMax', value)

Declaration
public bool AutoUpdate { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

CustomCommandLineArgumentString

The custom command line options will be appended to the standard command line argument string returned by RoboDkCommandLineParameter.CommandLineArgumentString. See//www.sinclairbody.com/doc/en/RoboDK-API.html#CommandLine

Declaration
public string CustomCommandLineArgumentString { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

DefaultApiServerPort

Declaration
public int DefaultApiServerPort { get; }
Property Value
Type Description
int
|Improve this Doc View Source

DefaultSocketTimeoutMilliseconds

Default Socket send / receive timeout in milliseconds: 10 seconds

Declaration
public int DefaultSocketTimeoutMilliseconds { get; set; }
Property Value
Type Description
int
|Improve this Doc View Source

DoNotUseRecentlyUsedFileList

RoboDk.API.RoboDkCommandLineParameter.DoNotUseRecentlyUsedFileList

Declaration
public bool DoNotUseRecentlyUsedFileList { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

DoNotUseSettingsFile

RoboDk.API.RoboDkCommandLineParameter.DoNotUseSettingsFile

Declaration
public bool DoNotUseSettingsFile { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

EventChannelVersion

RoboDK Event protocol version.

Declaration
public int EventChannelVersion { get; set; }
Property Value
Type Description
int
|Improve this Doc View Source

ExitRoboDkAfterClosingLastApiConnection

RoboDk.API.RoboDkCommandLineParameter.ExitRoboDkAfterClosingLastApiConnection

Declaration
public bool ExitRoboDkAfterClosingLastApiConnection { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

Hidden

RoboDk.API.RoboDkCommandLineParameter.Hidden

Declaration
public bool Hidden { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

HideReferenceFrames

RoboDk.API.RoboDkCommandLineParameter.HideReferenceFrames

Declaration
public bool HideReferenceFrames { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

HideWindowsWhileLoadingNcFile

RoboDk.API.RoboDkCommandLineParameter.HideWindowsWhileLoadingNcFile

Declaration
public bool HideWindowsWhileLoadingNcFile { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

HideWindowWhileLoadingFiles

RoboDk.API.RoboDkCommandLineParameter.NoShow

Declaration
public bool HideWindowWhileLoadingFiles { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

ItemInterceptFunction

Declaration
public Func ItemInterceptFunction { get; set; }
Property Value
Type Description
Func<IItem,IItem>
|Improve this Doc View Source

LastStatusMessage

Declaration
public string LastStatusMessage { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

LoadSettingsFromFile

RoboDk.API.RoboDkCommandLineParameter.LoadSettingsFromFile

Declaration
public string LoadSettingsFromFile { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

Logfile

RoboDk.API.RoboDkCommandLineParameter.Logfile

Declaration
public string Logfile { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

Name

Name of the RoboDK instance. In case of multiple instances the name can help to identify the instance.

Declaration
public string Name { get; set; }
Property Value
Type Description
string
|Improve this Doc View Source

NoCommunicationToRoboDkServer

RoboDk.API.RoboDkCommandLineParameter.NoCommunicationToRoboDkServer

Declaration
public bool NoCommunicationToRoboDkServer { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

NoDebugOutput

RoboDk.API.RoboDkCommandLineParameter.NoDebugOutput

Declaration
public bool NoDebugOutput { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

NoSplash

RoboDk.API.RoboDkCommandLineParameter.NoSplash

Declaration
public bool NoSplash { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

NoUserInterface

RoboDk.API.RoboDkCommandLineParameter.NoUserInterface

Declaration
public bool NoUserInterface { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

Process

RoboDK.exe process.

Declaration
public Process Process { get; }
Property Value
Type Description
Process
|Improve this Doc View Source

RoboDKBuild

The RoboDK build id and is used for version checking. This value always increases with new versions

Declaration
public int RoboDKBuild { get; set; }
Property Value
Type Description
int
|Improve this Doc View Source

RoboDKClientPort

TCP Client Port

Declaration
public int RoboDKClientPort { get; }
Property Value
Type Description
int
|Improve this Doc View Source

RoboDKServerEndPort

Port to stop looking for a RoboDK connection.

Declaration
public int RoboDKServerEndPort { get; set; }
Property Value
Type Description
int
|Improve this Doc View Source

RoboDKServerIpAddress

Defines the RoboDK Simulator IP Address. Default: localhost (Client and RoboDK Server runs on same computer)

Declaration
公共字符串RoboDKServerIpAddress{得到;设置;}
Property Value
Type Description
string
|Improve this Doc View Source

RoboDKServerPort

TCP Server Port to which this instance is connected to.

Declaration
public int RoboDKServerPort { get; }
Property Value
Type Description
int
|Improve this Doc View Source

RoboDKServerStartPort

Port to start looking for a RoboDK connection.

Declaration
public int RoboDKServerStartPort { get; set; }
Property Value
Type Description
int
|Improve this Doc View Source

SafeMode

If True checks that provided items exist in memory and poses are homogeneous

Declaration
public bool SafeMode { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

StartHidden

RoboDk.API.RoboDkCommandLineParameter.StartHidden

Declaration
public bool StartHidden { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

StartNewInstance

RoboDk.API.RoboDkCommandLineParameter.StartNewInstance

Declaration
public bool StartNewInstance { get; set; }
Property Value
Type Description
bool
|Improve this Doc View Source

TreeState

RoboDk.API.RoboDkCommandLineParameter.TreeState

Declaration
public int TreeState { get; set; }
Property Value
Type Description
int

Methods

|Improve this Doc View Source

AddCurve(Mat, IItem, bool, ProjectionType)

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

Declaration
public IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type Name Description
Mat curvePoints

matrix 3xN or 6xN -> N must be multiple of 3

IItem referenceObject

object to add the curve and/or project the curve to the surface

bool addToRef

If True, the curve will be added as part of the object in the RoboDK item tree (a reference object must be provided)

ProjectionType projectionType

Type of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.

Returns
Type Description
IItem

added object/curve (use item.Valid() to check if item is valid.)

|Improve this Doc View Source

AddFile(string, IItem)

Load a file and attaches it to parent and returns the newly added IItem.

Declaration
public IItem AddFile(string filename, IItem parent = null)
Parameters
Type Name Description
string filename

Any file to load, supported by RoboDK. Supported formats include STL, STEP, IGES, ROBOT, TOOL, RDK,... It is also possible to load supported robot programs, such as SRC (KUKA), SCRIPT (Universal Robots), LS (Fanuc), JBI (Motoman), MOD (ABB), PRG (ABB), ...

IItem parent

item to attach the newly added object (optional)

Returns
Type Description
IItem
|Improve this Doc View Source

AddFrame(string, IItem)

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

Declaration
public IItem AddFrame(string name, IItem parent = null)
Parameters
Type Name Description
string name

name of the reference frame

IItem parent

parent to attach to (such as the robot base frame)

Returns
Type Description
IItem

The new reference frame created

|Improve this Doc View Source

AddMachiningProject(string, IItem)

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:.IItemcontaining 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).

Declaration
public IItem AddMachiningProject(string name = "Curve follow settings", IItem itemrobot = null)
Parameters
Type Name Description
string name

Name of the project settings

IItem itemrobot

Robot 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
Type Description
IItem
|Improve this Doc View Source

AddPoints(Mat, IItem, bool, ProjectionType)

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

Declaration
public IItem AddPoints(Mat points, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type Name Description
Mat points

list of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors)

IItem referenceObject

item to attach the newly added geometry (optional)

bool addToRef

If True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided)

ProjectionType projectionType

Type of projection.Use the PROJECTION_* flags.

Returns
Type Description
IItem

added object/shape (0 if failed)

|Improve this Doc View Source

AddProgram(string, IItem)

Add a new program to the RoboDK station. Programs can be used to simulate a specific sequence, to generate vendor specific programs (Offline Programming) or to run programs on the robot (Online Programming).

Declaration
public IItem AddProgram(string name, IItem robot = null)
Parameters
Type Name Description
string name

Name of the program

IItem robot

Robot that will be used for this program. It is not required to specify the robot if the station has only one robot or mechanism.

Returns
Type Description
IItem

Newly created Program IItem

|Improve this Doc View Source

AddShape(Mat, IItem, bool, Color?)

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

Declaration
public IItem AddShape(Mat trianglePoints, IItem addTo = null, bool shapeOverride = false, Color? color = null)
Parameters
Type Name Description
Mat trianglePoints

List of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)

IItem addTo

item to attach the newly added geometry (optional). Leave empty to create a new object.

bool shapeOverride

Set to true to replace any other existing geometry

Color? color

Color of the added shape

Returns
Type Description
IItem

added object/shape (use item.Valid() to check if item is valid.)

|Improve this Doc View Source

AddShape(List, IItem, bool, List)

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

Declaration
public IItem AddShape(List listTrianglePoints, IItem add_to = null, bool shape_override = false, List listColor = null)
Parameters
Type Name Description
List<Mat> listTrianglePoints

List of Mat objects. Each mat object is a list of vertices grouped by triangles of the same color (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)

IItem add_to
bool shape_override
List<Color> listColor

Optionally specify the color as RGBA [0-1] (list of same length as triangle_points_list)

Returns
Type Description
IItem
|Improve this Doc View Source

AddStation(string)

Add a new empty station.

Declaration
public IItem AddStation(string name)
Parameters
Type Name Description
string name

Name of the station

Returns
Type Description
IItem

Newly created station IItem

|Improve this Doc View Source

AddTarget(string, IItem, IItem)

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

Declaration
public IItem AddTarget(string name, IItem parent = null, IItem robot = null)
Parameters
Type Name Description
string name

Target name

IItem parent

Reference frame to attach the target

IItem robot

Robot that will be used to go to target (optional)

Returns
Type Description
IItem

Newly created target item.

|Improve this Doc View Source

AddTargetJ(IItem, string, double[], IItem, IItem)

Declaration
public IItem AddTargetJ(IItem pgm, string targetName, double[] joints, IItem robotBase = null, IItem robot = null)
Parameters
Type Name Description
IItem pgm
string targetName
double[] joints
IItem robotBase
IItem robot
Returns
Type Description
IItem
|Improve this Doc View Source

AddText(string, IItem)

Add Text to 3D View

Declaration
public IItem AddText(string text, IItem parent = null)
Parameters
Type Name Description
string text

Text to add to the scene

IItem parent

item to attach the newly added text object (optional)

Returns
Type Description
IItem
|Improve this Doc View Source

BuildMechanism(int, List, List, List, List, List, List, List, Mat, Mat, string, IItem)

Create a new robot or mechanism.

Declaration
public IItem BuildMechanism(int type, List listObj, List param, List jointsBuild, List jointsHome, List jointsSenses, List jointsLimLow, List jointsLimHigh, Mat baseFrame = null, Mat tool = null, string name = "New robot", IItem robot = null)
Parameters
Type Name Description
int type

Type of the mechanism

List<IItem> listObj
List<double> param

robot parameters in the same order as shown in the RoboDK menu: Utilities-Build Mechanism or robot

List<double> jointsBuild
List<double> jointsHome
List<double> jointsSenses
List<double> jointsLimLow
List<double> jointsLimHigh
Mat baseFrame
Mat tool

tool pose

string name

robot name (you can also use setName()

IItem robot

existing robot in the station to replace it (optional)

Returns
Type Description
IItem
|Improve this Doc View Source

CalibrateReference(Mat, ReferenceCalibrationType, bool, IItem)

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

Declaration
public Mat CalibrateReference(Mat joints, ReferenceCalibrationType method = ReferenceCalibrationType.Frame3P_P1OnX, bool useJoints = false, IItem robot = null)
Parameters
Type Name Description
Mat joints

points as a 3xN matrix or nDOFsxN) - List of points or a list of robot joints

ReferenceCalibrationType method

type of algorithm(by point, plane, ...)

bool useJoints

use points or joint values. The robot item must be provided if joint values is used.

IItem robot
Returns
Type Description
Mat

TODO: Document return value.

|Improve this Doc View Source

CalibrateTool(Mat, out double[], EulerType, TcpCalibrationType, IItem)

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

Declaration
公共双[]CalibrateTool(垫posesJoints,double[] errorStats, EulerType format = EulerType.EulerRxRyRz, TcpCalibrationType algorithm = TcpCalibrationType.CalibrateTcpByPoint, IItem robot = null)
Parameters
Type Name Description
Mat posesJoints

matrix of poses in a given format or a list of joints

double[] errorStats

stats[mean, standard deviation, max] - Output error stats summary

EulerType format

Euler format. Optionally, use EulerType.JointFormat and provide the robot.

TcpCalibrationType algorithm

type of algorithm (by point, plane, ...)

IItem robot

Robot used for calibration (if using joint values)

Returns
Type Description
double[]

TCP as [x, y, z] - calculated TCP

|Improve this Doc View Source

Cam2DAdd(IItem, string)

Open a simulated 2D camera view. Returns a handle pointer that can be used in case more than one simulated view is used.

Declaration
public long Cam2DAdd(IItem item, string cameraParameters = "")
Parameters
Type Name Description
IItem item

Reference frame or other object to attach the camera

string cameraParameters

Camera parameters as a string. Refer to the documentation for more information.

Returns
Type Description
long

Camera pointer/handle. Keep the handle if more than 1 simulated camera is used

|Improve this Doc View Source

Cam2DClose(long)

Closes all camera windows or one specific camera if the camera handle is provided.

Declaration
public bool Cam2DClose(long camHandle = 0)
Parameters
Type Name Description
long camHandle

Camera handle(pointer returned by Cam2DAdd). Leave to 0 to close all simulated views.

Returns
Type Description
bool

Returns true if success, false otherwise.

|Improve this Doc View Source

Cam2DSetParameters(string, long)

Set the parameters of the simulated camera.

Declaration
public bool Cam2DSetParameters(string cameraParameters, long camHandle = 0)
Parameters
Type Name Description
string cameraParameters

parameter settings according to the parameters supported by Cam2D_Add

long camHandle

camera handle (optional)

Returns
Type Description
bool

Returns true if success, false otherwise.

|Improve this Doc View Source

Cam2DSnapshot(string, long)

Take a snapshot from a simulated camera view and save it to a file.

Declaration
public bool Cam2DSnapshot(string fileSaveImg, long camHandle = 0)
Parameters
Type Name Description
string fileSaveImg

file path to save.Formats supported include PNG, JPEG, TIFF, ...

long camHandle

Camera handle(pointer returned by Cam2DAdd)

Returns
Type Description
bool

Return true if image has been saved successfully.

|Improve this Doc View Source

CloneRoboDkConnection(ConnectionType)

Open a new additional RoboDK Link to the same already existing RoboDK instance. NOTE: Use IItem.Clone() to use an already existing item on the new RoboDk connection.

Declaration
public IRoboDK CloneRoboDkConnection(RoboDK.ConnectionType connectionType = ConnectionType.Api)
Parameters
Type Name Description
RoboDK.ConnectionType connectionType
Returns
Type Description
IRoboDK

New RoboDK Link

|Improve this Doc View Source

CloseRoboDK()

Close RoboDK window and finish RoboDK process.

Declaration
public void CloseRoboDK()
|Improve this Doc View Source

CloseStation()

Closes the current station without suggesting to save

Declaration
public void CloseStation()
|Improve this Doc View Source

Collision(IItem, IItem, bool)

Check if item1 and item2 collided.

Declaration
public bool Collision(IItem item1, IItem item2, bool useCollisionMap = true)
Parameters
Type Name Description
IItem item1
IItem item2
bool useCollisionMap

Turn off collision map check to force collision checking even if it is not set in the collision map

Returns
Type Description
bool

Returns true if item1 collides with item2; false otherwise.

|Improve this Doc View Source

CollisionLine(double[], double[])

Checks the collision between a line and any objects in the station. The line is composed by 2 points.

Declaration
public bool CollisionLine(double[] p1, double[] p2)
Parameters
Type Name Description
double[] p1

Start point [x,y,z] of the line

double[] p2

End point [x,y,z] of the line

Returns
Type Description
bool

Return true if there is a collision; false otherwise

|Improve this Doc View Source

Collisions()

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

Declaration
public int Collisions()
Returns
Type Description
int

Number of pairs of objects in a collision state.

|Improve this Doc View Source

Color2Hex(Color)

Declaration
public static string Color2Hex(Color color)
Parameters
Type Name Description
Color color
Returns
Type Description
string
|Improve this Doc View Source

Command(string, bool)

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.

Declaration
public string Command(string cmd, bool value)
Parameters
Type Name Description
string cmd

Command Name, such as Trace, Threads or Window.

bool value

Command value

Returns
Type Description
string
|Improve this Doc View Source

Command(string, double)

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.

Declaration
public string Command(string cmd, double value)
Parameters
Type Name Description
string cmd

Command Name, such as Trace, Threads or Window.

double value

Command value

Returns
Type Description
string
|Improve this Doc View Source

Command(string, int)

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.

Declaration
public string Command(string cmd, int value)
Parameters
Type Name Description
string cmd

Command Name, such as Trace, Threads or Window.

int value

Command value

Returns
Type Description
string
|Improve this Doc View Source

Command(string, string)

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.

Declaration
public string Command(string cmd, string value = "")
Parameters
Type Name Description
string cmd

Command Name, such as Trace, Threads or Window.

string value

Comand value (optional, not all commands require a value)

Returns
Type Description
string
|Improve this Doc View Source

Connect()

Establish a connection with RoboDK. If RoboDK is not running it will attempt to start RoboDK from the default installation path. (otherwise APPLICATION_DIR must be set properly).

Declaration
public bool Connect()
Returns
Type Description
bool

If the connection succeeds it returns True, otherwise it returns False.

|Improve this Doc View Source

Connected()

Checks if the RoboDK Link is connected.

Declaration
public bool Connected()
Returns
Type Description
bool

True if connected; False otherwise

|Improve this Doc View Source

Copy(IItem, bool)

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

Declaration
public void Copy(IItem tocopy, bool copy_children = true)
Parameters
Type Name Description
IItem tocopy

Item to copy

bool copy_children

Set to false to prevent copying all items attached to this item

|Improve this Doc View Source

Delete(List)

Delete a list of items

Declaration
public void Delete(List item_list)
Parameters
Type Name Description
List<IItem> item_list
|Improve this Doc View Source

DisableCollisionCheckingForAllItems()

Set all pairs as NOT checking for collisions:

Declaration
public void DisableCollisionCheckingForAllItems()
|Improve this Doc View Source

Disconnect()

Stops the communication with RoboDK. If setRunMode is set to MakeRobotProgram for offline programming, any programs pending will be generated.

Declaration
public void Disconnect()
|Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
|Improve this Doc View Source

Dispose(bool)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing
|Improve this Doc View Source

EnableCollisionCheckingForAllItems()

Set all pairs as checking for collisions:

Declaration
public void EnableCollisionCheckingForAllItems()
|Improve this Doc View Source

FitAll()

Fit all

Declaration
public void FitAll()
|Improve this Doc View Source

GetActiveStation()

Returns the active station item (station currently visible)

Declaration
public IItem GetActiveStation()
Returns
Type Description
IItem
|Improve this Doc View Source

GetCollisionItems()

Return the list of items that are in a collision state. This call will run a check for collisions if collision checking is not activated (if SetCollisionActive is set to Off).

Declaration
public List GetCollisionItems()
Returns
Type Description
List<CollisionItem>

List of items that are in a collision state

|Improve this Doc View Source

GetCollisionPairs()

Returns the list of pairs of items that are in a collision state. This call will run a check for collisions if collision checking is not activated (if SetCollisionActive is set to Off).

Declaration
public List GetCollisionPairs()
Returns
Type Description
List<CollisionPair>
|Improve this Doc View Source

GetCursorXYZ(int, int, List)

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 and 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.

Declaration
public IItem GetCursorXYZ(int xCoord = -1, int yCoord = -1, List xyzStation = null)
Parameters
Type Name Description
int xCoord

X coordinate in pixels

int yCoord

Y coordinate in pixels

List<double> xyzStation

XYZ coordinates in mm (absolute coordinates)

Returns
Type Description
IItem

Item under the mouse cursor.

|Improve this Doc View Source

GetItemByName(string, ItemType)

Returns an item by its name. If there is no exact match it will return the last closest match. Specify what type of item you are looking for with itemtype. This is useful if 2 items have the same name but different type.

Declaration
public IItem GetItemByName(string name, ItemType itemType = ItemType.Any)
Parameters
Type Name Description
string name

name of the item (name of the item shown in the RoboDK station tree)

ItemType itemType

type of the item to be retrieved (avoids confusion if there are similar name matches).

Returns
Type Description
IItem

Returns an item by its name.

|Improve this Doc View Source

GetItemList(ItemType)

Returns a list of items of all available items in the currently open station in robodk. Optionally, use a filter to return items of a specific type

Declaration
public List GetItemList(ItemType itemType = ItemType.Any)
Parameters
Type Name Description
ItemType itemType

Only return items of this type

Returns
Type Description
List<IItem>

List of Items (optionally filtered by ItemType).

|Improve this Doc View Source

GetItemListNames(ItemType)

Returns a list of items (list of names) of all available items in the currently open station in robodk. Optionally, use a filter to return specific items (example: GetItemListNames(itemType = ItemType.Robot))

Declaration
public List GetItemListNames(ItemType itemType = ItemType.Any)
Parameters
Type Name Description
ItemType itemType

Only return items of this type.

Returns
Type Description
List<string>

List of item Names

|Improve this Doc View Source

GetLicense()

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

Declaration
public string GetLicense()
Returns
Type Description
string

license string.

|Improve this Doc View Source

GetOpenStation()

Returns the list of open stations in RoboDK

Declaration
public List GetOpenStation()
Returns
Type Description
List<IItem>
|Improve this Doc View Source

GetParameter(string)

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

Declaration
public string GetParameter(string parameter)
Parameters
Type Name Description
string parameter

RoboDK parameter

Returns
Type Description
string

parameter value. Null if parameter does not exist.

|Improve this Doc View Source

GetParameterList()

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

Declaration
public List> GetParameterList()
Returns
Type Description
List<KeyValuePair<string,string>>

list of param-value pair

|Improve this Doc View Source

GetRoboDkLink()

Declaration
public RoboDK.IRoboDKLink GetRoboDkLink()
Returns
Type Description
RoboDK.IRoboDKLink
|Improve this Doc View Source

GetRunMode()

Returns the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (RunMode.Simulate)

Declaration
public RunMode GetRunMode()
Returns
Type Description
RunMode

Returns the currently active RunMode.

|Improve this Doc View Source

GetSelectedItems()

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

Declaration
public List GetSelectedItems()
Returns
Type Description
List<IItem>

Returns the list of selected items.

|Improve this Doc View Source

GetSimulationSpeed()

Gets the current simulation speed. A speed if 1 means real-time simulation.

Declaration
public double GetSimulationSpeed()
Returns
Type Description
double

Simulation Speed. 1.0=real-time simulation.

|Improve this Doc View Source

GetViewPose(ViewPoseType)

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

Declaration
public Mat GetViewPose(ViewPoseType preset = ViewPoseType.ActiveView)
Parameters
Type Name Description
ViewPoseType preset

Optionally specify a ViewPoseType to retrieve the pose for a specific view

Returns
Type Description
Mat

Returns the current view pose.

|Improve this Doc View Source

GetWindowHandle()

Get RoboDK's main window handle

Declaration
public IntPtr GetWindowHandle()
Returns
Type Description
IntPtr
|Improve this Doc View Source

HideRoboDK()

Hides the RoboDK window.

Declaration
public void HideRoboDK()
|Improve this Doc View Source

IsInside(IItem, IItem)

Check if objectInside is inside the objectParent.

Declaration
public bool IsInside(IItem objectInside, IItem objectParent)
Parameters
Type Name Description
IItem objectInside
IItem objectParent
Returns
Type Description
bool

Returns true if objectInside is inside the objectParent

|Improve this Doc View Source

IsTcpPortFree(int)

Declaration
public static bool IsTcpPortFree(int tcpPort)
Parameters
Type Name Description
int tcpPort
Returns
Type Description
bool
|Improve this Doc View Source

ItemUserPick(string, ItemType)

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. The method always returns an IItem. Use item.Valid() to check if the selected item is a valid item. E.g. if the user exits the dialog without selecting an item, the method still returns an item object, but item.Valid() will return False.

Declaration
公共IItem ItemUserPick(字符串消息= " one item", ItemType itemType = ItemType.Any)
Parameters
Type Name Description
string message

Message to pop up

ItemType itemType

optionally filter by ItemType

Returns
Type Description
IItem

User selected item. Use item.Valid() to check if the item is valid

|Improve this Doc View Source

Joints(List)

Get Joint positions of all robots defined in the robotItemList.

Declaration
public List Joints(List robotItemList)
Parameters
Type Name Description
List<IItem> robotItemList

list of robot items

Returns
Type Description
List<double[]>

list of robot joints (double x nDOF)

|Improve this Doc View Source

JointsConfig(List, List)

Returns the robot configuration state for a set of robot joints.

Declaration
public List JointsConfig(List robotList, List jointsList)
Parameters
Type Name Description
List<IItem> robotList

list of items

List<double[]> jointsList

array of joints

Returns
Type Description
List<double[]>

3-array -> configuration status as [REAR, LOWERARM, FLIP]

|Improve this Doc View Source

LaserTrackerMeasure(double[], bool)

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.

Declaration
public double[] LaserTrackerMeasure(double[] estimate, bool search = false)
Parameters
Type Name Description
double[] estimate

estimate point [x,y,z]

bool search

If search is True, the tracker will search for a target.

Returns
Type Description
double[]

Returns the XYZ coordinates of the target (in mm). If the target was not found it retuns a null pointer.

|Improve this Doc View Source

MergeItems(List)

Merge multiple object items as one. Source objects are not deleted and a new object is created.

Declaration
public IItem MergeItems(List item_list)
Parameters
Type Name Description
List<IItem> item_list
Returns
Type Description
IItem

New item

|Improve this Doc View Source

OpenRoboDkEventChannel()

Start the event communication channel. Use WaitForEvent to wait for a new event.

Declaration
public IRoboDKEventSource OpenRoboDkEventChannel()
Returns
Type Description
IRoboDKEventSource

new event channel instance

|Improve this Doc View Source

Paste(IItem, int)

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.

Declaration
public List Paste(IItem paste_to, int paste_times)
Parameters
Type Name Description
IItem paste_to

Item to attach the copied item

int paste_times

Number of times to replicate the copied object

Returns
Type Description
List<IItem>

New item created

|Improve this Doc View Source

Paste(IItem)

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.

Declaration
public IItem Paste(IItem paste_to = null)
Parameters
Type Name Description
IItem paste_to

Item to attach the copied item (optional)

Returns
Type Description
IItem

New item created

|Improve this Doc View Source

Popup_ISO9283_CubeProgram(IItem)

Declaration
public IItem Popup_ISO9283_CubeProgram(IItem robot = null)
Parameters
Type Name Description
IItem robot
Returns
Type Description
IItem
|Improve this Doc View Source

ProgramStart(string, string, string, IItem)

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).

Declaration
public int ProgramStart(string progname, string defaultfolder = "", string postprocessor = "", IItem robot = null)
Parameters
Type Name Description
string progname

name of the program

string defaultfolder

文件夹保存计划,离开empty to use the default program folder

string postprocessor

name 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")

IItem robot

Robot to link

Returns
Type Description
int

TODO: Document return value.

|Improve this Doc View Source

ProjectPoints(Mat, IItem, ProjectionType)

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

Declaration
public Mat ProjectPoints(Mat points, IItem objectProject, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type Name Description
Mat points

matrix 3xN or 6xN -> list of points to project

IItem objectProject

object to project

ProjectionType projectionType

Type of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.

Returns
Type Description
Mat

It returns the projected points as a list of points (empty matrix if failed).

|Improve this Doc View Source

RecentFiles(string)

Return the list of recently opened files

Declaration
public static List RecentFiles(string extensionFilter = "")
Parameters
Type Name Description
string extensionFilter
Returns
Type Description
List<string>
|Improve this Doc View Source

Render(bool)

Display/render the scene: update the display. This function turns default rendering (rendering after any modification of the station unless alwaysRender is set to true). Use Update to update the internal links of the complete station without rendering (when a robot or item has been moved).

Declaration
public void Render(bool alwaysRender = false)
Parameters
Type Name Description
bool alwaysRender

Set to True to update the screen every time the station is modified (default behavior when Render() is not used).

|Improve this Doc View Source

RoboDKInstallFound()

Check if RoboDK was installed from RoboDK's official installer

Declaration
public static bool RoboDKInstallFound()
Returns
Type Description
bool
|Improve this Doc View Source

RoboDKInstallPath()

返回根据再保险RoboDK安装路径gistry (saved by RoboDK installer)

Declaration
public static string RoboDKInstallPath()
Returns
Type Description
string
|Improve this Doc View Source

RunCode(string, bool)

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

Declaration
public int RunCode(string code, bool codeIsFunctionCall = false)
Parameters
Type Name Description
string code

program name or code to generate

bool codeIsFunctionCall

Set to True if the provided code corresponds to a function call (same as RunProgram()), if so, RoboDK will handle the syntax when the code is generated for a specific robot.

Returns
Type Description
int

TODO: Document possible return values.

|Improve this Doc View Source

RunMessage(string, bool)

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

Declaration
public void RunMessage(string message, bool messageIsComment = false)
Parameters
Type Name Description
string message

message or comment to display.

bool messageIsComment

Set to True to generate a comment in the generated code instead of displaying a message on the teach pendant of the robot.

|Improve this Doc View Source

RunProgram(string)

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.

Declaration
public int RunProgram(string function)
Parameters
Type Name Description
string function

Function name with parameters (if any)

Returns
Type Description
int

TODO: Document possible return values.

|Improve this Doc View Source

Save(string, IItem)

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

Declaration
public void Save(string filename, IItem itemsave = null)
Parameters
Type Name Description
string filename

absolute path to save the file

IItem itemsave

object or station to save. Leave empty to automatically save the current station.

|Improve this Doc View Source

SetActiveStation(IItem)

Set the active station (project currently visible)

Declaration
public void SetActiveStation(IItem station)
Parameters
Type Name Description
IItem station

station item, it can be previously loaded as an RDK file

|Improve this Doc View Source

SetCollisionActive(CollisionCheckOptions)

Set collision checking ON or OFF (CollisionCheckOff/CollisionCheckOn) 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.

Declaration
public int SetCollisionActive(CollisionCheckOptions collisionCheck = CollisionCheckOptions.CollisionCheckOn)
Parameters
Type Name Description
CollisionCheckOptions collisionCheck

collision checking ON or OFF

Returns
Type Description
int

Number of pairs of objects in a collision state

|Improve this Doc View Source

SetCollisionActivePair(CollisionCheckOptions, CollisionPair)

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).

Declaration
public bool SetCollisionActivePair(CollisionCheckOptions collisionCheck, CollisionPair collisionPair)
Parameters
Type Name Description
CollisionCheckOptions collisionCheck

Set to COLLISION_ON or COLLISION_OFF

CollisionPair collisionPair

Collision pair (item1, id1, item2, id2) to set

Returns
Type Description
bool

Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided)

|Improve this Doc View Source

SetCollisionActivePair(List, IReadOnlyList)

Set collision checking ON or OFF (COLLISION_ON/COLLISION_OFF) for a specific list of pairs 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).

Declaration
public bool SetCollisionActivePair(List checkState, IReadOnlyList collisionPairs)
Parameters
Type Name Description
List<CollisionCheckOptions> checkState

Set to COLLISION_ON or COLLISION_OFF

IReadOnlyList<CollisionPair> collisionPairs

List of collision pairs to set

Returns
Type Description
bool

Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided)

|Improve this Doc View Source

SetColor(List, List)

Declaration
public void SetColor(List item_list, List color_list)
Parameters
Type Name Description
List<IItem> item_list
List<double[]> color_list
|Improve this Doc View Source

SetColor(List, List)

Sets the color for a list of items given the a color object

Declaration
public void SetColor(List item_list, List color_list)
Parameters
Type Name Description
List<IItem> item_list

list of items

List<Color> color_list

list of colors

|Improve this Doc View Source

SetInteractiveMode(InteractiveType, DisplayRefType, List, List)

Set the interactive mode to define the behavior when navigating and selecting items in RoboDK's 3D view.

Declaration
public void SetInteractiveMode(InteractiveType modeType = InteractiveType.MoveReferences, DisplayRefType defaultRefFlags = (DisplayRefType)-1, List customItems = null, List customRefFlags = null)
Parameters
Type Name Description
InteractiveType modeType

The mode type defines what accion occurs when the 3D view is selected (Select object, Pan, Rotate, Zoom, Move Objects, ...)

DisplayRefType defaultRefFlags

When a movement is specified, we can provide what motion we allow by default with respect to the coordinate system (set apropriate flags)

List<IItem> customItems

Provide a list of optional items to customize the move behavior for these specific items (important: the lenght of custom_ref_flags must match)

List<DisplayRefType> customRefFlags

Provide a matching list of flags to customize the movement behavior for specific items

|Improve this Doc View Source

SetItemFlags(ItemFlags)

Update global 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.

Declaration
public void SetItemFlags(ItemFlags itemFlags = ItemFlags.All)
Parameters
Type Name Description
ItemFlags itemFlags
|Improve this Doc View Source

SetJoints(List, List)

Sets the current robot joints for a list of robot items and a list of a set of joints.

Declaration
public void SetJoints(List robotItemList, List jointsList)
Parameters
Type Name Description
List<IItem> robotItemList

list of robot items.

List<double[]> jointsList

list of robot joints (double x nDOF).

|Improve this Doc View Source

SetParameter(string, double)

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"

Declaration
public void SetParameter(string parameter, double value)
Parameters
Type Name Description
string parameter

RoboDK parameter name

double value

parameter value (number)

|Improve this Doc View Source

SetParameter(string, string)

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"

Declaration
public void SetParameter(string parameter, string value)
Parameters
Type Name Description
string parameter

RoboDK parameter name

string value

parameter value

|Improve this Doc View Source

SetRobotParams(IItem, double[][], Mat, Mat)

Gets the nominal robot parameters.

Declaration
public bool SetRobotParams(IItem robot, double[][] dhm, Mat poseBase, Mat poseTool)
Parameters
Type Name Description
IItem robot
double[][] dhm
Mat poseBase
Mat poseTool
Returns
Type Description
bool
|Improve this Doc View Source

SetRunMode(RunMode)

Sets the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (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.

Declaration
public void SetRunMode(RunMode runMode = RunMode.Simulate)
Parameters
Type Name Description
RunMode runMode

program run mode.

|Improve this Doc View Source

SetSelectedItems(List)

Set the selection in the tree

Declaration
public void SetSelectedItems(List item_list)
Parameters
Type Name Description
List<IItem> item_list
|Improve this Doc View Source

SetSimulationSpeed(double)

Set the simulation speed. A simulation speed of 5 (default) means that 1 second of simulation time equals to 5 seconds in a real application. The slowest speed ratio allowed is 0.001. Set a large simmulation ratio (>100) for fast simulation results.

Declaration
public void SetSimulationSpeed(double speed)
Parameters
Type Name Description
double speed

simulation ratio.

|Improve this Doc View Source

SetViewPose(Mat)

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

Declaration
public void SetViewPose(Mat pose)
Parameters
Type Name Description
Mat pose

view pose frame.

|Improve this Doc View Source

SetVisible(List, List, List)

Sets the visibility for a list of items

Declaration
公共空间SetVisible(列表< IItem > itemList, <列表bool> visibleList, List visibleFrames = null)
Parameters
Type Name Description
List<IItem> itemList

list of items

List<bool> visibleList

list visible flags (bool)

List<int> visibleFrames

list visible frames (optional, hidden by default)

|Improve this Doc View Source

SetWindowFlags(WindowFlags)

Update the RoboDK flags. RoboDK flags allow defining how much access the user has to RoboDK features. Use the flags defined in WindowFlags to set one or more flags.

Declaration
public void SetWindowFlags(WindowFlags flags)
Parameters
Type Name Description
WindowFlags flags

RoboDk Window Flags

|Improve this Doc View Source

SetWindowState(WindowState)

Set the state of the RoboDK window

Declaration
public void SetWindowState(WindowState windowState = WindowState.Normal)
Parameters
Type Name Description
WindowState windowState

Window state to be set.

|Improve this Doc View Source

ShowAsCollided(List, List, List)

Show a list of objects or a robot link as collided (red) or as not collided (normal color)

Declaration
public void ShowAsCollided(List item_list, List collided_list, List robot_link_id = null)
Parameters
Type Name Description
List<IItem> item_list

List of items

List<bool> collided_list

List of collided flags (True=show as collided)

List<int> robot_link_id

Robot link ID, when applicable

|Improve this Doc View Source

ShowMessage(string, bool)

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

Declaration
public void ShowMessage(string message, bool popup = true)
Parameters
Type Name Description
string message

Message to display

bool popup

设置为true消息阻塞或一组false to make it non blocking

|Improve this Doc View Source

ShowRoboDK()

Shows or raises the RoboDK window.

Declaration
public void ShowRoboDK()
|Improve this Doc View Source

SolveFK(List, List, List)

Calculate the forward kinematics solution for multiple robots at the same time (faster)

Declaration
public List SolveFK(List robotList, List jointsList, List solutionOkList = null)
Parameters
Type Name Description
List<IItem> robotList

list of items

List<double[]> jointsList

list of joint

List<bool> solutionOkList

optional list of bool flags to notify about failed/invalid result

Returns
Type Description
List<Mat>
|Improve this Doc View Source

SolveIK_All(List, List)

Calculate the inverse kinematics solution for multiple robots at the same time. This call allows you to have a bulk calculation for faster performance.

Declaration
public List SolveIK_All(List robotList, List poseList)
Parameters
Type Name Description
List<IItem> robotList

list of items

List<Mat> poseList

list of poses

Returns
Type Description
List<Mat>
|Improve this Doc View Source

SolveIK(List, List, List)

Calculate the inverse kinematics solution for multiple robots at the same time (faster)

Declaration
public List SolveIK(List robotList, List poseList, List japroxList)
Parameters
Type Name Description
List<IItem> robotList

list of items

List<Mat> poseList

list of poses

List<double[]> japroxList
Returns
Type Description
List<double[]>
|Improve this Doc View Source

SolveIK(List, List)

Calculate the inverse kinematics solution for multiple robots at the same time (faster)

Declaration
public List SolveIK(List robotList, List poseList)
Parameters
Type Name Description
List<IItem> robotList

list of items

List<Mat> poseList

list of poses

Returns
Type Description
List<double[]>
|Improve this Doc View Source

StereoCameraMeasure(out Mat, out Mat, out int, out int, out int, out int)

Takes a measurement with the C-Track stereocamera. It returns two poses, the base reference frame and the measured object reference frame.Status is 0 if measurement succeeded.

Declaration
公共空间StereoCameraMeasure(垫pose1,Mat pose2, out int npoints1, out int npoints2, out int time, out int status)
Parameters
Type Name Description
Mat pose1

Pose of the measurement reference

Mat pose2

Pose of the tool measurement

int npoints1

number of visible targets for the measurement pose

int npoints2

number of visible targets for the tool pose

int time

time stamp in milliseconds

int status

Status is 0 if measurement succeeded

|Improve this Doc View Source

Update()

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

Declaration
public void Update()
|Improve this Doc View Source

Version()

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

Declaration
public string Version()
Returns
Type Description
string

Implements

IRoboDK
IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to topCopyright © 2015-RoboDK Inc.