Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Clone Item from one RoboDK instance into another?

#1
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.
#2
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:
https://robodk.com/doc/en/PythonAPI/robo...olink.Copy
#3
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.
#4
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.
#5
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.
#6
Is there anything I can do to help solve this from my side? We are paid license users if that makes any difference! 

Thanks :)
#7
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)
item.Save("path-to-sld.sld")

And the load it on another instance by using AddFile:
https://robodk.com/doc/en/PythonAPI/robo...nk.AddFile
#8
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?
  




Users browsing this thread:
1 Guest(s)