API: Change Workobject
in RobotStudio
Hi,
I'm working on an Add-in that will loop through the active path and do some corrections. One of them are to change which workobject the targets refers to.
I have used the rsTarget class with the WorkObject property to simply change the workobject. The problem is of course that the target will still have the x,y,z coordinate, example if I had 1000mm in the X-axis in relations to world, I'll have the same coodinate in relation to the new workobject. Meaning that, if the workobject itself has a value 1000mm away from world, my target will appear 2000mm away from world.
My objective is of course to change the workobject, but not the relations to world.
So my question; Can I find this functionality somewhere in the RS API or do i need to do the math myself?
Kind regards
Daniel
I'm working on an Add-in that will loop through the active path and do some corrections. One of them are to change which workobject the targets refers to.
I have used the rsTarget class with the WorkObject property to simply change the workobject. The problem is of course that the target will still have the x,y,z coordinate, example if I had 1000mm in the X-axis in relations to world, I'll have the same coodinate in relation to the new workobject. Meaning that, if the workobject itself has a value 1000mm away from world, my target will appear 2000mm away from world.
My objective is of course to change the workobject, but not the relations to world.
So my question; Can I find this functionality somewhere in the RS API or do i need to do the math myself?
Kind regards
Daniel
0
Comments
-
Hi Daniel,
Try this:
[code]Matrix4 worldMatrix = target.Transform.GlobalMatrix;
target.WorkObject = newWobj;
target.Transform.GlobalMatrix = worldMatrix;
[/code]
Johannes Weiman
Software Engineer
ABB Robotics0 -
Thanks, works great!
//Daniel
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings