Interface IRoboDK
public interface IRoboDK
Properties
ApplicationDir
string ApplicationDir { get; }
Property Value
DefaultSocketTimeoutMilliseconds
Default Socket Timeout in Milliseconds.
int DefaultSocketTimeoutMilliseconds { get; set; }
Property Value
ItemInterceptFunction
Allows to install a function which can intercept all interface methods. Used for Aspect oriented programming (e.g. Add loging to an Interface). Example: rdk.InterceptorFunction = ItemInterceptorFunction; private IItem ItemInterceptorFunction(IItem item) { var behaviour = new LoggingAspect(_logger); var itemProxy = Unitity.Interception.Intercept.ThroughProxy(item, new InterfaceInterceptor(), new[] {behaviour}); return itemProxy; }
Func<IItem, IItem> ItemInterceptFunction { get; set; }
Property Value
LastStatusMessage
string LastStatusMessage { get; }
Property Value
Name
Name of the RoboDK instance. In case of multiple instances the name can help to identify the instance.
string Name { get; set; }
Property Value
Process
Process Process { get; }
Property Value
RoboDKClientPort
TCP Client Port
int RoboDKClientPort { get; }
Property Value
RoboDKServerPort
TCP Server Port to which this instance is connected to.
int RoboDKServerPort { get; }
Property Value
Methods
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.
IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
curvePoints
Matmatrix 3xN or 6xN -> N must be multiple of 3
referenceObject
IItemobject to add the curve and/or project the curve to the surface
addToRef
boolIf True, the curve will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projectionType
ProjectionTypeType of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.
Returns
- IItem
added object/curve (use item.Valid() to check if item is valid.)
AddFile(string, IItem)
Load a file and attaches it to parent and returns the newly added IItem.
IItem AddFile(string filename, IItem parent = null)
Parameters
filename
stringAny 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), ...
parent
IItemitem to attach the newly added object (optional)
Returns
AddFrame(string, IItem)
Adds a new Frame that can be referenced by a robot.
IItem AddFrame(string name, IItem parent = null)
Parameters
name
stringname of the reference frame
parent
IItemparent to attach to (such as the robot base frame)
Returns
- IItem
The new reference frame created
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:.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).
IItem AddMachiningProject(string name = "Curve follow settings", IItem itemrobot = null)
Parameters
name
stringName of the project settings
itemrobot
IItemRobot 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
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.
IItem AddPoints(Mat points, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
points
Matlist of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors)
referenceObject
IItemitem to attach the newly added geometry (optional)
addToRef
boolIf True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projectionType
ProjectionTypeType of projection.Use the PROJECTION_* flags.
Returns
- IItem
added object/shape (0 if failed)
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).
IItem AddProgram(string name, IItem robot = null)
Parameters
name
stringName of the program
robot
IItemRobot 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
- IItem
Newly created Program IItem
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.
IItem AddShape(Mat trianglePoints, IItem addTo = null, bool shapeOverride = false, Color? color = null)
Parameters
trianglePoints
MatList of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)
addTo
IItemitem to attach the newly added geometry (optional). Leave empty to create a new object.
shapeOverride
boolSet to true to replace any other existing geometry
color
Color?Color of the added shape
Returns
- IItem
added object/shape (use item.Valid() to check if item is valid.)
AddShape(List<Mat>, IItem, bool, List<Color>)
Adds a shape provided triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.
IItem AddShape(List<Mat> listTrianglePoints, IItem addTo = null, bool shapeOverride = false, List<Color> listColor = null)
Parameters
listTrianglePoints
List<Mat>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)
addTo
IItemitem to attach the newly added geometry (optional). Leave empty to create a new object.
shapeOverride
boolSet to true to replace any other existing geometry
listColor
List<Color>Optionally specify the color as RGBA [0-1] (list of same length as triangle_points_list)
Returns
AddStation(string)
Add a new empty station.
IItem AddStation(string name)
Parameters
name
stringName of the station
Returns
- IItem
Newly created station IItem
AddTarget(string, IItem, IItem)
Add a new target that can be reached with a robot.
IItem AddTarget(string name, IItem parent = null, IItem robot = null)
Parameters
name
stringTarget name
parent
IItemReference frame to attach the target
robot
IItemRobot that will be used to go to target (optional)
Returns
- IItem
Newly created target item.
AddTargetJ(IItem, string, double[], IItem, IItem)
Add a joint movement to a program
IItem AddTargetJ(IItem pgm, string targetName, double[] joints, IItem robotBase = null, IItem robot = null)
Parameters
Returns
- IItem
New target item created.
AddText(string, IItem)
Add Text to 3D View
IItem AddText(string text, IItem parent = null)
Parameters
text
stringText to add to the scene
parent
IItemitem to attach the newly added text object (optional)
Returns
BuildMechanism(int, List<IItem>, List<double>, List<double>, List<double>, List<double>, List<double>, List<double>, Mat, Mat, string, IItem)
Create a new robot or mechanism.
IItem BuildMechanism(int type, List<IItem> listObj, List<double> param, List<double> jointsBuild, List<double> jointsHome, List<double> jointsSenses, List<double> jointsLimLow, List<double> jointsLimHigh, Mat baseFrame = null, Mat tool = null, string name = "New robot", IItem robot = null)
Parameters
type
intType of the mechanism
listObj
List<IItem>param
List<double>robot parameters in the same order as shown in the RoboDK menu: Utilities-Build Mechanism or robot
jointsBuild
List<double>jointsHome
List<double>jointsSenses
List<double>jointsLimLow
List<double>jointsLimHigh
List<double>baseFrame
Mattool
Mattool pose
name
stringrobot name (you can also use setName()
robot
IItemexisting robot in the station to replace it (optional)
Returns
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.
Mat CalibrateReference(Mat joints, ReferenceCalibrationType method = ReferenceCalibrationType.Frame3P_P1OnX, bool useJoints = false, IItem robot = null)
Parameters
joints
Matpoints as a 3xN matrix or nDOFsxN) - List of points or a list of robot joints
method
ReferenceCalibrationTypetype of algorithm(by point, plane, ...)
useJoints
booluse points or joint values. The robot item must be provided if joint values is used.
robot
IItem
Returns
- Mat
TODO: Document return value.
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.
double[] CalibrateTool(Mat posesJoints, out double[] errorStats, EulerType format = EulerType.EulerRxRyRz, TcpCalibrationType algorithm = TcpCalibrationType.CalibrateTcpByPoint, IItem robot = null)
Parameters
posesJoints
Matmatrix of poses in a given format or a list of joints
errorStats
double[]stats[mean, standard deviation, max] - Output error stats summary
format
EulerTypeEuler format. Optionally, use EulerType.JointFormat and provide the robot.
algorithm
TcpCalibrationTypetype of algorithm (by point, plane, ...)
robot
IItemRobot used for calibration (if using joint values)
Returns
- double[]
TCP as [x, y, z] - calculated TCP
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.
long Cam2DAdd(IItem item, string cameraParameters = "")
Parameters
item
IItemReference frame or other object to attach the camera
cameraParameters
stringCamera parameters as a string. Refer to the documentation for more information.
Returns
- long
Camera pointer/handle. Keep the handle if more than 1 simulated camera is used
Cam2DClose(long)
Closes all camera windows or one specific camera if the camera handle is provided.
bool Cam2DClose(long camHandle = 0)
Parameters
camHandle
longCamera handle(pointer returned by Cam2DAdd). Leave to 0 to close all simulated views.
Returns
- bool
Returns true if success, false otherwise.
Cam2DSetParameters(string, long)
Set the parameters of the simulated camera.
bool Cam2DSetParameters(string cameraParameters, long camHandle = 0)
Parameters
cameraParameters
stringparameter settings according to the parameters supported by Cam2D_Add
camHandle
longcamera handle (optional)
Returns
- bool
Returns true if success, false otherwise.
Cam2DSnapshot(string, IItem, string)
Take a snapshot from a simulated camera view and save it to a file.
bool Cam2DSnapshot(string fileSaveImg, IItem cam, string cameraParameters = "")
Parameters
fileSaveImg
stringfile path to save.Formats supported include PNG, JPEG, TIFF, ...
cam
IItemCamera handle(pointer returned by Cam2DAdd)
cameraParameters
stringCamera parameters as a string. Refer to the documentation for more information.
Returns
- bool
Returns true if image has been saved successfully.
Cam2DSnapshot(string, long)
Take a snapshot from a simulated camera view and save it to a file.
bool Cam2DSnapshot(string fileSaveImg, long camHandle = 0)
Parameters
fileSaveImg
stringfile path to save.Formats supported include PNG, JPEG, TIFF, ...
camHandle
longCamera handle(pointer returned by Cam2DAdd)
Returns
- bool
Returns true if image has been saved successfully.
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.
IRoboDK CloneRoboDkConnection(RoboDK.ConnectionType connectionType = ConnectionType.Api)
Parameters
connectionType
RoboDK.ConnectionType
Returns
- IRoboDK
New RoboDK Link
CloseRoboDK()
Close RoboDK window and finish RoboDK process.
void CloseRoboDK()
CloseStation()
Closes the current station without suggesting to save
void CloseStation()
Collision(IItem, IItem, bool)
Check if item1 and item2 collided.
bool Collision(IItem item1, IItem item2, bool useCollisionMap = true)
Parameters
item1
IItemitem2
IItemuseCollisionMap
boolTurn off collision map check to force collision checking even if it is not set in the collision map
Returns
- bool
Returns true if item1 collides with item2; false otherwise.
CollisionLine(double[], double[])
Checks the collision between a line and any objects in the station. The line is composed by 2 points.
bool CollisionLine(double[] p1, double[] p2)
Parameters
Returns
- bool
Return true if there is a collision; false otherwise
CollisionLine(double[], double[], Mat)
Checks the collision between a line and any objects in the station. The line is composed by 2 points.
CollisionLineResult CollisionLine(double[] p1, double[] p2, Mat reference = null)
Parameters
p1
double[]Start point [x,y,z] of the line
p2
double[]End point [x,y,z] of the line
reference
MatReference of the two points with respect to the absolute station reference
Returns
- CollisionLineResult
Return CollisionLineResult with collision object and point of collision
Collisions()
Returns the number of pairs of objects that are currently in a collision state.
int Collisions()
Returns
- int
Number of pairs of objects in a collision state.
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.
string Command(string cmd, bool value)
Parameters
Returns
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.
string Command(string cmd, double value)
Parameters
Returns
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.
string Command(string cmd, int value)
Parameters
Returns
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.
string Command(string cmd, string value = "")
Parameters
cmd
stringCommand Name, such as Trace, Threads or Window.
value
stringComand value (optional, not all commands require a value)
Returns
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).
bool Connect()
Returns
- bool
If the connection succeeds it returns True, otherwise it returns False.
Connected()
Checks if the RoboDK Link is connected.
bool Connected()
Returns
- bool
True if connected; False otherwise
Copy(IItem, bool)
Makes a copy of an item (same as Ctrl+C), which can be pasted (Ctrl+V) using Paste().
void Copy(IItem tocopy, bool copy_children = true)
Parameters
tocopy
IItemItem to copy
copy_children
boolSet to false to prevent copying all items attached to this item
Delete(List<IItem>)
Delete a list of items
void Delete(List<IItem> item_list)
Parameters
DisableCollisionCheckingForAllItems()
Set all pairs as NOT checking for collisions:
void DisableCollisionCheckingForAllItems()
Disconnect()
Stops the communication with RoboDK. If setRunMode is set to MakeRobotProgram for offline programming, any programs pending will be generated.
void Disconnect()
EmbedWindow(string, string, int, int, int, int, int, int)
Embed a window from a separate process in RoboDK as a docked window
bool EmbedWindow(string windowName, string dockedName = null, int width = -1, int height = -1, int pid = 0, int areaAdd = 1, int areaAllowed = 15, int timeout = 500)
Parameters
windowName
stringThe name of the window currently open. Make sure the window name is unique and it is a top level window
dockedName
stringName of the docked tab in RoboDK (optional, if different from the window name)
width
intheight
intpid
intProcess ID (optional)
areaAdd
intSet to 1 (right) or 2 (left) (default is 1)
areaAllowed
intAreas allowed (default is 15: no constrain)
timeout
intTimeout to abort attempting to embed the window (optional)
Returns
- bool
Returns true if successful.
EnableCollisionCheckingForAllItems()
Set all pairs as checking for collisions:
void EnableCollisionCheckingForAllItems()
FitAll()
Fit all
void FitAll()
GetActiveStation()
Returns the active station item (station currently visible)
IItem GetActiveStation()
Returns
GetBinaryParameter(string)
Gets a global or a user binary parameter from the open RoboDK station
byte[] GetBinaryParameter(string parameter)
Parameters
parameter
stringRoboDK parameter
Returns
- byte[]
Arrray of bytes.
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).
List<CollisionItem> GetCollisionItems()
Returns
- List<CollisionItem>
List of items that are in a collision state
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).
List<CollisionPair> GetCollisionPairs()
Returns
GetCursorXYZ(int, int, List<double>)
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.
IItem GetCursorXYZ(int xCoord = -1, int yCoord = -1, List<double> xyzStation = null)
Parameters
xCoord
intX coordinate in pixels
yCoord
intY coordinate in pixels
xyzStation
List<double>XYZ coordinates in mm (absolute coordinates)
Returns
- IItem
Item under the mouse cursor.
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.
IItem GetItemByName(string name, ItemType itemType = ItemType.Any)
Parameters
name
stringname of the item (name of the item shown in the RoboDK station tree)
itemType
ItemTypetype of the item to be retrieved (avoids confusion if there are similar name matches).
Returns
- IItem
Returns an item by its name.
GetItemFlags(IItem)
Retrieve current item flags. Item flags allow defining how much access the user has to item-specific features.
ItemFlags GetItemFlags(IItem item)
Parameters
item
IItemItem to get flags
Returns
- ItemFlags
Returns ItemFlags of the item.
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
List<IItem> GetItemList(ItemType itemType = ItemType.Any)
Parameters
itemType
ItemTypeOnly return items of this type
Returns
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))
List<string> GetItemListNames(ItemType itemType = ItemType.Any)
Parameters
itemType
ItemTypeOnly return items of this type.
Returns
GetLicense()
Returns the license string (as shown in the RoboDK main window)
string GetLicense()
Returns
- string
license string.
GetOpenStation()
Returns the list of open stations in RoboDK
List<IItem> GetOpenStation()
Returns
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
string GetParameter(string parameter)
Parameters
parameter
stringRoboDK parameter
Returns
- string
parameter value. Null if parameter does not exist.
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
List<KeyValuePair<string, string>> GetParameterList()
Returns
- List<KeyValuePair<string, string>>
list of param-value pair
GetPoints(ObjectSelectionType)
Retrieves the object under the mouse cursor
GetPointsResult GetPoints(ObjectSelectionType featureType = ObjectSelectionType.HoverObjectMesh)
Parameters
featureType
ObjectSelectionTypeSet to ObjectSelectionType.HoverObjectMesh to retrieve object under the mouse cursor, the selected feature and mesh, or ObjectSelectionType.HoverObject if you don't need the mesh (faster)
Returns
- GetPointsResult
Returns GetPointsResult with an object under the mouse cursor, selected feature, feature id, list of points and description.
GetRunMode()
Returns the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (RunMode.Simulate)
RunMode GetRunMode()
Returns
- RunMode
Returns the currently active RunMode.
GetSelectedItems()
Returns the list of items selected (it can be one or more items)
List<IItem> GetSelectedItems()
Returns
GetSimulationSpeed()
Gets the current simulation speed. A speed if 1 means real-time simulation.
double GetSimulationSpeed()
Returns
- double
Simulation Speed. 1.0=real-time simulation.
GetSimulationTime()
Retrieve the simulation time (in seconds). Time of 0 seconds starts with the first time this function is called. The simulation time changes depending on the simulation speed. The simulation time is usually faster than the real time (5 times by default)
double GetSimulationTime()
Returns
- double
Returns the simulation time in seconds.
GetViewPose(ViewPoseType)
Get the pose of the wold reference frame with respect to the view (camera/screen)
Mat GetViewPose(ViewPoseType preset = ViewPoseType.ActiveView)
Parameters
preset
ViewPoseTypeOptionally specify a ViewPoseType to retrieve the pose for a specific view
Returns
- Mat
Returns the current view pose.
GetWindowHandle()
Get RoboDK's main window handle
IntPtr GetWindowHandle()
Returns
HideRoboDK()
Hides the RoboDK window.
void HideRoboDK()
IsInside(IItem, IItem)
Check if objectInside is inside the objectParent.
bool IsInside(IItem objectInside, IItem objectParent)
Parameters
Returns
- bool
Returns true if objectInside is inside the objectParent
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.
IItem ItemUserPick(string message = "Pick one item", ItemType itemType = ItemType.Any)
Parameters
Returns
- IItem
User selected item. Use item.Valid() to check if the item is valid
Joints(List<IItem>)
Get Joint positions of all robots defined in the robotItemList.
List<double[]> Joints(List<IItem> robotItemList)
Parameters
Returns
JointsConfig(List<IItem>, List<double[]>)
Returns the robot configuration state for a set of robot joints.
List<double[]> JointsConfig(List<IItem> robotList, List<double[]> jointsList)
Parameters
Returns
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.
double[] LaserTrackerMeasure(double[] estimate, bool search = false)
Parameters
estimate
double[]estimate point [x,y,z]
search
boolIf search is True, the tracker will search for a target.
Returns
- double[]
Returns the XYZ coordinates of the target (in mm). If the target was not found it retuns a null pointer.
MeasurePose(int, int, List<double>)
Takes a measurement with a 6D measurement device
MeasurePoseResult MeasurePose(int target = -1, int averageTime = 0, List<double> tipOffset = null)
Parameters
target
intTarget type
averageTime
intTake the measurement for a period of time and average the result
tipOffset
List<double>Offet the measurement to the tip
Returns
- MeasurePoseResult
Returns MeasurePoseResult with a pose of measured object reference frame, and error values in mm.
MergeItems(List<IItem>)
Merge multiple object items as one. Source objects are not deleted and a new object is created.
IItem MergeItems(List<IItem> item_list)
Parameters
Returns
- IItem
New item
OpenRoboDkEventChannel()
Start the event communication channel. Use WaitForEvent to wait for a new event.
IRoboDKEventSource OpenRoboDkEventChannel()
Returns
- IRoboDKEventSource
new event channel instance
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.
IItem Paste(IItem paste_to = null)
Parameters
paste_to
IItemItem to attach the copied item (optional)
Returns
- IItem
New item created
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.
List<IItem> Paste(IItem paste_to, int paste_times)
Parameters
paste_to
IItemItem to attach the copied item
paste_times
intNumber of times to replicate the copied object
Returns
PluginCommand(string, string, string)
Send a specific command to a RoboDK plugin. The command and value (optional) must be handled by your plugin
string PluginCommand(string pluginName, string command, string value)
Parameters
pluginName
stringThe plugin name must match the PluginName() implementation in the RoboDK plugin
command
stringSpecific command handled by your plugin
value
stringSpecific value (optional) handled by your plugin
Returns
- string
Returns the result as a string.
PluginLoad(string, PluginOperation)
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
bool PluginLoad(string pluginName, PluginOperation operation = PluginOperation.Load)
Parameters
pluginName
stringThe name of the plugin or path (if it is not in the default directory)
operation
PluginOperationType of operation (load, unload, reload)
Returns
- bool
Returns boolean result of operation.
Popup_ISO9283_CubeProgram(IItem)
Show the popup menu to create the ISO9283 path for path accuracy and performance testing
IItem Popup_ISO9283_CubeProgram(IItem robot = null)
Parameters
robot
IItem
Returns
- IItem
IS9283 Program
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).
int ProgramStart(string progname, string defaultfolder = "", string postprocessor = "", IItem robot = null)
Parameters
progname
stringname of the program
defaultfolder
stringfolder to save the program, leave empty to use the default program folder
postprocessor
stringname 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")
robot
IItemRobot to link
Returns
- int
TODO: Document return value.
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].
Mat ProjectPoints(Mat points, IItem objectProject, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
points
Matmatrix 3xN or 6xN -> list of points to project
objectProject
IItemobject to project
projectionType
ProjectionTypeType of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.
Returns
- Mat
It returns the projected points as a list of points (empty matrix if failed).
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).
void Render(bool alwaysRender = false)
Parameters
alwaysRender
boolSet to True to update the screen every time the station is modified (default behavior when Render() is not used).
RunCode(string, bool)
Adds code to run in the program output. If the program exists it will also run the program in simulate mode.
int RunCode(string code, bool codeIsFunctionCall = false)
Parameters
code
stringprogram name or code to generate
codeIsFunctionCall
boolSet 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
- int
TODO: Document possible return values.
RunMessage(string, bool)
Shows a message or a comment in the output robot program.
void RunMessage(string message, bool messageIsComment = false)
Parameters
message
stringmessage or comment to display.
messageIsComment
boolSet to True to generate a comment in the generated code instead of displaying a message on the teach pendant of the robot.
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.
int RunProgram(string function)
Parameters
function
stringFunction name with parameters (if any)
Returns
- int
TODO: Document possible return values.
Save(string, IItem)
Save an item to a file. If no item is provided, the open station is saved.
void Save(string filename, IItem itemsave = null)
Parameters
filename
stringabsolute path to save the file
itemsave
IItemobject or station to save. Leave empty to automatically save the current station.
SetActiveStation(IItem)
Set the active station (project currently visible)
void SetActiveStation(IItem station)
Parameters
station
IItemstation item, it can be previously loaded as an RDK file
SetBinaryParameter(string, byte[])
Sets a global binary 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"
void SetBinaryParameter(string parameter, byte[] data)
Parameters
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.
int SetCollisionActive(CollisionCheckOptions collisionCheck = CollisionCheckOptions.CollisionCheckOn)
Parameters
collisionCheck
CollisionCheckOptionscollision checking ON or OFF
Returns
- int
Number of pairs of objects in a collision state
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).
bool SetCollisionActivePair(CollisionCheckOptions collisionCheck, CollisionPair collisionPair)
Parameters
collisionCheck
CollisionCheckOptionsSet to COLLISION_ON or COLLISION_OFF
collisionPair
CollisionPairCollision pair (item1, id1, item2, id2) to set
Returns
- bool
Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided)
SetCollisionActivePair(List<CollisionCheckOptions>, IReadOnlyList<CollisionPair>)
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).
bool SetCollisionActivePair(List<CollisionCheckOptions> checkState, IReadOnlyList<CollisionPair> collisionPairs)
Parameters
checkState
List<CollisionCheckOptions>Set to COLLISION_ON or COLLISION_OFF
collisionPairs
IReadOnlyList<CollisionPair>List of collision pairs to set
Returns
- bool
Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided)
SetColor(List<IItem>, List<double[]>)
Sets the color for a list of items given a 4D, 3D or 1D array of doubles
void SetColor(List<IItem> item_list, List<double[]> color_list)
Parameters
item_list
List<IItem>list of items
color_list
List<double[]>list of colors as an array of doubles. Valid colors and alpha channel must be within the range [0-1]. Each array of doubles can be provided as a 4D, 3D or 1D array. Options: [r,g,b,a], [r,g,b], [a]. If you provide [-1,-1,-1,a] only the alpha channel is modified.
SetColor(List<IItem>, List<Color>)
Sets the color for a list of items given the a color object
void SetColor(List<IItem> item_list, List<Color> color_list)
Parameters
SetInteractiveMode(InteractiveType, DisplayRefType, List<IItem>, List<DisplayRefType>)
Set the interactive mode to define the behavior when navigating and selecting items in RoboDK's 3D view.
void SetInteractiveMode(InteractiveType modeType = InteractiveType.MoveReferences, DisplayRefType defaultRefFlags = (DisplayRefType)-1, List<IItem> customItems = null, List<DisplayRefType> customRefFlags = null)
Parameters
modeType
InteractiveTypeThe mode type defines what accion occurs when the 3D view is selected (Select object, Pan, Rotate, Zoom, Move Objects, ...)
defaultRefFlags
DisplayRefTypeWhen a movement is specified, we can provide what motion we allow by default with respect to the coordinate system (set apropriate flags)
customItems
List<IItem>Provide a list of optional items to customize the move behavior for these specific items (important: the lenght of custom_ref_flags must match)
customRefFlags
List<DisplayRefType>Provide a matching list of flags to customize the movement behavior for specific items
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.
void SetItemFlags(ItemFlags itemFlags = ItemFlags.All)
Parameters
itemFlags
ItemFlagsItem flags
SetJoints(List<IItem>, List<double[]>)
Sets the current robot joints for a list of robot items and a list of a set of joints.
void SetJoints(List<IItem> robotItemList, List<double[]> jointsList)
Parameters
robotItemList
List<IItem>list of robot items.
jointsList
List<double[]>list of robot joints (double x nDOF).
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"
void SetParameter(string parameter, double value)
Parameters
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"
void SetParameter(string parameter, string value)
Parameters
SetPoses(List<IItem>, List<Mat>)
Sets the relative positions (poses) of a list of items with respect to their parent. For example, the position of an object/frame/target with respect to its parent. Use this function instead of SetPose() for faster speed.
void SetPoses(List<IItem> items, List<Mat> poses)
Parameters
SetPosesAbs(List<IItem>, List<Mat>)
Set the absolute positions (poses) of a list of items with respect to the station reference. For example, the position of an object/frame/target with respect to its parent. Use this function instead of SetPoseAbs() for faster speed.
void SetPosesAbs(List<IItem> items, List<Mat> poses)
Parameters
SetRobotParams(IItem, double[][], Mat, Mat)
Gets the nominal robot parameters.
bool SetRobotParams(IItem robot, double[][] dhm, Mat poseBase, Mat poseTool)
Parameters
Returns
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.
void SetRunMode(RunMode runMode = RunMode.Simulate)
Parameters
runMode
RunModeprogram run mode.
SetSelectedItems(List<IItem>)
Set the selection in the tree
void SetSelectedItems(List<IItem> item_list)
Parameters
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.
void SetSimulationSpeed(double speed)
Parameters
speed
doublesimulation ratio.
SetViewPose(Mat)
Set the pose of the wold reference frame with respect to the view (camera/screen).
void SetViewPose(Mat pose)
Parameters
pose
Matview pose frame.
SetVisible(List<IItem>, List<bool>, List<int>)
Sets the visibility for a list of items
void SetVisible(List<IItem> itemList, List<bool> visibleList, List<int> visibleFrames = null)
Parameters
itemList
List<IItem>list of items
visibleList
List<bool>list visible flags (bool)
visibleFrames
List<int>list visible frames (optional, hidden by default)
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.
void SetWindowFlags(WindowFlags flags)
Parameters
flags
WindowFlagsRoboDk Window Flags
SetWindowState(WindowState)
Set the state of the RoboDK window
void SetWindowState(WindowState windowState = WindowState.Normal)
Parameters
windowState
WindowStateWindow state to be set.
ShowAsCollided(List<IItem>, List<bool>, List<int>)
Show a list of objects or a robot link as collided (red) or as not collided (normal color)
void ShowAsCollided(List<IItem> item_list, List<bool> collided_list, List<int> robot_link_id = null)
Parameters
item_list
List<IItem>List of items
collided_list
List<bool>List of collided flags (True=show as collided)
robot_link_id
List<int>Robot link ID, when applicable
ShowMessage(string, bool)
Show a message in RoboDK (it can be blocking or non blocking in the status bar)
void ShowMessage(string message, bool popup = true)
Parameters
message
stringMessage to display
popup
boolSet to true to make the message blocking or set to false to make it non blocking
ShowRoboDK()
Shows or raises the RoboDK window.
void ShowRoboDK()
ShowSequence(Mat)
Displays a sequence of joints
void ShowSequence(Mat sequence)
Parameters
sequence
Matjoint sequence as a 6xN matrix or instruction sequence as a 7xN matrix
ShowSequence(List<double[]>, List<Mat>, SequenceDisplayFlags, int)
Displays a sequence of joints or poses
void ShowSequence(List<double[]> joints = null, List<Mat> poses = null, SequenceDisplayFlags flags = (SequenceDisplayFlags)-1, int timeout = -1)
Parameters
joints
List<double[]>List of joint arrays
poses
List<Mat>List of poses
flags
SequenceDisplayFlagsDisplay options
timeout
intDisplay timeout, in milliseconds (default: -1)
SolveFK(List<IItem>, List<double[]>, List<bool>)
Calculate the forward kinematics solution for multiple robots at the same time (faster)
List<Mat> SolveFK(List<IItem> robotList, List<double[]> jointsList, List<bool> solutionOkList = null)
Parameters
robotList
List<IItem>list of items
jointsList
List<double[]>list of joint
solutionOkList
List<bool>optional list of bool flags to notify about failed/invalid result
Returns
SolveIK(List<IItem>, List<Mat>)
Calculate the inverse kinematics solution for multiple robots at the same time (faster)
List<double[]> SolveIK(List<IItem> robotList, List<Mat> poseList)
Parameters
Returns
SolveIK(List<IItem>, List<Mat>, List<double[]>)
Calculate the inverse kinematics solution for multiple robots at the same time (faster)
List<double[]> SolveIK(List<IItem> robotList, List<Mat> poseList, List<double[]> japroxList)
Parameters
Returns
SolveIK_All(List<IItem>, List<Mat>)
Calculate the inverse kinematics solution for multiple robots at the same time. This call allows you to have a bulk calculation for faster performance.
List<Mat> SolveIK_All(List<IItem> robotList, List<Mat> poseList)
Parameters
Returns
SprayAdd(IItem, IItem, string, Mat, Mat)
Add a simulated spray gun that allows projecting particles to a part. This is useful to simulate applications such as: arc welding, spot welding, 3D printing, painting, inspection or robot machining to verify the trace
int SprayAdd(IItem tool = null, IItem referenceObject = null, string parameters = "", Mat points = null, Mat geometry = null)
Parameters
tool
IItemActive tool (null for auto detect)
referenceObject
IItemObject in active reference frame (null for auto detect)
parameters
stringA string specifying the behavior of the simulated particles
points
MatProvide the volume as a list of points as described in the sample macro SprayOn.py
geometry
MatProvide a list of points describing triangles to define a specific particle geometry
Returns
- int
Returns ID of the spray gun.
SprayClear(int)
Stops simulating a spray gun. This will clear the simulated particles
int SprayClear(int sprayId = -1)
Parameters
sprayId
intSpray ID (value returned by SprayAdd). Leave the default -1 to apply to all simulated sprays
Returns
- int
Returns result code of the operation.
SprayGetStats(out Mat, int)
Gets statistics from all simulated spray guns or a specific spray gun
string SprayGetStats(out Mat data, int sprayId = -1)
Parameters
data
MatExtra data output
sprayId
intSpray ID (value returned by SprayAdd). Leave the default -1 to apply to all simulated sprays
Returns
- string
Returns statistics string.
SpraySetState(SprayGunStates, int)
Sets the state of a simulated spray gun (ON or OFF)
int SpraySetState(SprayGunStates state = SprayGunStates.SprayOn, int sprayId = -1)
Parameters
state
SprayGunStatesSet to SprayGunStates.SprayOn or SprayGunStates.SprayOff
sprayId
intSpray ID (value returned by SprayAdd). Leave the default -1 to apply to all simulated sprays
Returns
- int
Returns result code of the operation.
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.
void StereoCameraMeasure(out Mat pose1, out Mat pose2, out int npoints1, out int npoints2, out int time, out int status)
Parameters
pose1
MatPose of the measurement reference
pose2
MatPose of the tool measurement
npoints1
intnumber of visible targets for the measurement pose
npoints2
intnumber of visible targets for the tool pose
time
inttime stamp in milliseconds
status
intStatus is 0 if measurement succeeded
Update()
Update the screen. This updates the position of all robots and internal links according to previously set values.
void Update()
Version()
Return the vesion of RoboDK as a 4 digit string: Major.Minor.Revision.Build
string Version()