Forum
Reading Program Comment
Quote from Avichai Abutbul on March 15, 2023, 10:24 amHi,
I am trying to read a comment of the main program on fanuc 30i.
Unfortunately I cant do this because the program name is e.g. 5420.NC and this is a string and by that the program number is 0.
I do find a way to read it when the program name is O+4Digits but not when the program name is not by this format.I am reading the comment of program of this format O+4Digits by this code:
string GetProgramComment18(ushort cncHandle, short startProgram)
{
Focas1.PRGDIR2 dir = new Focas1.PRGDIR2(); // array to hold the program directory information
short num = 1; // How much programs to be readshort ret = Focas1.cnc_rdprogdir2(cncHandle, 1, ref startProgram, ref num, dir);
if (ret != Focas1.EW_OK)
{
throw new Exception($"Cannot retrieve data about the system info. Error {ret}");
} else
{
return new string(dir.dir1.comment.ToString());
}}
How should I read the comment for program with this format 4Digits.NC
Thanks,
Avichai
Hi,
I am trying to read a comment of the main program on fanuc 30i.
Unfortunately I cant do this because the program name is e.g. 5420.NC and this is a string and by that the program number is 0.
I do find a way to read it when the program name is O+4Digits but not when the program name is not by this format.
I am reading the comment of program of this format O+4Digits by this code:
string GetProgramComment18(ushort cncHandle, short startProgram)
{
Focas1.PRGDIR2 dir = new Focas1.PRGDIR2(); // array to hold the program directory information
short num = 1; // How much programs to be read
short ret = Focas1.cnc_rdprogdir2(cncHandle, 1, ref startProgram, ref num, dir);
if (ret != Focas1.EW_OK)
{
throw new Exception($"Cannot retrieve data about the system info. Error {ret}");
} else
{
return new string(dir.dir1.comment.ToString());
}
}
How should I read the comment for program with this format 4Digits.NC
Thanks,
Avichai