UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Offline file parsing

Parse and decode Fanuc variable files (.va), error lists (.ls), I/O state, safety status, and current position files without a robot connection.

  • Variable files (.va)
  • Error log (errall.ls)
  • Workflow: FTP download + offline parse
  • Complete example
  • API reference

The SDK includes offline file parsers for reading and editing Fanuc controller files without a network connection. Download files from the robot via FTP, then parse them locally.

Variable files (.va)

Parse any variable file (.va) into a hierarchical list of typed variables:

static void Main()
{
// Parse a variable file
GenericVariableFile vaFile = FanucFileReaders.VariableReader.ReadFile("C:/backup/numreg.va", Languages.English);
// Browse variables
foreach (var variable in vaFile.Variables)
{
Console.WriteLine($"{variable.Name} = {variable.Value} [{variable.Type}]");
}
// Re-generate the .va file
vaFile.GenerateVa("C:/backup/numreg_modified.va");
}
}
Click to see the full code

This works with all .va files: numreg.va, posreg.va, strreg.va, sysvars.va, sysmotn.va, etc.

Error log (errall.ls)

static void Main()
{
// Error log
var errors = FanucFileReaders.ErrorListReader.ReadFile("C:/backup/errall.ls", Languages.English);
foreach (var error in errors.Items)
{
Console.WriteLine($"{error.OccurringTime} [{error.ErrorCode}] {error.Message}");
}
// I/O state
var ioState = FanucFileReaders.IOStateReader.ReadFile("C:/backup/iostate.dg", Languages.English);
// Safety status
var safety = FanucFileReaders.SafetyStatusReader.ReadFile("C:/backup/safety.dg", Languages.English);
// Current position
var currentPos = FanucFileReaders.CurrentPositionReader.ReadFile("C:/backup/curpos.dg", Languages.English);
}
}
Click to see the full code

Workflow: FTP download + offline parse

A common pattern is to download files via FTP and parse them locally:

FanucRobot robot = new FanucRobot();
robot.Connect("192.168.0.1");
// Download a file from the robot
robot.Ftp.DirectFileHandling.DownloadFileFromController("numreg.va", "md:/numreg.va");
// Parse offline
var vaFile = FanucFileReaders.VariableReader.ReadFile("numreg.va", Languages.English);
// Or use the built-in helpers
var numRegs = robot.Ftp.KnownVariableFiles.GetNumregFile();
var posRegs = robot.Ftp.KnownVariableFiles.GetPosregFile();
}
}
Click to see the full code

Complete example

using UnderAutomation.Fanuc.Common;
using UnderAutomation.Fanuc.Common.Files;
using UnderAutomation.Fanuc.Common.Files.Variables;
public class OfflineFileParsing
{
static void Main()
{
// Parse a variable file and extract a hierarchical list of variables
GenericVariableFile vaFile = FanucFileReaders.VariableReader.ReadFile("C:/path/to/variable.va", Languages.English);
foreach (var variable in vaFile.Variables)
Console.WriteLine($"{variable.Name} = {variable.Value} [{variable.Type}]");
// Edit and regenerate the variable file
vaFile.GenerateVa("C:/path/to/variable_modified.va\"");
// Parse several types of files
FanucFileReaders.ErrorListReader.ReadFile("C:/path/to/errall.ls", Languages.English);
FanucFileReaders.IOStateReader.ReadFile("C:/path/to/iostate.dg", Languages.English);
FanucFileReaders.SafetyStatusReader.ReadFile("C:/path/to/safety.dg", Languages.English);
FanucFileReaders.CurrentPositionReader.ReadFile("C:/path/to/curpos.dg", Languages.English);
}
}

API reference

Class
GenericVariableFile
C#Python

Represents a parsed Fanuc variable file containing one or more variables

MemberTypeDescription
GenericVariableFile()
Constructor
Name
Property
read only
string
File name
Parent
Property
IGenericVariableType
Parent container
Variables
Property
read only
GenericVariable[]
Variables declared in this file
Equals(object)
Method
bool
GenerateVa(Stream)
Method
void
Generates a .va file and writes it to the specified stream
GenerateVa(string)
Method
void
Generates a .va file and writes it to the specified path
GeneratedVa()
Method
string
Generates the content of a .va variable file as a string.
GetField(string)
Method
GenericVariable
Gets a variable by name (case-insensitive)
GetHashCode()
Method
int
ToString()
Method
string
Class
FanucFileReaders
C#Python

Contains static functions to decode Fanuc files (variables, diagnosis, listing, ...)

MemberTypeDescription
Readers
Property
static
read only
IFileReader<IFanucContent>[]
Get the collection of all parsers
CurrentPositionReader
Field
static
DiagnosisReader<CurrentPosition,CurrentPositionReader>
Decode current position file curpos.dg
ErrorListReader
Field
static
ErrorListReader
Helper to read error files like errall.ls
IOStateReader
Field
static
DiagnosisReader<IOState,IOStateParser>
Decode IO Status file iostate.dg
ProgramStates
Field
static
DiagnosisReader<ProgramStates,ProgramStatesParser>
Decode task and program states prgstate.dg
SafetyStatusReader
Field
static
DiagnosisReader<SafetyStatus,SafetyStatusParser>
Decode IO Status file iostate.dg
SummaryDiagnosticReader
Field
static
SummaryDiagnosisReader
Helper to read summary diagnosis file summary.dg
VariableReader
Field
static
VariableReader
Helper to read variable files *.va
ReadFile(Stream, string, Languages)
Method
static
IFanucContent
Read any file by path on disc, recognize it by name and decode it
ReadFile(string, Languages)
Method
static
IFanucContent
Read any file by path on disc, recognize it by name and decode it

Easily integrate Universal Robots, Fanuc, Yaskawa, ABB or Staubli robots into your .NET, Python, LabVIEW or Matlab applications

UnderAutomation
Contact usLegal

© All rights reserved.