Exception when calling ABB.Robotics.Controllers.RapidDomain.Task.SaveProgramToFile
First I check all Controllers:
foreach (ControllerObjectReference controllerReference in ControllerManager.ControllerReferences)
....
Then all the Tasks der Controller checked: (ABB.Robotics.Controllers.Controller)
var rapidTasks = controller.Rapid.GetTasks();Then the Modules should be saved: { private readonly ABB.Robotics.Controllers.RapidDomain.Task_task; … … string f = "d:\\01_DATEN\\03_Temp\\" + _task.Name; try { _task.SaveProgramToFile(f); } catch (Exception ex) { Logger.AddMessage("Problem saving file " + f + ex); } ….. }0
Comments
-
The function "SaveProgramToFile" needs as argument the directory where the program will be saved. When using subdirectories, the definition for the path-separator is critical. In your case, you are using "\\" and this will throw an error in RobotStudio (I did not test on a real machine).
See the following code for a working solution:private void button1_Click(object sender, EventArgs e) { //Declare Variables Controller RobotController = null; string filePath; try { //Get RobotController RobotController = new Controller(); //Set directory filePath = RobotController.FileSystem.LocalDirectory + @/files_backup; foreach (Task t in RobotController.Rapid.GetTasks()) { // save to file t.SaveProgramToFile(filePath); // dispose t.Dispose(); } GTPUMessageBox.Show(this, null, "Saved in " + filePath, null); } catch (Exception ex) { // Exception handling GTPUMessageBox.Show(this, null, "Error...\n" + ex.Message, null); } finally { // clean-up controller if (RobotController != null) { RobotController.Dispose(); RobotController = null; } } }
0
Categories
- All Categories
- 5.6K RobotStudio
- 399 UpFeed
- 20 Tutorials
- 14 RobotApps
- 300 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 828 RAPID Programming
- 12 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings