Forum
FTP ALTERNATIVE TO PROGRAM TRANSFER TOOL
Quote from Antonio Amo on April 1, 2022, 5:57 amHello.
I'm trying to upload programs to Matsuura CNCs (Fanuc) using a generic FTP (WinSCP) and also Python library. Yet in any case, although the program is uploaded, it's showed as "blocked" in the machine and not recognized as program. This should be something in the machine side, as if I download the same program, it matches exactly with the original.
Is it possible to upload to Fanuc CNCs using a different FTP than Program Transfer Tool? Maybe a parameter that must be configured?
Thanks,
Regards.
P.S. Fanuc response to my query was "call us when File Transfer Tool does not work". Their customer service is highly questionable.
Hello.
I'm trying to upload programs to Matsuura CNCs (Fanuc) using a generic FTP (WinSCP) and also Python library. Yet in any case, although the program is uploaded, it's showed as "blocked" in the machine and not recognized as program. This should be something in the machine side, as if I download the same program, it matches exactly with the original.
Is it possible to upload to Fanuc CNCs using a different FTP than Program Transfer Tool? Maybe a parameter that must be configured?
Thanks,
Regards.
P.S. Fanuc response to my query was "call us when File Transfer Tool does not work". Their customer service is highly questionable.
Quote from Alex Free on April 1, 2022, 10:50 amAntonio,
There are a handful of considerations that need to be taken. First would be the filename itself. If the filename contains invalid characters, you will see this behavior rather than a nice error message. The biggest culprit is a space in the file name.
A second consideration is does the FANUC accept actual filenames vs. a program number. If you open up the G-code you are trying to upload, does the second line have an O followed by 4 numbers and then a comment in ()? Example, O1234 (program comment)? There might be some parameters that dictate this but I am not 100% sure.
Lastly, is this using a dataserver? There are parameters specific to the dataserver and how FTP is managed and the storage types, etc. One thing I like to try as troubleshooting is to export and existing program from the CNC to your PC. This confirms that the connection is good, and then lets you view the program that we know works and compare it to one you cannot upload. Similarly, try to re-upload the program you just downloaded.
FANUC loves the program transfer tool because they know it works. I agree FTP is much faster and easier to implement.
Antonio,
There are a handful of considerations that need to be taken. First would be the filename itself. If the filename contains invalid characters, you will see this behavior rather than a nice error message. The biggest culprit is a space in the file name.
A second consideration is does the FANUC accept actual filenames vs. a program number. If you open up the G-code you are trying to upload, does the second line have an O followed by 4 numbers and then a comment in ()? Example, O1234 (program comment)? There might be some parameters that dictate this but I am not 100% sure.
Lastly, is this using a dataserver? There are parameters specific to the dataserver and how FTP is managed and the storage types, etc. One thing I like to try as troubleshooting is to export and existing program from the CNC to your PC. This confirms that the connection is good, and then lets you view the program that we know works and compare it to one you cannot upload. Similarly, try to re-upload the program you just downloaded.
FANUC loves the program transfer tool because they know it works. I agree FTP is much faster and easier to implement.
Quote from Antonio Amo on April 3, 2022, 8:19 amHello,
Thanks for your answer.
It does not seem a problem for the programs (files) themselves, as they work using PTT but not alternative ftps (including python library) despite uploading anyway.
Program nomenclature is as you indicate, without any special character but underscore (OXXXX_Y, for example, being both X and Y numbers). About file content I cannot tell at this moment, but will check next week with program creators. Anyway it should be fine, as the same programs work well with PTT. I can download the uploaded programs just fine, so I'm a bit lost.
All of this comes because we have different CNC models with different controls in the compary I work for, and we are trying to automate program uploads with an universal interface regardless machine control. All of them work fine... except Fanuc.
I could have used PTT as part of the solution if this program admited commandline arguments (Heidenhain has a console version for their TNCRemo) but PTT doesn't. All different controls in my company are actually managed by this universal interface... except Fanuc, which is a bit frustrating.
Any help would be appreciated.
Regards.
Hello,
Thanks for your answer.
It does not seem a problem for the programs (files) themselves, as they work using PTT but not alternative ftps (including python library) despite uploading anyway.
Program nomenclature is as you indicate, without any special character but underscore (OXXXX_Y, for example, being both X and Y numbers). About file content I cannot tell at this moment, but will check next week with program creators. Anyway it should be fine, as the same programs work well with PTT. I can download the uploaded programs just fine, so I'm a bit lost.
All of this comes because we have different CNC models with different controls in the compary I work for, and we are trying to automate program uploads with an universal interface regardless machine control. All of them work fine... except Fanuc.
I could have used PTT as part of the solution if this program admited commandline arguments (Heidenhain has a console version for their TNCRemo) but PTT doesn't. All different controls in my company are actually managed by this universal interface... except Fanuc, which is a bit frustrating.
Any help would be appreciated.
Regards.
Quote from Alex Free on April 3, 2022, 2:19 pmFrom my experience, there is something different about your file that we haven't nailed down yet. 90% of my struggles in this field have turned out to be a file issue. You may also want to check that the TV Check parameter isnt turned on as this can wreak havoc on trying to use FTP.
The difference between PTT and FTP is that PTT uses the FOCAS library to upload the file and register it to the CNC. For FTP is just transfers the bytes and it either works or doesn't, no explanation of why if it fails. One big difference is PTT will look at the O number in the second line of your file and register that as the program name, with complete disregard for the windows file name. FTP uses the remote filename you(or your FTP software) specify. Maybe try to set the remote name to be just OXXXX where OXXXX doesn't already exist in the CNC?
Also, you can forego FTP and use the FOCAS library just like PTT does. You are limited to C++, C#, and VB.NET in a Windows environment though.
From my experience, there is something different about your file that we haven't nailed down yet. 90% of my struggles in this field have turned out to be a file issue. You may also want to check that the TV Check parameter isnt turned on as this can wreak havoc on trying to use FTP.
The difference between PTT and FTP is that PTT uses the FOCAS library to upload the file and register it to the CNC. For FTP is just transfers the bytes and it either works or doesn't, no explanation of why if it fails. One big difference is PTT will look at the O number in the second line of your file and register that as the program name, with complete disregard for the windows file name. FTP uses the remote filename you(or your FTP software) specify. Maybe try to set the remote name to be just OXXXX where OXXXX doesn't already exist in the CNC?
Also, you can forego FTP and use the FOCAS library just like PTT does. You are limited to C++, C#, and VB.NET in a Windows environment though.
Quote from Antonio Amo on April 4, 2022, 8:23 amHello,
Matsuura (Fanuc CNC) machine parameters are specified as numbers. Which one would be "TV Check"?
As FTP if becoming a bit frustrating, I'm trying the FOCAS option, but... also without success. The only function that seems to match file uplads from host is called "cnc_dtsvftpget":
/* transfer a file from host computer to CNC by FTP */
[DllImport("FWLIB32.dll", EntryPoint="cnc_dtsvftpget")]
public static extern short cnc_dtsvftpget( ushort FlibHndl,
[In,MarshalAs(UnmanagedType.AsAny)] Object a, [In,MarshalAs(UnmanagedType.AsAny)] Object b );
I am trying to use it in a small program (which does certain things succesfully, like getting overrides, spindle, etc) but it does not seem to work:
public static int LoadProgram(string source, string destination)
{
if (_handle == 0)
return -1;return Focas1.cnc_dtsvftpget(_handle, source, destination);
}
But it does not work. It returns -7, which apparently means EW_VERSION error, a strange one if handle works with other functions.
Sorry in case I could be making a trivial mistake in undestanding or code, as I'm not a software engineer, but I work in a Project Department (with some programming knowledge, mainly Python).
Regards.
P.S. By the way, this is an example of Program lines, the second one looks OK according to what you said (and the program works with PTT)
%
O0001 (O0370_1)
G21
G0 G17 G40 G52 G69 G80 G90 G94
(created by hyperMILL 2020.1 GAZC SEVILLA ----> MAQUINA MX850 FECHA 24.9.2021 TIEMPO MECANIZADO 1:53:38 )
( --- LISTA UTENSILI --- )
( T176 R25. L40. 6. MX-520 PLATO PLACA RED_5L )
( T213 R3. L40. 3. 3440L.06030B )
( T296 R2. L35. 0. BROCA MD Ø4 LC:17 LR:24 LFP:45 )...
Hello,
Matsuura (Fanuc CNC) machine parameters are specified as numbers. Which one would be "TV Check"?
As FTP if becoming a bit frustrating, I'm trying the FOCAS option, but... also without success. The only function that seems to match file uplads from host is called "cnc_dtsvftpget":
/* transfer a file from host computer to CNC by FTP */
[DllImport("FWLIB32.dll", EntryPoint="cnc_dtsvftpget")]
public static extern short cnc_dtsvftpget( ushort FlibHndl,
[In,MarshalAs(UnmanagedType.AsAny)] Object a, [In,MarshalAs(UnmanagedType.AsAny)] Object b );
I am trying to use it in a small program (which does certain things succesfully, like getting overrides, spindle, etc) but it does not seem to work:
public static int LoadProgram(string source, string destination)
{
if (_handle == 0)
return -1;return Focas1.cnc_dtsvftpget(_handle, source, destination);
}
But it does not work. It returns -7, which apparently means EW_VERSION error, a strange one if handle works with other functions.
Sorry in case I could be making a trivial mistake in undestanding or code, as I'm not a software engineer, but I work in a Project Department (with some programming knowledge, mainly Python).
Regards.
P.S. By the way, this is an example of Program lines, the second one looks OK according to what you said (and the program works with PTT)
%
O0001 (O0370_1)
G21
G0 G17 G40 G52 G69 G80 G90 G94
(created by hyperMILL 2020.1 GAZC SEVILLA ----> MAQUINA MX850 FECHA 24.9.2021 TIEMPO MECANIZADO 1:53:38 )
( --- LISTA UTENSILI --- )
( T176 R25. L40. 6. MX-520 PLATO PLACA RED_5L )
( T213 R3. L40. 3. 3440L.06030B )
( T296 R2. L35. 0. BROCA MD Ø4 LC:17 LR:24 LFP:45 )...
Quote from Versex on April 4, 2022, 2:41 pmHi Antonio,
So Alex knows more about this than I do, so he can correct me if I am off base, however, one thing to look at is whether or not the PTT alters the program when it uploads it. So for instance, if you create a program in AlphaCam / MasterCam / Whatever program you use... you should open up that file and look at the top lines of code. Then upload that file using PTT. Then open the program in the Fanuc controller and see if the name/comment line is different.
The reason I say this is because when creating applications to upload files to the CNCs we worked on, we would have to edit those lines before we uploaded them via FTP if they were not in the correct format. So it is entirely possible that PTT is looking at the name/comment line and changing it, then uploading the program.
Go ahead and check that to see if there is any difference. If there is, then in order to make the programs work via FTP, you will need to make edits to the program before sending it to the controller.
Hi Antonio,
So Alex knows more about this than I do, so he can correct me if I am off base, however, one thing to look at is whether or not the PTT alters the program when it uploads it. So for instance, if you create a program in AlphaCam / MasterCam / Whatever program you use... you should open up that file and look at the top lines of code. Then upload that file using PTT. Then open the program in the Fanuc controller and see if the name/comment line is different.
The reason I say this is because when creating applications to upload files to the CNCs we worked on, we would have to edit those lines before we uploaded them via FTP if they were not in the correct format. So it is entirely possible that PTT is looking at the name/comment line and changing it, then uploading the program.
Go ahead and check that to see if there is any difference. If there is, then in order to make the programs work via FTP, you will need to make edits to the program before sending it to the controller.
Quote from Alex Free on April 4, 2022, 7:12 pmI agree with Matt, making program alterations are something that the PTT quite possibly could be doing, and Matt's suggestion to check is a good one.
One thing that jumps out at me from your test program is that you are using O0001, which could be a problem if O0001 already exists on the CNC. Depending on the parameter set it may stop you from uploading in that case.
For your -7 error, that is most likely due to it being the wrong controller or connection type. At the bottom of the function reference in the FOCAS documentation is a chart listing which controls support it and whether you can use Ethernet, HSSB, or both. I suspect your controller isnt valid for that function.
PTT doesn't use that function, they do it with their program upload/download function. See below for a snippet:
The following program registers the following NC program to CNC. <PROG123> ; M3 S1200 ; G0 Z0 ; G0 X0 Y0 ; G1 F500 X120. Y-30. ; M30 ; class example { public short sample() { string strPrg = "\n" + "<PROG123>\n" + "M3 S1200\n" + "G0 Z0\n" + "G0 X0 Y0\n" + "G1 F500 X120. Y-30.\n" + "M30\n" + "%"; int len, n; short ret; ret = Focas1.cnc_dwnstart4(h, 0, "//CNC_MEM/USER/PATH1"); if (ret != Focas1.EW_OK) return (ret); int startPos = 0; len = strPrg.Length; while (len > 0) { char[] prg = new char[1280]; strPrg.CopyTo(startPos, prg, 0, len); n = len; ret = Focas1.cnc_download4(h, ref n, prg); if (ret == (short)Focas1.focas_ret.EW_BUFFER) { continue; } if (ret == Focas1.EW_OK) { startPos += n; len -= n; } if (ret != Focas1.EW_OK) { break; } } ret = Focas1.cnc_dwnend4(h); return (ret); } }
I agree with Matt, making program alterations are something that the PTT quite possibly could be doing, and Matt's suggestion to check is a good one.
One thing that jumps out at me from your test program is that you are using O0001, which could be a problem if O0001 already exists on the CNC. Depending on the parameter set it may stop you from uploading in that case.
For your -7 error, that is most likely due to it being the wrong controller or connection type. At the bottom of the function reference in the FOCAS documentation is a chart listing which controls support it and whether you can use Ethernet, HSSB, or both. I suspect your controller isnt valid for that function.
PTT doesn't use that function, they do it with their program upload/download function. See below for a snippet:
The following program registers the following NC program to CNC. <PROG123> ; M3 S1200 ; G0 Z0 ; G0 X0 Y0 ; G1 F500 X120. Y-30. ; M30 ; class example { public short sample() { string strPrg = "\n" + "<PROG123>\n" + "M3 S1200\n" + "G0 Z0\n" + "G0 X0 Y0\n" + "G1 F500 X120. Y-30.\n" + "M30\n" + "%"; int len, n; short ret; ret = Focas1.cnc_dwnstart4(h, 0, "//CNC_MEM/USER/PATH1"); if (ret != Focas1.EW_OK) return (ret); int startPos = 0; len = strPrg.Length; while (len > 0) { char[] prg = new char[1280]; strPrg.CopyTo(startPos, prg, 0, len); n = len; ret = Focas1.cnc_download4(h, ref n, prg); if (ret == (short)Focas1.focas_ret.EW_BUFFER) { continue; } if (ret == Focas1.EW_OK) { startPos += n; len -= n; } if (ret != Focas1.EW_OK) { break; } } ret = Focas1.cnc_dwnend4(h); return (ret); } }
Quote from Antonio Amo on April 5, 2022, 3:16 amHello.
I finally catched the cause of the problem. I think I deserve a big facepalm. The problem was... I was sending the file with FTP in binary mode.
After changing it to text mode, it finally works (python ftp library included). I guess Fanuc controllers detect which mode the files has been sent, and block them in case of binary. Maybe because that's how certain manufacturer programs/libraries or whatever are sent, so operator should not change these files (maybe, just a guess). Because at the end, afaik there is no final difference in the file itself, as if I download it back, it is exactly the same as the original.
I am simultaneously happy (for finally solving the question) and also more annoyed by Fanuc support than even before. This is a trick they know for sure and should have suggested me, instead ignoring my request.
Thank both of you very much for your help.
Regards.
Hello.
I finally catched the cause of the problem. I think I deserve a big facepalm. The problem was... I was sending the file with FTP in binary mode.
After changing it to text mode, it finally works (python ftp library included). I guess Fanuc controllers detect which mode the files has been sent, and block them in case of binary. Maybe because that's how certain manufacturer programs/libraries or whatever are sent, so operator should not change these files (maybe, just a guess). Because at the end, afaik there is no final difference in the file itself, as if I download it back, it is exactly the same as the original.
I am simultaneously happy (for finally solving the question) and also more annoyed by Fanuc support than even before. This is a trick they know for sure and should have suggested me, instead ignoring my request.
Thank both of you very much for your help.
Regards.
Quote from Alex Free on April 5, 2022, 2:42 pmGood to hear you found a resolution, I will definitely take note of that for the future.
I honestly can't say that I would have thought to check that, I guess the library I have always used just defaults to text mode.
Knowing FANUC, there is a line of text buried in the manual somewhere that says this, but I wouldn't be surprised if the only FANUC employees that know this are ones who have come across it before. My experience is that there isn't a high percentage of customers utilizing FTP.
Glad you are on your way!
Alex
Good to hear you found a resolution, I will definitely take note of that for the future.
I honestly can't say that I would have thought to check that, I guess the library I have always used just defaults to text mode.
Knowing FANUC, there is a line of text buried in the manual somewhere that says this, but I wouldn't be surprised if the only FANUC employees that know this are ones who have come across it before. My experience is that there isn't a high percentage of customers utilizing FTP.
Glad you are on your way!
Alex
Quote from Volker on July 22, 2022, 1:46 pmHi Antonio,
You should have contacted your local Matsuura distributor, I believe it is Maquinser (probably Abraham), on this matter.
If he wouldn't have known by himself, he would probably have forwarded this to me.
I quite regulary have to deal with that problem when customers try to transfer programs using FileZilla or similar.
Volker
Hi Antonio,
You should have contacted your local Matsuura distributor, I believe it is Maquinser (probably Abraham), on this matter.
If he wouldn't have known by himself, he would probably have forwarded this to me.
I quite regulary have to deal with that problem when customers try to transfer programs using FileZilla or similar.
Volker