Command for importing EPLAN 21 EASY files.
The EPLAN.EPLAN21.EASY.IMPORT command is called up via the API functions as specified in the EPLAN 21 API.
All parameters have the prefix "EPL_PARAM_IMPORTEASY_".
ParameterID | Type | Description |
---|---|---|
FILENAME | [IN] String |
Name of the EASY file. |
NAME | [IN] String |
Resource name which is to be set during import. |
TYPE | [IN] Integer |
OBJTYPE The OBJTYPE determines the type of the EASY file. At the moment, the following types are supported:
|
DBHANDLE | [IN, OPTIONAL] EplHandle |
Handle to the database into which the import is to be carried out. If no handle is transferred, EPLAN will use the first main database of the working set that was opened first for the import. Note: For forms, plot frames, symbol files and macros any project database of a working set can be specified; whereas for projects the database in which a project has to be saved must be transferred. |
DOREPLACE | [IN, OPTIONAL] Boolean |
Determines if objects that already exist in the database are to be overwritten.
|
FORCELOCAL | [IN, OPTIONAL] Boolean |
Specifies whether master data are saved on the local project level although the current user group is to save master data on the global business level. (This parameter is only relevant if the current database is configured to support local master data.)
|
CHANGE_FORMNAMES | [IN, index, OPTIONAL] String |
List of the form names which are to be changed when a project or a macro is imported.
Each list entry has to contain the original name and the requested name separated by a tab stop ('/t'). The requested form must exist either in the database or as an EASY file in the default directory. This list is only considered if the object is of the EPL_OBJECTTYPE_PROJECT or EPL_OBJECTTYPE_MACRO type. |
CHANGE_FRAMENAMES | [IN, index, OPTIONAL] String |
List of the plot-frame names which are to be changed when a project or a macro is imported.
Each list entry has to contain the original name and the requested name separated by a tab stop ('\t'). The requested plot frame must exist either in the database or as an EASY file in the default directory. This list is only considered if the object is of the EPL_OBJECTTYPE_PROJECT or EPL_OBJECTTYPE_MACRO type. |
CHANGE_SYMBOLFILENAMES | [IN, index, OPTIONAL] String |
List of the symbol-data names which are to be changed when a project or a macro is imported.
Each list entry has to contain the original name and the requested name separated by a tab stop ('\t'). The requested symbol file must exist either in the database or as an EASY file in the default directory. This list is only considered if the object is of the EPL_OBJECTTYPE_PROJECT or EPL_OBJECTTYPE_MACRO type. |
RESULT | [OUT] Integer |
After execution of the command, this parameter can be used to query the handle of the created object.
|
The eplExecuteCommand function returns EPL_OK if the file could be correctly imported.
If the command fails, eplExecuteCommand returns the value EPL_ERROR. In this case, the error log can contain the following errors:
ErrorID | Description |
---|---|
EPL_ERR_NO_RIGHT | The current user group does not have the rights to carry out an EASY import. |
EPL_PARAM_IMPORTEASY_DBHANDLE | The transferred database handle is invalid. |
EPL_ERR_IMPORTEASY_NO_DATABASE_LOCK | The target database has not been locked. |
EPL_ERR_FAILED | The EASY import failed. |
The following example shows a function which imports a project into an already opened database. If the project is already contained in the database, it will not be overwritten.
EplHandle importProject(EplSession s) { EplHandle ret; // Create command: EplHandle importCommand = eplCreateCommand(s, "EPLAN.EPLAN21.EASY.IMPORT"); // Could the command be created? if(importCommand != EPL_ERROR) { // Determine file name: eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_FILENAME, L"c:\\tmp\\test.prj", 0); // Determine resource name: eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_NAME, L"Test2000", 0); // Set EplObjType: wchar_t buf[20]; eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_TYPE, itow(EPL_OBJECTTYPE_PROJECT, buf, 10), 0); // Frame whose name is to be changed: eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_CHANGE_FRAMENAMES, L"DIN_A3Q_0-9\tDIN_A3Test", 1); // Frame whose name is to be changed: eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_CHANGE_FRAMENAMES, L"DIN_A3Q_1-5\tDIN_A3Test2", 2); // Number of frames whose names are to be changed: eplSetParam( s, importCommand, EPL_PARAM_IMPORTEASY_CHANGE_FRAMENAMES, itow(2, buf, 10), 0); // Execute command: ret = eplExecuteCommand(s, importCommand); // Query result: if(ret == EPL_OK) { eplGetParam( s, importCommand, EPL_PARAM_IMPORTEASY_RESULT, 0, buf, 20); EplHandle prjHandle = wcstol(buf, NULL, 10); /* ... */ } } else { /* Error handling ... */ ret = EPL_ERROR; } eplCloseObject(s, importCommand); return ret; } |