SINUMERIK Device Commands
Sinumerik Control Driver offers several commands for file management.
Overview
Command Address | Description |
---|---|
OpenFileStream | Opens a dnc stream for reading or writing. |
CloseFileStream | Closes a dnc stream |
ReadFileStream | Reads from the dnc stream |
WriteFileStream | Write to the dnc stream |
GetFileStreamStatus | Gets the status of the dnc stream |
DeleteFile | Deletes a file on the system. |
Command Address | Description |
---|---|
CreateDirectory | Creates a new directory. |
DeleteDirectory | Deletes a directory. |
GetCurrentDirectory | Gets the current directory. |
ChangeDirectory | Changes the current directory. |
ReadDirectory | Reads the content of the directory. |
Introduction to File Handling
The SINUMERIk uses different directories to store nc files, configurations and memory definitions (See Program Memory).
The root path starts with /
. Each sub directory and the file is separated by an additional /
.
Example: /_N_MPF_DIR/_N_PROG1_MPF
OpenFileStream
Opens the dnc stream for reading or writing depending on the AccessMode
.
Address: OpenFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
AsyncToken | Input [OPT] | Token for async callback | System.Int32 |
AccessMode | Input | Access mode (Read or Write) | System.Int32 |
Handle | Output | File handle | System.Int32 |
See DNC Model - OpenFileStream for details on arguments and return values.
Example:
{
"Id": "<generate your own id>",
"Name": "OpenFileStream",
"Type": "CommandNode",
"Address": "OpenFileStream",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "AccessMode",
"Type": "Input",
"DataType": "System.Int32"
},
{
"Name": "Handle",
"Type": "Output",
"DataType": "System.Int32"
}
]
}
CloseFileStream
Closes the dnc stream for reading or writing.
Address: CloseFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
AsyncToken | Input [OPT] | Token for async callback | System.Int32 |
Handle | Input | File handle | System.Int32 |
See DNC Model - CloseFileStream for details on arguments and return values.
Example:
{
"Id": "5608D2DA-7CAF-416A-B31F-42DF706B9FD0",
"Name": "CloseFileStream",
"Address": "CloseFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
}
]
}
ReadFileStream
Reads from a dnc stream
Address: ReadFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | File handle | System.Int32 |
MaxBytes | Input | Maximum number of bytes | System.Int32 |
Content | Output | Content | System.Byte[] |
LastContent | Output | Flag is the last content has been sent. | System.Boolean |
See DNC Model - ReadFileStream for details on arguments and return values.
Example:
{
"Id": "C71D6C63-6EEF-4020-98CC-6F3085AF4478",
"Name": "ReadFileStream",
"Address": "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 dnc stream
Address: WriteFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | File handle | System.Int32 |
Content | Input | Content | System.Byte[] |
See DNC Model - WriteFileStream for details on arguments and return values.
Example:
{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "WriteFileStream",
"Address": "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: GetFileStreamStatus
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | Stream handle | System.Int32 |
Content | Output | Content (JSON formatted) | System.String |
See DNC Model - GetFileStreamStatus for details on arguments and return values.
Example:
{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "GetFileStreamStatus",
"Address": "GetFileStreamStatus",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.String",
"Type": "Output",
"Description": ""
}
]
}
DeleteFile
Deletes a specific nc file within the selected Nc directory.
Address: DeleteFile
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "DeleteFile",
"Type": "CommandNode",
"Address": "DeleteFile",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String",
"Description": "Program Name"
}
]
}
MakeDirectory
Creates a sub directory.
Address: CreateDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "MakeDirectory",
"Type": "CommandNode",
"Address": "CreateDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
DeleteDirectory
Deletes a sub directory within the selected Nc directory.
Address: DeleteDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "DeleteDirectory",
"Type": "CommandNode",
"Address": "deleteDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
GetCurrentDirectory
Gets the current directory of the Nc.
Address: GetCurrentDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Output | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "GetCurrentDirectory",
"Type": "CommandNode",
"Address": "GetCurrentDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Output",
"DataType": "System.String"
}
]
}
SetCurrentDirectory
Sets the current directory of the Nc.
Address: Nc{n}.ChangeDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "SetCurrentDirectory",
"Type": "CommandNode",
"Address": "ChangeDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
ReadDirectory
Reads a directory content from the file system. The content is returned in a JSON format.
Address: ReadDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | directory name. If empty, the current directory is returned. | System.String |
Content | Output | JSON formatted directory content | System.String |
Example from a device info file:
{
"Id": "<generate your own id>",
"Name": "ReadDirectory",
"Type": "CommandNode",
"Address": "ReadDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String",
"Description": "Directory Name"
},
{
"Name": "Content",
"Type": "Output",
"DataType": "System.String",
"Description": "Directory Content"
}
]
}