Command for restoring a previously executed data backup.
The EPLAN.EPLAN21.ARCHIVE.RESTORE command is called up via the API functions specified in EPLAN 21 API and is only available if the epm31.erx system expansion has been loaded.
This command can be used for restoring data from an EPLAN archive (.ez file). In an archive, one or several projects of a working set including their associated master data (plot frame, form, symbol files, macros, DWG files and bitmaps) can be archived in a compressed format. It is thus possible to restore individual master data, projects with master data or even the entire working set from the archive. During the restoration process the project and the master data can be renamed if they already exist (see parameter description).
All parameters have the prefix "EPL_PARAM_ARCHIVE_", except for the last parameter "EPL_PARAM_RESTORE_REPLACEFLAG"!
If all parameters with index are empty, all data of the archive will be restored. If , in addition, the DBHANDLE parameter is empty and the archive contains a working set, the entire working set is restored. Otherwise, all projects of the archive will be integrated into the desired project database. If only certain projects are to be restored from the archive, all dependent master data must already exist in the desired database. (See: EPLAN.EPLAN21.ARCHIVE.READ_PROJECTFILES)
ParameterID | Type | Description |
---|---|---|
NAME | [IN] String |
Name of the archive from which the project(s) are to be restored. |
DBHANDLE | [IN] EplHandle |
Handle of the database in which the project(s) are to be restored. If the parameter has not been set or has the value -1, the first open project database is used. |
PROJECTNAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the projects that are to be restored from the archive. The command expects a file name without a path (e.g. test.prj). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.prj'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
FORMNAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the forms that are to be restored from the archive. The command expects a file name without a path (e.g. test.frm). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.frm'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
FRAMENAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the plot frames that are to be restored from the archive. The command expects a file name without a path (e.g. test.plt). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.plt'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
SYMBOLFILENAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the symbol files that are to be restored from the archive. The command expects a file name without a path (e.g. test.sym). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.sym'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
MACRONAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the macros that are to be restored from the archive. The command expects a file name without a path (e.g. test.mac). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.mac'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
BITMAPNAMES | [IN, index, OPTIONAL] String |
Parameter for the names of the bitmaps incl. directory specification that are to be restored from the archive. Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
DWGFILENAMES | [IN, index, OPTIONAL] String |
Parameter for the DWG files that are to be restored from the archive. The command expects a file name without a path (e.g. test.dwg). Each entry can contain either only the file name or the file name plus a further name without extension, separated by a tab stop ('\t'). This name will then be used in the database. (e.g. test.dwg'\t'newName) Index 0 is to contain the number of valid entries of the parameter, which follow index 0. |
REPLACEFLAG | [IN] EplBoolean |
Flag for overwriting data in the desired database.
1: Data with identical names will be replaced. |
The eplExecuteCommand function returns EPL_OK if the restoring could be correctly executed.
If the command fails, eplExecuteCommand returns the value EPL_ERROR. The ERROR_ID of the entries in the error log can be individually queried via the indexed parameter EPL_PARAM_COMMAND_ERROR_ID. The EPL_PARAM_COMMAND_ERROR_DESCRIPTION parameter with identical index contains an error description for the ERROR_ID.
In this case, the error log can contain the following errors:
ErrorID | Description |
---|---|
EPL_ERR_GENERAL | A system error has occurred. |
TCHAR buffer[512]; EplSession s = eplCreateSession(); //... EplHandle restoreCommand = eplCreateCommand(s, L"EPLAN.EPLAN21.ARCHIVE.RESTORE"); if(restoreCommand != EPL_ERROR) { eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_NAME, L"d:\\archive\\test.ez", 0); eplSetHandleParam(s, restoreCommand, EPL_PARAM_ARCHIVE_DBHANDLE, hDB, 0); eplSetParam(s, restoreCommand, EPL_PARAM_RESTORE_REPLACEFLAG, L"1", 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_PROJECTNAMES, L"project1.prj", 1); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_PROJECTNAMES, _ltot(1, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_FORMNAMES, _ltot(0, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_FRAMENAMES, _ltot(0, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_SYMBOLFILENAMES, _ltot(0, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_MACRONAMES, _ltot(0, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_BITMAPNAMES, _ltot(0, buffer, 10), 0); eplSetParam(s, restoreCommand, EPL_PARAM_ARCHIVE_DWGFILENAMES, _ltot(0, buffer, 10), 0); ret = eplExecuteCommand(s, restoreCommand); } |