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 Address | Description |
---|---|
Nc1.ReadFile | Reads a single ASCII file from the NC |
Nc1.ReadDirectory | Reads the directory content |
Nc1.MakeDirectory | Creates a new directory |
Nc1.WriteFile | Write a single ASCII file to the NC |
Nc1.DeleteFile | Deletes a single file from the NC |
Nc1.DeleteDirectory | Deletes the directory |
Nc1.GetCurrentDirectory | Reads the current directory name |
Nc1.SetCurrentDirectory | Changes the current directory |
HEIDENHAIN also supports stream based transmissions. This allows to transmit binary as well as very large files (> 10MB).
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 Address | Description |
---|---|
Nc1.OpenFileStream | Opens a file stream for reading or writing. |
Nc1.CloseFileStream | Closes a file stream |
Nc1.ReadFileStream | Reads from the file stream |
Nc1.WriteFileStream | Write to the file stream |
Nc1.GetFileStreamStatus | Gets the status of the file stream |
Tool Management
Command Address | Description |
---|---|
Nc1.ReadToolEntry | Reads a tool entry from TOOL.T . |
Nc1.WriteToolEntry | Writes 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.
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | directory name | System.String |
Content | Output | JSON formatted directory content | System.String |
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
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.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.
The directory must be empty.
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.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.
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
Content | Output | Text content | System.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.
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
Content | Input | Text content | System.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
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.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
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Output | Name 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.
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Name 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):
Not all NC control types allow all values to be written or read.
Name | FieldName | Data Type | Read | Write |
---|---|---|---|---|
Name by which the tool is called in the program. | NAME | System.String | X | X |
Compensation value for tool length L | L | System.Double | X | X |
Compensation value for the tool radius R | R | System.Double | X | X |
Tool radius R2 for toroid cutters | R2 | System.Double | X | X |
Delta value for tool length L | DL | System.Double | X | X |
Delta value for tool radius R | DR | System.Double | X | X |
Delta value for tool radius R2 | DR2 | System.Double | X | X |
Set tool lock | TL | System.Boolean | X | X |
Number of a replacement tool | RT | System.Boolean | X | X |
Maximum tool life in minutes | TIME1 | System.Int16 | X | X |
Maximum tool life in minutes during TOOL CALL | TIME2 | System.Int16 | X | X |
Current age of the tool in minutes. Only iTNC530 | CUR.TIME | System.Int32 | X | X |
Current age of the tool in minutes. Only TNC640 | CUR_TIME | System.Int32 | X | X |
Comment on tool (up to 16 characters) | DOC | System.String | X | X |
Number of teeth | CUT | System.Byte | X | X |
Permissible deviation from tool length L for wear detection | LTOL | System.Double | X | X |
Permissible deviation from tool radius R for wear detection | RTOL | System.Double | X | X |
Permissible deviation from tool radius R2 for wear detection | R2TOL | System.Double | X | X |
Cutting direction of the tool for measuring the tool during rotation | DIRECT. | System.Byte | X | X |
Information on this tool that is to be sent to the PLC | PLC | System.Byte | X | X |
For tool length measurement | TT:L-OFFS | System.Double | X | X |
Tool radius measurement | TT:R-OFFS | System.Double | X | X |
Permissible deviation from tool length L for breakage detection | LBREAK | System.Double | X | X |
Permissible deviation from tool radius R for breakage detection | RBREAK | System.Double | X | X |
Tooth length of the tool for Cycle 22 | LCUTS | System.Double | X | X |
Maximum plunge angle of the tool | ANGLE | System.Double | X | X |
Tool type | TYP | System.String | X | X |
Tool material | TMAT | System.String | X | X |
Cutting data table | CDT | System.String | X | X |
Value of this tool that is to be sent to the PLC | PLC-VAL | System.Double | X | X |
Center misalignment in ref. axis | CAL-OF1 | System.Double | X | X |
Center misalignment minor axis | CAL-OF2 | System.Double | X | X |
Spindle angle for calibration | CAL-ANG | System.Double | X | X |
Tool type for evaluation in the pocket table | PTYP | System.Byte | X | X |
Limits the spindle speed for this tool. | NMAX | System.Byte | X | X |
Liftoff the tool in direction of the positive tool axis | LIFTOFF | System.Boolean | X | X |
Machine-dependent function 1 | P1 | System.Double | X | X |
Machine-dependent function 2 | P2 | System.Double | X | X |
Machine-dependent function 3 | P3 | System.Double | X | X |
Kinematics description for vertical milling heads | KINEMATIC | System.String | X | X |
Point angle of the tool | T-ANGLE | System.Double | X | X |
Thread pitch of the tool | PITCH | System.Double | X | X |
Control setting for the adaptive feed control | AFC | System.String | X | X |
Last usage of the Tool | LAST_USE | System.DateTime | X | X |
ACC | System.Byte | X | X |
Reading Tool Records
Reads a tool record from TOOL.T
.
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:
Argument | Direction | Description | Data Type |
---|---|---|---|
ToolId | Input | Id of the tool (T) | System.Int32 |
Content | Output | Tool record, formatted in JSON | System.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
.
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
Argument | Direction | Description | Data Type |
---|---|---|---|
ToolId | Input | Id of the tool (T) | System.Int32 |
Content | Input | Tool record, formatted in JSON | System.String |
Address: Nc1.WriteToolRecord
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:
Argument | Direction | Description | Data Type |
---|---|---|---|
ToolId | Input | Id of the tool (T) | System.Int32 |
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"
}
]
}