
API: Delete RsToolData

Matthias
✭
in RobotStudio
Hi!
I want to delete a RsToolData from my Task:
[code]
if (mechRobot.Task.DataDeclarations.Contains(myTool.Name))
mechRobot.Task.DataDeclarations..Remove(myTool);
[/code]
This is the error I get:
System.ArgumentException: Object must have same parent.
in
ABB.Robotics.RobotStudio.Stations.RsDataDeclarationCollection.Remove(RsDataDeclaration dataDeclaration)
in RSAddinTest.Class1.loadScene(Object sender, ExecuteCommandEventArgs e)
Can anyone please tell me why this does not work?
Best Regards, Matthias
I want to delete a RsToolData from my Task:
[code]
if (mechRobot.Task.DataDeclarations.Contains(myTool.Name))
mechRobot.Task.DataDeclarations..Remove(myTool);
[/code]
This is the error I get:
System.ArgumentException: Object must have same parent.
in
ABB.Robotics.RobotStudio.Stations.RsDataDeclarationCollection.Remove(RsDataDeclaration dataDeclaration)
in RSAddinTest.Class1.loadScene(Object sender, ExecuteCommandEventArgs e)
Can anyone please tell me why this does not work?
Best Regards, Matthias
0
Comments
-
Hi
This may give you some help how to delete RsToolData
public void Macro_DelTool()
{
Station stn = Project.ActiveProject as Station;
if (stn == null) return;
if (stn.ActiveTask.DataDeclarations.Contains("myNewTool"))
{
RsDataDeclaration tool = stn.ActiveTask.DataDeclarations["myNewTool"];
stn.ActiveTask.DataDeclarations.Remove(tool);
}
}Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
And the reason is that you have RsToolData in the remove method and not a RsDataDeclarationPer Svensson
Robotics and Vision Specialist
Consat Engineering0
Categories
- All Categories
- 5.5K RobotStudio
- 398 UpFeed
- 19 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 324 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 813 RAPID Programming
- 6 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings