NC-Explorer¶
Overview¶
This addin can be used to select data files from different sources using one dialog box.
The data files are saved in the NC file format in a specified directory. For each file an information record is saved in a data base. To access the data UniPlot provides a browser. The selected files are copied to the local hard drive.
The NC-Explorer can store the data from sources if an import filter is available.

Installation¶
Choose (Tools=>Add-In Manager) and select the addin NC-Explorer
.
Create a file in the uniplot\addin\rs_explorer
directory with the name
rs_explorer.ini. You can use the file rs_explorer_example.ini
as a
template.
Example:
;
; rs_explorer.ini
;
[NC-Explorer]
DB-Type = sqlite3
DB-Connect-String = d:\nc_daten2\uniplot_db.udb
DB-Ini-File = d:\nc_daten2\nce-database.ini
Modify the path names. You can use UNC path names, for example
\\p3200server\data\uniplot_daten
. The path DB-Connect-String
must contain the data base name. The data base will be created in the next
stepl. The path DB-Ini-File
must contain the ini-file name of the database.
Setup the data base¶
1. Create the directory where the data base should be saved. This directory should be accessable with read access from all computers that would like to connect.
2. Create an ini file with the namen nce-database.ini
in the new
directory. An example is found in the uniplot\addin\rs_explorer
directory.
Example:
;
; nce-database.ini
;
; Column names in the data base:
[NC-Attribs-DB]
nAttrib=4
Attribute1=MOT_TYP
Attribute2=MOT_NR
Attribute3=Sachbearbeiter
Attribute4=Bediener
; Column names displayed in the UniPlot-Explorer
[NC-Attribs-Exlorer]
Attribute1=Motortyp
Attribute2=Motor-Nr.
Attribute3=Sachbearbeiter
Attribute4=Bediener
; attribute names in d2t files
[d2t]
Attribute1=MOT_TYP
Attribute2=MOT_NR
Attribute3=Sachbearbeiter
Attribute4=Bediener
In the NC-Attribs-DB
section you must specify the number of attributes that
you would like to save in the database (nAttrib=4) followed by the attributes.
Only use the characters a-z, A-Z, Numbers and underscores. For each name
a column in the database table will be created.
The section NC-Attribs-Browser must contain an identical number of attributes. This section contains the names displayed in th UniPlot browser.
For each file type a separate section must be specified. The example contains
only one data source definition, d2t
. The name in the square brackets
should be a short name. The name will be displayed in the browser in a column
by the name Type. Each attribute contains a name of a global NC attribute. The
names are case sensitive.
When the ini file is complete start UniPlot and open the file
nce_create_database.ic
. Press F4 and open the UniPlot command window.
Tyhe in the following command:
* _NCE_CreateNewDB()
This should create the data base with the name:file:uniplot_db.udb.
If you have to modify or add attributes to the nce-database.ini
file
you must recreate the database. To do so you must delete the file
uniplot_db.udb
and delete the directory data
as well.
Setup the File Watch Function:¶
Open the file uniplot\addin\rs_explorer\NCE_Watch_Example.ic
Modify the keys Type, ssDirToWatch and svFilter.
// oDB.Type = Short Text must be indentical with the ini file nce-database.ini
// oDB.ssIniFile = Complete file name to he ini file nce-database.ini
// oDB.ssDirToWatch = Name of a directory to watch
// oDB.svFilter = Vector with file name extension to wath, e.g ["*.*"] or ["*.utx", "*.xls"]
def NCE_GetSourceInfo(oDB)
{
oDB.nSources = 2;
oSource = [.];
oSource.Type = "NC";
oSource.ssDirToWatch = "D:\nc-data\nc.data-nc";
oSource.svFilter = "*.nc";
oDB.oSource[1] = oSource;
oSource = [.];
oSource.Type = "d2t";
oSource.ssDirToWatch = "d:\nc-data\nc-data-d2t\";
oSource.svFilter = "*.utx";
oDB.oSource[2] = oSource;
/*
// Example with exclude list
oSource = [.];
oSource.Type = "DC4";
oSource.ssDirToWatch = "d:\nc-data\nc-data-dc4\";
oSource.bExcludeFilter = TRUE;
oSource.svFilter = ["*.ini", "*.pdf", "*.txt", "*.qm", "*.htm", "*.exe"];
oDB.oSource[3] = oSource;
*/
return oDB;
}
_NCE_Add_Scan_Menu()
_NCE_StartWatching()
For a first test it makes sense to create a directory with some test data files. While the program is running you can use the Microsoft Explorer to copy new files to the directory. If the test was successful you can remove the database the the data directory.
Copy the NCE_Watch_Example.ic
into the UniPlot autoload-directory.
Make sure that UniPlot will be started when the data-server is running.
The _NCE_StartWatching()
function will wath the ssDirToWatch and convert all
new files to NC files, read the attributes from the NC files and add a new record
to the data base.
To add already existing files to the data base choose Extras=>Execute Full Scan.
A log file is created in the database directory. The log file contains error messages and information about the added files.
UniScript¶
The browser can be opened calling the NCE_Explorer()
function. The function
returns a string vector with the selected NC files or the scalar string
“DLG_CANCEL” if the Cancel button has been selected.
Problems¶
If you have any problems using the browser please do not hesitate to contact us.
id-2080630