SaveToFile Not successful
Hi :
I have a problem about Module savetofile .When I connected to the real IRC5 , I use the Module function of SaveToFile to upload The Module to PC .But The alarm happened, that is "General file handing error" , I test successful in the virtual IRC5 use RS,But not in the real IRC5
My program like this:
My program like this:
wModule = GudData.mTasks[wTaskDeep].GetModule(TvProgram.SelectedNode.Text);
if (wModule.IsSystem == false)
{
if (File.Exists(@C:ABB + wModule.Name + ".mod"))
File.Delete(@C:ABB + wModule.Name + ".mod");
wModule.SaveToFile(wPath);
Stream s = new FileStream(@C:ABB + wModule.Name + ".mod", FileMode.Open);
if (wModule.IsSystem == false)
{
if (File.Exists(@C:ABB + wModule.Name + ".mod"))
File.Delete(@C:ABB + wModule.Name + ".mod");
wModule.SaveToFile(wPath);
Stream s = new FileStream(@C:ABB + wModule.Name + ".mod", FileMode.Open);
byte[] b = new byte[s.Length];
s.Read(b, 0, (int)s.Length);
s.Close();
string wPrograms = Encoding.Default.GetString(b);
string wPrograms = Encoding.Default.GetString(b);
RTProgram.Text = wPrograms;
}
}
Please help me or give me some sample code.
My E-mail is Martin-jie.zhang@cn.abb.com
Thanks sincerely
Martin-jie.zhang2012-12-14 03:21:39 0
Comments
-
The generic error is due to the controller not being able to save outside of its file system, ie local disk.the module.SaveToFile assumes a local disk, like (HOME)$, or similar.[quote]NOTE!All program files must
reside in the file system of the controller and not locally on the PC. In order
to load a program from the PC, you must first download it to the controller by
using theFileSystem.PutFile method.[/quote]It works the same way in the other direction using the GetFile method.So if you are going to do it like that then you need to first save the module locally on the controller, and then use GetFile to get it over to the PC.Here is a sample in VS2010 I created for you. It's using 5.14.03 resources so you might want to reset the references and rebuild it using whatever you got in the controller.
John
Developer Center0 -
Thank you very much ,i have finished ,thanks sincerely0
Categories
- All Categories
- 5.5K RobotStudio
- 395 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)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings