Skip to main content
Version: 2.6

HEIDENHAIN Device Commands

HEIDENHAIN Control Driver offers several commands for file and tool management.

Overview

File Handling

The file handling uses the relative or absolute path notation:

  • Absolute: TNC:\DEMO\reset.h
  • Relative: .\DEMO\reset.h
Command AddressDescription
Nc1.ReadFileReads a single ASCII file from the NC
Nc1.ReadDirectoryReads the directory content
Nc1.MakeDirectoryCreates a new directory
Nc1.WriteFileWrite a single ASCII file to the NC
Nc1.DeleteFileDeletes a single file from the NC
Nc1.DeleteDirectoryDeletes the directory
Nc1.GetCurrentDirectoryReads the current directory name
Nc1.SetCurrentDirectoryChanges the current directory

HEIDENHAIN also supports stream based transmissions. This allows to transmit binary as well as very large files (> 10MB).

NOTE

Some services like OPC-UA Server have transmission limits. Use stream based transmissions and limit the transmission size when reading or writing parts of the file.

Command AddressDescription
Nc1.OpenFileStreamOpens a file stream for reading or writing.
Nc1.CloseFileStreamCloses a file stream
Nc1.ReadFileStreamReads from the file stream
Nc1.WriteFileStreamWrite to the file stream
Nc1.GetFileStreamStatusGets the status of the file stream

Tool Management

Command AddressDescription
Nc1.ReadToolEntryReads a tool entry from TOOL.T.
Nc1.WriteToolEntryWrites a tool entry to TOOL.T.

File Handling

The following commands respect the File Handling of the HumanOS DMC Model.

ReadDirectory

Reads a directory content from the NC control. The content is returned in a JSON format.

ArgumentDirectionDescriptionData Type
NameInputdirectory nameSystem.String
ContentOutputJSON formatted directory contentSystem.String
NOTE

To read the current directory use the directory name .\.

Example from a device info file:

{
"Id": "af2cc182-bdca-4c7e-95e2-ccb9f0e8c0e4",
"Name": "ReadDirectory",
"Address": "Nc1.ReadDirectory",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Content",
"Type": "Output",
"DataType": "System.String"
},
{
"Name": "Name",
"DataType": "System.String"
}
]
}

The content is JSON formatted. Example:

[
{
"Name": "..",
"Type": "Directory",
"Size": 4096,
"ModificationAt": "2022-12-17T14:01:56"
},
{
"Name": "AFC",
"Type": "Directory",
"ModificationAt": "2022-12-16T20:31:20"
},
{
"Name": "TOOL.T",
"Size": 31524,
"ModificationAt": "2022-12-16T20:31:20"
},
{
"Name": "TOOL_P.TCH",
"Size": 7140,
"ModificationAt": "2022-12-16T20:31:20"
}
]

MakeDirectory

Creates a directory on the NC control

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.String

Example:

{
"Id": "e9a75952-e4ad-470f-bcac-e810e161d927",
"Name": "MakeDirectory",
"Address": "Nc1.MakeDirectory",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String"
}
]
}

DeleteDirectory

Deletes a directory from the NC control.

IMPORTANT

The directory must be empty.

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.String

Example:

{
"Id": "87159dfe-9a7e-4776-97c4-f075493e7695",
"Name": "DeleteDirectory",
"Address": "Nc1.DeleteDirectory",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String",
"Description": ""
}
]
}

ReadFile

Reads a text or ASCII based file from the NC control.

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.String
ContentOutputText contentSystem.String

Example:

{
"Id": "a8384be6-fc11-4208-902e-aa2fab298555",
"Name": "ReadFile",
"Address": "Nc1.ReadFile",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String"
},
{
"Name": "Content",
"Type": "Output",
"DataType": "System.String"
}
]
}

WriteFile

Writes a text or ASCII based file to the NC control.

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.String
ContentInputText contentSystem.String

Example:

{
"Id": "4f521861-b0bb-4dbd-9887-fc75271c2631",
"Name": "WriteFile",
"Address": "Nc1.WriteFile",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Content",
"DataType": "System.String"
},
{
"Name": "Name",
"DataType": "System.String"
}
]
}

DeleteFile

Deletes a file from the NC control

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.String

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "DeleteFile",
"Address": "Nc1.DeleteFile",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String"
}
]
}

GetCurrentDirectory

Gets the name of the current directory from the NC control

ArgumentDirectionDescriptionData Type
NameOutputName of the current directory.System.String

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "GetCurrentDirectory",
"Address": "Nc1.GetCurrentDirectory",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"Type": "Output",
"DataType": "System.String"
}
]
}

SetCurrentDirectory

Changes the current directory on the NC control. All relative paths given to other file handling commands are now related to this directory.

ArgumentDirectionDescriptionData Type
NameInputName of the current directory.System.String

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "SetCurrentDirectory",
"Address": "Nc1.SetCurrentDirectory",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String"
}
]
}

Stream-based File Handling

The following commands respect the stream-based File Handling of the HumanOS DMC Model.

OpenFileStream

Opens the file stream for reading or writing depending on the AccessMode.

Address: Nc1.OpenFileStream

See DNC Model - OpenFileStream for details on arguments and return values.

Example:

{
"Id": "23416EF6-6902-4212-ADBD-85CE5CE66210",
"Name": "OpenFileStream",
"Address": "Nc1.OpenFileStream",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Name",
"DataType": "System.String",
"Description": ""
},
{
"Name": "AccessMode",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Handle",
"Type": "Output",
"DataType": "System.Int32",
"Description": ""
}
]
}

CloseFileStream

Closes the file stream for reading or writing.

Address: Nc1.CloseFileStream

See DNC Model - CloseFileStream for details on arguments and return values.

Example:

{
"Id": "5608D2DA-7CAF-416A-B31F-42DF706B9FD0",
"Name": "CloseFileStream",
"Address": "Nc1.CloseFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
}
]
}

ReadFileStream

Reads a file stream

Address: Nc1.ReadFileStream

See DNC Model - ReadFileStream for details on arguments and return values.

Example:

{
"Id": "C71D6C63-6EEF-4020-98CC-6F3085AF4478",
"Name": "ReadFileStream",
"Address": "Nc1.ReadFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "MaxBytes",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.Byte[]",
"Type": "Output",
"Description": ""
},
{
"Name": "LastContent",
"DataType": "System.Boolean",
"Type": "Output",
"Description": ""
}
]
}

WriteFileStream

Writes to a file stream

Address: Nc1.WriteFileStream

See DNC Model - WriteFileStream for details on arguments and return values.

Example:

{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "WriteFileStream",
"Address": "Nc1.WriteFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.Byte[]",
"Description": ""
}
]
}

GetFileStreamStatus

Gets the status of the dnc stream

Address: Nc1.GetFileStreamStatus

See DNC Model - GetFileStreamStatus for details on arguments and return values.

Example:

{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "GetFileStreamStatus",
"Address": "Nc1.GetFileStreamStatus",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.String",
"Type": "Output",
"Description": ""
}
]
}

Tool Handling

Following tool table fields are accessible (from HEIDENHAIN operation manual):

IMPORTANT

Not all NC control types allow all values to be written or read.

NameFieldNameData TypeReadWrite
Name by which the tool is called in the program.NAMESystem.StringXX
Compensation value for tool length LLSystem.DoubleXX
Compensation value for the tool radius RRSystem.DoubleXX
Tool radius R2 for toroid cuttersR2System.DoubleXX
Delta value for tool length LDLSystem.DoubleXX
Delta value for tool radius RDRSystem.DoubleXX
Delta value for tool radius R2DR2System.DoubleXX
Set tool lockTLSystem.BooleanXX
Number of a replacement toolRTSystem.BooleanXX
Maximum tool life in minutesTIME1System.Int16XX
Maximum tool life in minutes during TOOL CALLTIME2System.Int16XX
Current age of the tool in minutes. Only iTNC530CUR.TIMESystem.Int32XX
Current age of the tool in minutes. Only TNC640CUR_TIMESystem.Int32XX
Comment on tool (up to 16 characters)DOCSystem.StringXX
Number of teethCUTSystem.ByteXX
Permissible deviation from tool length L for wear detectionLTOLSystem.DoubleXX
Permissible deviation from tool radius R for wear detectionRTOLSystem.DoubleXX
Permissible deviation from tool radius R2 for wear detectionR2TOLSystem.DoubleXX
Cutting direction of the tool for measuring the tool during rotationDIRECT.System.ByteXX
Information on this tool that is to be sent to the PLCPLCSystem.ByteXX
For tool length measurementTT:L-OFFSSystem.DoubleXX
Tool radius measurementTT:R-OFFSSystem.DoubleXX
Permissible deviation from tool length L for breakage detectionLBREAKSystem.DoubleXX
Permissible deviation from tool radius R for breakage detectionRBREAKSystem.DoubleXX
Tooth length of the tool for Cycle 22LCUTSSystem.DoubleXX
Maximum plunge angle of the toolANGLESystem.DoubleXX
Tool typeTYPSystem.StringXX
Tool materialTMATSystem.StringXX
Cutting data tableCDTSystem.StringXX
Value of this tool that is to be sent to the PLCPLC-VALSystem.DoubleXX
Center misalignment in ref. axisCAL-OF1System.DoubleXX
Center misalignment minor axisCAL-OF2System.DoubleXX
Spindle angle for calibrationCAL-ANGSystem.DoubleXX
Tool type for evaluation in the pocket tablePTYPSystem.ByteXX
Limits the spindle speed for this tool.NMAXSystem.ByteXX
Liftoff the tool in direction of the positive tool axisLIFTOFFSystem.BooleanXX
Machine-dependent function 1P1System.DoubleXX
Machine-dependent function 2P2System.DoubleXX
Machine-dependent function 3P3System.DoubleXX
Kinematics description for vertical milling headsKINEMATICSystem.StringXX
Point angle of the toolT-ANGLESystem.DoubleXX
Thread pitch of the toolPITCHSystem.DoubleXX
Control setting for the adaptive feed controlAFCSystem.StringXX
Last usage of the ToolLAST_USESystem.DateTimeXX
ACCSystem.ByteXX

Reading Tool Records

Reads a tool record from TOOL.T.

Note

The plugin returns the data as it is stored in the TOOL.T table. All fields are returned.

Address: Nc1.ReadToolRecord

The command requires following arguments:

ArgumentDirectionDescriptionData Type
ToolIdInputId of the tool (T)System.Int32
ContentOutputTool record, formatted in JSONSystem.String

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "ReadToolRecord",
"Type": "CommandNode",
"Address": "Nc1.ReadToolRecord",
"Arguments": [
{
"Name": "ToolId",
"DataType": "System.Int32",
"Type": "Input"
},
{
"Name": "Content",
"DataType": "System.String",
"Type": "Output"
}
]
}

Returned content (formatted in JSON):

[
{
"Name": "NAME",
"DataType": "System.String",
"Value": "D2"
},
{
"Name": "L",
"DataType": "System.Double",
"Value": 30.0
},
{
"Name": "R",
"DataType": "System.Double",
"Value": 1.0
},
{
"Name": "R2",
"DataType": "System.Double",
"Value": 0.0
}
...
]

Writing Tool Record

Writes a tool record to TOOL.T.

IMPORTANT

The plugin transmits the content directly to TOOL.T. Ensure, that data types and values are correct.

The record must not be complete. Only the values provided are overwritten in the TOOL.T table

ArgumentDirectionDescriptionData Type
ToolIdInputId of the tool (T)System.Int32
ContentInputTool record, formatted in JSONSystem.String

Address: Nc1.WriteToolRecord

Note

If writing fails, please check following points:

  • On iTNC530, only tools can be written that already exist in TOOL.T
  • The tool table is locked if an operator edits the table on the machine.

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "WriteToolRecord",
"Type": "CommandNode",
"Address": "Nc1.WriteToolRecord",
"Arguments": [
{
"Name": "ToolId",
"DataType": "System.Int32",
"Type": "Input"
},
{
"Name": "Content",
"DataType": "System.String",
"Type": "Input"
}
]
}

Deleting Tool Records

Deletes a tool entry from TOOL.T.

Address: Nc1.DeleteToolRecord

The command needs following inputs:

ArgumentDirectionDescriptionData Type
ToolIdInputId of the tool (T)System.Int32
IMPORTANT

iTNC530 does not really delete the tool entry from TOOL.T. It clears simply the name and dimensions from the table.

Example:

{
"Id": "adb73d17-1ca3-4fe9-adc8-9de21aacec4c",
"Name": "DeleteToolRecord",
"Type": "CommandNode",
"Address": "Nc1.DeleteToolRecord",
"Arguments": [
{
"Name": "ToolId",
"DataType": "System.Int32",
"Type": "Input"
}
]
}