GetFile Method
Hi again,
I'm just full of questions now a days..
Now I'm baching my head against the wall trying to copy files from the controller to the pc. I'm trying to use the GetFile() method, but I get an exception "File not found on the remote filesystem" thrown at me all the time. Here is what I do:
-------------------------------------------------
using( ABB.Robotics.Controllers.Mastership master = ABB.Robotics.Controllers.Mastership.Request( m_controller.Rapid ) )
{
using( ABB.Robotics.Controllers.RapidDomain.Task task = m_controller.Rapid.GetTask( "T_ROB1" ) )
{
using( ABB.Robotics.Controllers.RapidDomain.Module mod = task.GetModule(module) )
{
string dir = m_controller.FileSystem.RemoteDirectory;
mod.SaveToFile( dir );
using( ABB.Robotics.Controllers.FileSystemDomain.FileSystem fs = m_controller.FileSystem )
{
string tmpFile = System.IO.Path.GetTempFileName();
m_tracer.WriteLine(dir + "/" + module + ".mod" );
ABB.Robotics.Controllers.FileSystemDomain.ControllerFileSystemInfo[] inf = fs.GetFilesAndDirectories( "FinaBox.mod" );
m_tracer.WriteLine( "Length: " + inf.Length.ToString() );
if( inf.Length > 0 )
{
m_tracer.WriteLine( "Will try to fetch: "+ inf[0].FullName );
m_tracer.WriteLine( "And place it in: "+ tmpFile );
fs.GetFile( inf[0].FullName, tmpFile );
m_tracer.WriteLine( "Done" );
}
}
}
}
}
-------------------------------------------------
The GetFilesAndDirectories search is only there to verify that the file was created, I did use " dir + "/" + module + ".mod" " at first but when that did not work I did the search just to be sure. The search do find the file I'm looking for, but the GetFile method does not I'm afraid.
The tracer prints out:
[1332] C:/p/TestPCSDK/HOME/FinaBox.mod
[1332] Length: 1
[1332] Will try to fetch: C:/p/TestPCSDK/HOME/FinaBox.mod
[1332] And place it in: C: emp mpD5.tmp
and then the exception is trown.
Anyone got any idea why this does not work? Any problems with the format of my paths? Both the file on the VC and the temporary file do exist on my computer.
BR
Mikael
Mikael38699,4029398148Comments
-
My suggestion is that you use LocalDirectory instead of the system temp directory. The LocalDirectory is in "C:/p/TestPCSDK/Internal".
Urban Vikblom
CONTAB0 -
[QUOTE=Urban]
My suggestion is that you use LocalDirectory instead of the system temp directory. The LocalDirectory is in "C:/p/TestPCSDK/Internal".
[/QUOTE]
Hello Urban,
that I could do, but I'm not sure that should solve my problem? The exception indicates that it is the remote directory that does not exist? The local copy of the file I'm "Getting" is only used temporarily in my software, so I place it in the temp folder. Or at least that is what I would like to to. The problem is that the GetFile method does not seam to find the module file I just saved on the VC.
BR
Mikael
0 -
Sorry, I was a bit too quick reading the mail. I tested the code and got the same result as you do. I know from the past that getting the PC SDK filehandling to work is problematic. Still, I would not recommend using the temp directory. I know that was one of the things I had problems with in the past.Urban Vikblom
CONTAB0
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