EPLAN.EPLAN21.PAGE.CREATE

Contents

Description

Command for inserting a page into a project.

The "EPLAN.EPLAN21.PAGE.CREATE" command is called up via the API functions as specified in the EPLAN 21 API.

Parameters

All parameters have the prefix "EPL_PARAM_PAGE_CREATE_".

ParameterID Type Description
PROJECT [IN]
EplHandle
Handle of the project in which the page is to be created.
MACRO [IN]
EplHandle
Handle of the macro in which the page is to be created.
TEMPLATE [IN, OPTIONAL]
EplHandle
Handle of an existing page which is used as template for the new page.
PAGETYPE [IN, OPTIONAL]
Integer
As an alternative to a template, a page type may also be indicated. This parameter is only evaluated if the page is not generated with a template. Valid values are for example:
  • 1 (Schematic)
  • 2 (Free graphics)
  • 9 (Control-panel layout)
  • 18 (Title page)
FRAME [IN, OPTIONAL]
EplHandle
Handle of an existing plot frame which is set on the newly generated page. This parameter is only evaluated if the page is not generated with a template.
FORM [IN, OPTIONAL]
EplHandle
Handle of an existing form which is set in the newly generated page. This parameter is only evaluated if the page is not generated with a template.
COUNT [IN, OPTIONAL]
Integer
Number of pages to be generated. This parameter is optional; unless it is set, 1 is taken as value. A maximum of 1000 pages can be created at a time.
PROPERTIES [IN, OPTIONAL]
EplHandle
Handle of an iterator for objects of the EPL_OBJECTTYPE_PROPERTYDEF type. These objects contain properties which are set on the generated pages.
NAME [IN, OPTIONAL]
String
Name of the new page.
RESULT [OUT]
EplHandle
If the command is successfully executed, this parameter receives the handle of the new page.
Caution: If more than one page were created a handle to an iterator for pages is returned.
LASTPAGEIDX [OUT]
Integer
Contains page index of the page which was generated last.
NAMECHANGED [OUT]
Integer
Indicates how often the page name had to be changed to be unique.

Error Messages

The eplExecuteCommand function returns EPL_OK if the page could be successfully inserted into the project.

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 is not allowed to create a page.
EPL_ERR_FAILED The new page could not be created.
EPL_ERR_INVALID_ARGUMENT The parameter PROJEKT or TEMPLATE has the wrong type, the parameter NAME is empty, or an invalid page number was transferred to the parameter COUNT.

Example

The following example shows a function which inserts a new page into a project.
The handle of the project and the template page must be determined first.
If successful, the return value of the function is the handle of the new page, otherwise EPL_ERROR.

EplHandle
createPage(EplSession s, EplHandle hProject, EplHandle hTemplatePage, wchar* wcsPageName)
{
        EplHandle hRet(EPL_ERROR);

        //Create Create.Page command
        EplHandle cmdCreatePage = eplCreateCommand(s, L"EPLAN.EPLAN21.PAGE.CREATE");

        if(cmdCreatePage != EPL_ERROR)
        {
                //Set parameters
                //
                //Project handle
                eplSetHandleParam(s,
                                  cmdCreatePage,
                                  EPL_PARAM_PAGE_CREATE_PROJECT,
                                  hProject,
                                  0);

                //Template page
                eplSetHandleParam(s,
                                  cmdCreatePage,
                                  EPL_PARAM_PAGE_CREATE_TEMPLATE,
                                  hTemplatePage,
                                  0);

                //Page name
                eplSetParam(s,
                            cmdCreatePage,
                            EPL_PARAM_PAGE_CREATE_NAME,
                            wcsPageName,
                            0);

                //Execute command
                if(eplExecuteCommand(s, cmdCreatePage) == EPL_OK)
                {
                        // Query result:
                        hRet = eplGetHandleParam(s,
                                                cmdCreatePage,
                                                EPL_PARAM_PAGE_CREATE_RESULT,
                                                0);
                }

                eplCloseObject(s, cmdCreatePage);
        }

        return hRet;
}

Reference