Clone Item from one RoboDK instance into another?- Printable Version +- RoboDK Forum (//m.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//m.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//m.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Clone Item from one RoboDK instance into another? (/Thread-Clone-Item-from-one-RoboDK-instance-into-another) |
Clone Item from one RoboDK instance into another?-Mud-05-23-2023 I'm using the C# API, and struggling to get an item (body object such as STL) copied from one instance of RoboDK to another. I got the impression IItem.Clone was meant for exactly this, and can see the IItem's RoboDKServerPort is updated to the second RoboDK instance, but on trying to set the parent frame I get this error: RoboDk.API.Exceptions.RdkException: 'Invalid item provided: The item identifier provided is not valid or it does not exist.' I'm using the NuGet package v5.4.3, and RoboDK 5.6.0. Thanks in advance. RE: Clone Item from one RoboDK instance into another?-Albert-05-23-2023 If you just want to duplicate an item (any object, coordinate system, robot, tool), it is better to use the Copy and Paste functions of the API. This shows an example: //m.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.robolink.Robolink.Copy RE: Clone Item from one RoboDK instance into another?-Mud-05-23-2023 That doesn't seem to work, I assume because the Copy and Paste commands are specific to the IRoboDK instance - if I copy the item in instance 1 it pastes into instance 1 ok, but I get a different item (a duplicate of the frame, the only object in instance 2) if pasting into instance 2. RE: Clone Item from one RoboDK instance into another?-Albert-05-24-2023 Oh I understand... In this case it may be better to replicate the item from one instance to another. What type of items are you planning to replicate? For example, replicating a coordinate system is easy. But an object it is not so easy. We can help you implement both. RE: Clone Item from one RoboDK instance into another?-Mud-05-24-2023 Typically it would be the workpiece from CAD - the station can get very large and complex, so selecting points on the surface of the workpiece gets a bit cumbersome, and I sometimes get clicks assigned to the wrong object. What do you mean by replicate sorry? If it's from the file I get that, but ideally I would be able to go from a station with the workpiece already populated to having just the workpiece in the second RoboDK instance. RE: Clone Item from one RoboDK instance into another?-Mud-05-30-2023 Is there anything I can do to help solve this from my side? We are paid license users if that makes any difference! Thanks :) RE: Clone Item from one RoboDK instance into another?-Albert-05-30-2023 I'm sorry for the delays. In this case you can save an item to the disk using the sld format. Example:
Code:
item = RDK.Item("Object", ITEM_TYPE_OBJECT)
And the load it on another instance by using AddFile: //m.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.robolink.Robolink.AddFile RE: Clone Item from one RoboDK instance into another?-Mud-06-01-2023 Thanks, I have implemented this. :) Sort of related (and probably not deserving a dedicated thread), I have been trying to mutate a point (change the arrow vector) - I can get the vector, but am struggling to change it. Is the intended workflow for this sort of thing to delete the item and create a fresh one with the desired parameters? |