Skip to main content
Version: 2.7

SINUMERIK Device Commands

Sinumerik Control Driver offers several commands for file management.

Overview

Command AddressDescription
OpenFileStreamOpens a dnc stream for reading or writing.
CloseFileStreamCloses a dnc stream
ReadFileStreamReads from the dnc stream
WriteFileStreamWrite to the dnc stream
GetFileStreamStatusGets the status of the dnc stream
DeleteFileDeletes a file on the system.
Command AddressDescription
CreateDirectoryCreates a new directory.
DeleteDirectoryDeletes a directory.
GetCurrentDirectoryGets the current directory.
ChangeDirectoryChanges the current directory.
ReadDirectoryReads 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

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.String
AsyncTokenInput [OPT]Token for async callbackSystem.Int32
AccessModeInputAccess mode (Read or Write)System.Int32
HandleOutputFile handleSystem.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

ArgumentDirectionDescriptionData Type
AsyncTokenInput [OPT]Token for async callbackSystem.Int32
HandleInputFile handleSystem.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

ArgumentDirectionDescriptionData Type
HandleInputFile handleSystem.Int32
MaxBytesInputMaximum number of bytesSystem.Int32
ContentOutputContentSystem.Byte[]
LastContentOutputFlag 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

ArgumentDirectionDescriptionData Type
HandleInputFile handleSystem.Int32
ContentInputContentSystem.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

ArgumentDirectionDescriptionData Type
HandleInputStream handleSystem.Int32
ContentOutputContent (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

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameOutputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputdirectory name. If empty, the current directory is returned.System.String
ContentOutputJSON formatted directory contentSystem.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"
}
]
}