EPLAN.EPLAN21.POTENTIALDEFINITION.CREATE

Contents

Description

Command for generating a potential definition.

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

Parameters

All parameters have the prefix "EPL_PARAM_PROJECTDATA_CREATE_"!

ParameterID Type Description
PROJECT [IN]
EplHandle
Handle of the project/macro in which the potential definition is to be generated.
NAME [IN]
String
Name of the new potential definition.
RESULT [OUT]
EplHandle
After the command was successfully executed, this parameter can be used to query the handle of the generated potential definition.

Error Messages

The eplExecuteCommand function returns EPL_OK if the potential definition could be created successfully.

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 modify the project.
EPL_ERR_FAILED The object could not be created.
EPL_ERR_INVALID_ARGUMENT The parameter PROJECT was invalid.
EPL_ERR_PROJECTDATA_NAME_NOT_UNIQUE The name was not unique or an object with this name was already existing.

Example

The following example shows a function which creates a potential definition.

EplHandle
createPotentialDefinition(EplSession session, EplHandle hProject, const wchar_t *sName)
{
        EplHandle hRet(EPL_ERROR);

        //Create command
        EplHandle hCmd = eplCreateCommand(session, L"EPLAN.EPLAN21.POTENTIALDEFINITION.CREATE");

        if(hCmd != EPL_ERROR)
        {
                eplSetHandleParam(session,
                                  hCmd,
                                  EPL_PARAM_PROJECTDATA_CREATE_PROJECT,
                                  hProject,
                                  0);
                eplSetHandleParam(session,
                                  hCmd,
                                  EPL_PARAM_PROJECTDATA_CREATE_NAME,
                                  sName,
                                  0);

                //Execute command
                if(eplExecuteCommand(session, hCmd) == EPL_OK)
                {
                        // Query result:
                        hRet = eplGetHandleParam(session,
                                            hCmd,
                                            EPL_PARAM_PROJECTDATA_CREATE_RESULT,
                                            0);
                        if(hRet != EPL_ERROR)
                                hRet = eplCloneHandle(session, hCmd);
                }
                eplCloseObject(session, hCmd);
        }
        return hRet;
}

Reference