Forum Migration Notice
Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
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.7K RobotStudio
- 402 UpFeed
- 21 Tutorials
- 16 RobotApps
- 307 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 251 ScreenMaker
- 2.9K Robot Controller
- 368 IRC5
- 92 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 859 RAPID Programming
- 43 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings