EPLAN.EPLAN21.EASY.EXPORT

Contents

Description

Command for exporting EPLAN 21 data.

The EPLAN.EPLAN21.EASY.EXPORT command is called up via the API functions as specified in the EPLAN 21 API.

Parameters

All parameters have the prefix "EPL_PARAM_EXPORTEASY_"!

ParameterID Type Description
FILENAMES [IN,INDEX]
String
Name list of EASY-files that are to be used during export. This is an indexed parameter. The number of transferred file names has to be entered in index 0. The number of transferred file names must be identical to the number of objects existing in the iterator OBJECT_ITERATOR.
OBJECT_ITERATOR [IN]
EplHandle

Handle of an iterator for objects that are to be exported to an EASY-file.

The iterator may only contain objects of one type specified by the parameter OBJECT_TYPE (e.g. only plot frames or only projects.)

OBJECT_TYPE [IN]
Integer

The OBJECT_TYPE determines which objects are included in the iterator.

At the moment, the following types are supported:

  • EPL_OBJECTTYPE_FORM
  • EPL_OBJECTTYPE_PLOTFRAME
  • EPL_OBJECTTYPE_PROJECT
  • EPL_OBJECTTYPE_MACRO
  • EPL_OBJECTTYPE_SYMBOLFILE
DOREPLACE [IN][OPTIONAL]
Boolean

Determines whether existing EASY-files are to be overwritten.

  • 1: EASY-file will be overwritten
  • 0: EASY-file will not be overwritten (default)

Error Messages

The eplExecuteCommand function returns EPL_OK if the object could be correctly exported.

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 export.
EPL_ERR_FAILED The EASY export failed.
EPL_ERR_FILE_EXISTS The specified file does already exist (DOREPLACE not on 1)
EPL_ERR_FILENAME_EMPTY An object could not be exported as the associated file name in the FILENAMES parameter is empty.

Example

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
exportProject(EplSession s, EplHandle hdl)
{
        EplHandle ret;

        // Create command:
        EplHandle exportCommand =
                eplCreateCommand(s, "EPLAN.EPLAN21.EASY.EXPORT");

        // Could the command be created?
        if(exportCommand != EPL_ERROR)
        {
                // Determine file name:
 		eplSetParam(
                        s,
                        exportCommand,
                        EPL_PARAM_EXPORTEASY_FILENAMES,
                        L"1",
                        0);

                eplSetParam(
                        s,
                        exportCommand,
                        EPL_PARAM_EXPORTEASY_FILENAMES,
                        L"c:\\tmp\\test.prj",
                        1);

                // Number of list elements
                eplSetParam(
                        s,
                        exportCommand,
                        EPL_PARAM_EXPORTEASY_FILENAMES,
                        L"1",
                        0);

                hIter = eplCreateEmptyIterator(s, EPL_OBJECTTYPE_PROJECT);
                eplInsert(s, hIter, hdl);

                // Set object iterator
                eplSetParamHandle(
                        s,
                        exportCommand,
                        EPL_PARAM_EXPORTEASY_OBJECT_ITERATOR,
                        itow(hIter, buf, 10),
                        0);

                // Set EplObjType:
                wchar_t buf[20];
                eplSetParam(
                        s,
                        exportCommand,
                        EPL_PARAM_EXPORTEASY_OBJTYPE,
                        itow(EPL_OBJECTTYPE_PROJECT, buf, 10),
                        0);

                // Execute command:
                ret = eplExecuteCommand(s, exportCommand);

                // Query result:
                if(ret == EPL_ERROR)
                {
                        /* Error handling
                           ...
                         */
                }
        } else {
                /* Error handling
                   ...
                 */
                ret = EPL_ERROR;
        }

        eplCloseObject(exportCommand);

        return ret;
}

Reference