Class TNCFilesManager
A special class that contains a list of output files formed by postprocessor.
Inheritance
Namespace: SprutCAMTech.SCPostprocessor
Assembly: SprutCAMTech.SCPostprocessor.dll
Syntax
public class TNCFilesManager : Object
Constructors
TNCFilesManager(INCStorageManager)
Initializes a new instance of the TNCFilesManager class. Usually you don't need to create this class manually because there is already a globally accessible static instance Singletone, and must exist only one instance of this class.
Declaration
public TNCFilesManager(INCStorageManager ncStorageManager)
Parameters
Type | Name | Description |
---|---|---|
INCStorageManager | ncStorageManager | Link to the internal object INCStorageManager of the postprocessing system that can create new INCStorage instances. |
Properties
DefaultNCFilesOwner
This property contains a link to a global instance of INCFileOwner interface. In fact, this reference usually indicates the current postprocessor TPostprocessor object.
Declaration
public INCFileOwner DefaultNCFilesOwner { get; set; }
Property Value
Type | Description |
---|---|
INCFileOwner |
FileCount
The count of output files in the list.
Declaration
public int FileCount { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Returns the output file from the list by its index [0 .. FileCount-1].
Declaration
public TNCFile this[int Index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | Index | The index of an output file you want to get [0 .. FileCount-1]. |
Property Value
Type | Description |
---|---|
TNCFile | Returns TNCFile object that corresponds to the given index. |
OutputDisabled
This property contains "true" only if the writing to an output files was disabled by the call of DisableOutput() method. All implementations of TNCFile should check this property and skip real writing if it is "true".
Declaration
public bool OutputDisabled { get; }
Property Value
Type | Description |
---|---|
bool |
Singletone
The single global instance of the TNCFilesManager class. It contains the list of output files formed by postprocessor.
Declaration
public static TNCFilesManager Singletone { get; set; }
Property Value
Type | Description |
---|---|
TNCFilesManager |
Methods
Add(TNCFile)
Adds a new file (existing instance of TNCFile) to the end of the list.
Declaration
public void Add(TNCFile file)
Parameters
Type | Name | Description |
---|---|---|
TNCFile | file | The file to add to the list. |
AddExternalBinaryFile(string, string)
Creates a new external file (instance of TExternalNCFile class, not the file itself), assigns it a specified name of the output file and adds it to the list. Unlike AddExternalFile(string) method, the added file will be marked as binary (not text, for the purpose of correctly displaying its contents to the user). It is assumed that this file was formed or obtained by a postprocessor in some special way, for example, through an external third-party program, and added to the list of postprocessor output files already in the finished form.
Declaration
public void AddExternalBinaryFile(string outputFileName, string fileDescription)
Parameters
Type | Name | Description |
---|---|---|
string | outputFileName | The full path to an external file you want to add to the list of output files. |
string | fileDescription | Short textual description of the file content that will be shown to the user instead of hexadecimal representation. If fileDescription is empty then hexadecimal representation of its bytes will be shown. |
AddExternalFile(string, INCFileOwner)
Creates a new external file (instance of TExternalNCFile class, not the file itself), assigns it a specified name of the output file and adds it to the list. It is assumed that this file was formed or obtained by a postprocessor in some special way, for example, through an external third-party program, and added to the list of postprocessor output files already in the finished form.
Declaration
public void AddExternalFile(string outputFileName, INCFileOwner owner)
Parameters
Type | Name | Description |
---|---|---|
string | outputFileName | The full path to an external file you want to add to the list of output files. |
INCFileOwner | owner | The postprocessor that owns this file. |
AddExternalFile(string)
Creates a new external file (instance of TExternalNCFile class, not the file itself), assigns it a specified name of the output file and adds it to the list. It is assumed that this file was formed or obtained by a postprocessor in some special way, for example, through an external third-party program, and added to the list of postprocessor output files already in the finished form.
Declaration
public void AddExternalFile(string outputFileName)
Parameters
Type | Name | Description |
---|---|---|
string | outputFileName | The full path to an external file you want to add to the list of output files. |
DisableOutput()
Turns off the output to all output files. All writing commands (such as WriteLine(string)) will simply ignored and the real addition of new data into the file will not happen.
You can turn on it back using EnableOutput() method.
While DisableOutput is active the property OutputDisabled contains "true".
All CLData command handlers will continue to be called as it should be.
It is usefull when you want simply to ignore temporary some limited range of CLData commands (for example, to emulate idle subroutine call, or to insert some block of text instead of completely inappropriate set of CLData commands formed by SprutCAM).Declaration
public void DisableOutput()
EnableOutput()
Turns on the output to all output files back if it was turned of before by DisableOutput() method.
After that the property OutputDisabled contains "false" again.
Declaration
public void EnableOutput()
Flush()
Writes the buffered in memory data for the output files to a hard drive (to a temporary files, not to the final destination). Usually you don't need to call it manually, the postprocessing system calls it as needed.
Declaration
public void Flush()
IndexOf(TNCFile)
Looking for the specified file in the list and returns its index.
Declaration
public int IndexOf(TNCFile item)
Parameters
Type | Name | Description |
---|---|---|
TNCFile | item | The file to look for. |
Returns
Type | Description |
---|---|
int | If the file has been found in the list then its index will return. If there is no such file the return is "-1". |
SaveOuputFiles()
This method is called by the system automatically at the most final stage of the postprocessor's work. Here the contents of each of the output files are recorded from a temporary storage (in memory or temporary file) to the destination file specified in the OutputFileName property.
After this saving the OnFinalizeNCFiles(TNCFilesManager) handler of the postprocessor is called where you can implement some additional actions on the output files.
Declaration
public void SaveOuputFiles()