EPLAN.EPLAN21.PROJECT.CREATE

Contents

Description

Command for creating projects.

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

Parameters

All parameters have the prefix "EPL_PARAM_PROJECT_CREATE_".

ParameterID Type Description
DBHANDLE [IN, OPTIONAL]
EplHandle
Handle to the database in which the new project is to be created.
FORCELOCAL [IN, OPTIONAL]
Boolean
Forces the creation of local master data.
NAME [IN]
String
Name of the new project.
TEMPLATE [IN]
String
Name/path of template.

If no complete path name is specified, the path for the respective templates is defaulted to the EPLAN 21 default settings.

RESULT [OUT]
EplHandle
After execution of the command, this parameter can be used to query the handle of the created project.

Error Messages

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

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 database.
EPL_ERR_FAILED The new project could not be created.
EPL_ERR_CREATE_NAME_EXISTS The new project could not be created since the desired name for the object type to be created already exists in the database.
EPL_ERR_CANNOT_OPEN_FILE The template-file could not be opened.

Example

The following example shows a function which inserts a new project into the database.

EplHandle
createProject(EplSession s, wchar* wcsProjectName, wchar* wcsTemplateName)
{
        EplHandle hRet(EPL_ERROR);

        EplHandle cmdCreateProject = eplCreateCommand(s, L"EPLAN.EPLAN21.PROJECT.CREATE");

        if(cmdCreateProject != EPL_ERROR)
        {
                //Set parameters
                //
                //Name for the new project
                eplSetParam(s, cmdCreateProject, EPL_PARAM_PROJECT_CREATE_NAME, wcsProjectName, 0);

                //Template-file name
                eplSetParam(s, cmdCreateProject, EPL_PARAM_PROJECT_CREATE_TEMPLATE, wcsTemplateName", 0);

                //Execute command
                if(eplExecuteCommand(s, cmdCreateProject) == EPL_OK)
                {
                        // Query result:
                        hRet = eplGetHandleParam(s,
                                            cmdCreateProject,
                                            EPL_PARAM_PROJECT_CREATE_RESULT,
                                            0);

                }

                //Close object
                eplCloseObject(s, cmdCreateProject);
        }

        return hRet;
}

Reference