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
- 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