diff --git a/C#/API/IRoboDk.cs b/C#/API/IRoboDk.cs index 9b5bea9..6ad5602 100644 --- a/C#/API/IRoboDk.cs +++ b/C#/API/IRoboDk.cs @@ -554,9 +554,16 @@ IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = fa /// /// 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 of items that are in a collision state List GetCollisionPairs(); + /// + /// Returns the list of pairs of items that are in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. + /// + /// List of items that are in the collision map + List CollisionActivePairList(); + /// /// 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. diff --git a/C#/API/Model/InstructionType.cs b/C#/API/Model/InstructionType.cs index 761bfee..ebac4c1 100644 --- a/C#/API/Model/InstructionType.cs +++ b/C#/API/Model/InstructionType.cs @@ -40,6 +40,8 @@ +using System; + namespace RoboDk.API.Model { // Instruction types @@ -47,15 +49,18 @@ public enum InstructionType { Invalid = -1, Move = 0, - Movec = 1, - Changespeed = 2, - Changeframe = 3, - Changetool = 4, - Changerobot = 5, + MoveC = 1, + ChangeSpeed = 2, + ChangeFrame = 3, + ChangeTool = 4, + ChangeRobot = 5, Pause = 6, Event = 7, Code = 8, - Print = 9 + Print = 9, + Rounding = 10, + IO = 11, + Custom = 12 } } diff --git a/C#/API/RoboDK.cs b/C#/API/RoboDK.cs index 9c55727..29db8ad 100644 --- a/C#/API/RoboDK.cs +++ b/C#/API/RoboDK.cs @@ -1296,6 +1296,25 @@ public List GetCollisionPairs() return list_items; } + /// + public List CollisionActivePairList() + { + check_connection(); + send_line("Collision_GetPairList"); + int nitems = rec_int(); + List list_items = new List(nitems); + for (int i = 0; i < nitems; i++) + { + IItem item1 = rec_item(); + int id1 = rec_int(); + IItem item2 = rec_item(); + int id2 = rec_int(); + CollisionPair collisionPair = new CollisionPair(item1, id1, item2, id2); + list_items.Add(collisionPair); + } + check_status(); + return list_items; + } /// public void SetSimulationSpeed(double speed) diff --git a/C#/Example/RoboDKSampleProject/RoboDK.cs b/C#/Example/RoboDKSampleProject/RoboDK.cs index 4aa3eb3..2f009cc 100644 --- a/C#/Example/RoboDKSampleProject/RoboDK.cs +++ b/C#/Example/RoboDKSampleProject/RoboDK.cs @@ -1715,6 +1715,9 @@ public RDKException(string Message) public const int INS_TYPE_EVENT = 7; public const int INS_TYPE_CODE = 8; public const int INS_TYPE_PRINT = 9; + public const int INS_TYPE_ROUNDING = 10; + public const int INS_TYPE_IO = 11; + public const int INS_TYPE_CUSTOM = 12; // Move types public const int MOVE_TYPE_INVALID = -1; @@ -3934,6 +3937,28 @@ public List CollisionItems(List link_id_list = null) return item_list; } + /// + /// Returns the list of pairs of items that are in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. + /// + /// List of items that are in the collision map + public List> CollisionActivePairList() + { + _check_connection(); + _send_Line("Collision_GetPairList"); + int nitems = _recv_Int(); + List> list_items = new List>(nitems); + for (int i = 0; i < nitems; i++) + { + Item item1 = _recv_Item(); + int id1 = _recv_Int(); + Item item2 = _recv_Item(); + int id2 = _recv_Int(); + list_items.Add(new Tuple(item1, item2, id1, id2)); + } + _check_status(); + return list_items; + } /// /// Sets the current simulation speed. Set the speed to 1 for a real-time simulation. The slowest speed allowed is 0.001 times the real speed. Set to a high value (>100) for fast simulation results. diff --git a/C++/robodk_api.cpp b/C++/robodk_api.cpp index d018395..4b81657 100644 --- a/C++/robodk_api.cpp +++ b/C++/robodk_api.cpp @@ -3196,6 +3196,45 @@ int RoboDK::Collision(Item item1, Item item2) return ncollisions; } +/// +/// Returns the pairs of objects that are currently in a collision state. +/// +/// List of the first colliding objects +/// List of the second colliding objects +/// List of Joint IDs for the first colliding objects +/// List of Joint IDs for the second colliding objects +void RoboDK::CollisionActivePairList(QList& item1, QList& item2, QList& id1, QList& id2) +{ + _check_connection(); + _send_Line("Collision_GetPairList"); + int nitems = _recv_Int(); + + item1.clear(); + item2.clear(); + id1.clear(); + id2.clear(); + + item1.reserve(nitems); + item2.reserve(nitems); + id1.reserve(nitems); + id2.reserve(nitems); + + for (int i = 0; i < nitems; ++i) + { + item1.append(_recv_Item()); + id1.append(_recv_Int()); + item2.append(_recv_Item()); + id2.append(_recv_Int()); + } + + _check_status(); +} + +/// +/// Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state. +/// +/// List of robot link IDs that are in collision (0 for objects and tools). +/// List of items that are in a collision state. QList RoboDK::getCollisionItems(QList& link_id_list) { link_id_list.clear(); diff --git a/C++/robodk_api.h b/C++/robodk_api.h index e5f4e8b..7f8939b 100644 --- a/C++/robodk_api.h +++ b/C++/robodk_api.h @@ -1068,6 +1068,16 @@ class ROBODK RoboDK { /// 0 if no collisions are found. int Collision(Item item1, Item item2); + /// + /// Returns the pairs of objects that are currently in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. + /// + /// List of the first colliding objects + /// List of the second colliding objects + /// List of Joint IDs for the first colliding objects + /// List of Joint IDs for the second colliding objects + void CollisionActivePairList(QList& item1, QList& item2, QList& id1, QList& id2); + /// /// Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state. /// @@ -1406,7 +1416,16 @@ class ROBODK RoboDK { INS_TYPE_CODE = 8, /// Display message on the teach pendant. - INS_TYPE_PRINT = 9 + INS_TYPE_PRINT = 9, + + /// Rounding instruction. + INS_TYPE_ROUNDING = 10, + + /// Set or Wait I/O instruction. + INS_TYPE_IO = 11, + + /// Custom instruction. + INS_TYPE_CUSTOM = 12 }; /// Movement types