CLDFile operator


The <CldFile> operator is intended to obtain access to CLData files data from the postprocessor code. It provides information only for reading, ie can only be to the right of the assignment operator. Syntax:

  • <CldFile.FileCount> – returns the number of CLData loaded files;
  • <CldFile.CurrentFile> – index of the current CLData file (CLData files are indexes starting with number 0);
  • <CldFile.CurrentCmd> – index of the current CLData command in the current CLData file (1 based indices);
  • <CldFile[<FileIndex>].Enabled> – returns 1 when the file number <FileIndex> is enabled, 0 – file is disabled;
  • <CldFile[<FileIndex>].IsNCSub> – returns 1 when the file is a file of NC-subprogram, 0 – when file is not NC-subprogram;
  • <CldFile[<FileIndex>].CmdCount> – number of commands in the CLData file number <FileIndex>;
  • <CldFile[<FileIndex>].Cmd[<CmdIndex>]> - returns a reference to the CLData command numbered <CmdIndex> in a file with an index <FileIndex>. After this command through a point is acceptable to specify any of the instructions defined for the operator Cmd. For example:
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Code> – code of the CLData command with number <CmdIndex>;
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Data> – returns a string data of the CLData command with number <CmdIndex> (for example, a comment line). If the command does not contain string data, then returns its string representation.
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Data[<CldIndex>]> – value of CLD array item with number <CldIndex>.
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Name> - the CLData command or CLData command parameter name;
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Str | .Int | .Flt | .Ptr> - corresponding type value of the command parameter;
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].Item[Index]> - child parameter by index;
    <CldFile[<FileIndex>].Cmd[<CmdIndex>].ItemCount> - returns the number of child parameters.

 

The example below prints out numbers and comments of all tools used in the program.

 

sub PrintAllTools

  i: Integer

  j: Integer

  for i = 0 to CLDFile.FileCount-1 do begin

    if (CldFile[i].Enabled>0) and (CldFile[i].IsNCSub=0) then begin

      for j = 1 to CldFile[i].CmdCount do begin

        ! If the given command is "LoadTl"

        if CldFile[i].Cmd[j].Code = CodeOfCmd("LoadTl") then begin

          ! Print the turret head identiefer

          Print "RevolverID = " + CldFile[i].Cmd[j].Str["RevolverID"]

          ! Print the tool number

          Print "Tool number = ", CldFile[i].Cmd[j].Data[1]

          ! Print the tool comment

          if CldFile[i].Cmd[j+1].Code = CodeOfCmd("Comment") then

            Print "Tool comment: " + CldFile[i].Cmd[j+1].Data

        end

      end

    end

  end

subend

 

 

 

Сопутствующие ссылки:

Функции и операторы работы с CLData