EPLAN.EPLAN21.PART_SYMBOL.INSERT

Contents

Description

Command for inserting part symbols into a mounting-panel page.

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

Parameters

All parameters have the prefix "EPL_PARAM_PART_SYMBOL_INSERT_".

ParameterID Type Description
PART [IN]
EplHandle
Handle of the part for which the symbol is to be inserted.
PAGE [IN]
EplHandle
Handle of the mounting-panel page.
XPOS [IN, OPTIONAL]
Integer
X position of the symbol to be inserted. (default = 0)
YPOS [IN, OPTIONAL]
Integer
Y position of the symbol to be inserted. (default = 0)
SIZE_X [IN]
Integer
X dimension of the part symbol.
SIZE_Y [IN]
Integer
Y dimension of the part symbol.
SYMBOL [IN, OPTIONAL]
EplHandle
Handle of a symbol. The EPL_ITERTYPE_SYMBOLS iterator returns such handles (optional, instead of CAD_NUMBER)
CAD_NUMBER [IN, OPTIONAL]
String
Names of the EPLAN 21 symbol file and of the symbol name, separated by semicolons, e.g. "COMPONENTS;COMPONENT" (optional, instead of SYMBOL).
VARIANT [IN, OPTIONAL]
Integer
Variant of the symbol (optional, in combination with the parameter SYMBOL, default = 0).
SYMBOLFILE [IN, OPTIONAL]
String
Name of the (DWG) symbol file in which the symbol is contained (optional, in addition to SYMBOL or CAD_NUMBER).
RESULT [OUT]
EplHandle
Handle of the new part symbol.

Error Messages

The eplExecuteCommand function returns EPL_OK if the symbol could be successfully inserted.

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_FAILED The symbol could not be inserted.
EPL_ERR_INVALID_ARGUMENT No suitable parameter (PART, PAGE) was given.
EPL_ERR_PAGE_INVALID_TYPE The PAGE parameter does not contain a page of the "Control-panel layout (mounting panel)" type.
EPL_ERR_CREATE_INSTANCE The symbol instance could not be inserted into the page.
EPL_ERR_NO_SYMBOL The part symbol could not be created.
EPL_ERR_NO_UNDO_LIST The Undo list could not be created.
EPL_ERR_NO_UNDO_MANAGER The Undo list management could not be created.
EPL_ERR_NO_PROJECT The page specified with PAGE does not belong to any project.

Example

The following example shows a function which inserts a part symbol.

bool
partSymbolInsert(        EplSession hSession,
                  EplHandle hPage,
                                                                        EplHandle hPart,
                  const wchar* wcsSymbolFile,
                  const wchar* wcsSymbolName,
                                                                        Point ptInsert,
                                                                        Size size)
{
        bool bRet(false);

        if(hSession != EPL_ERROR)
        {
                //Insert part symbol into hPage
                // Create command
                EplHandle hCmdInsertPartSymbol = eplCreateCommand(hSession, L("EPLAN.EPLAN21.PART_SYMBOL.INSERT"));

                if(hCmdInsertPartSymbol != EPL_ERROR && hPart != EPL_ERROR)
                {
                        const BUFLEN = 100;
                        wchar_t buf[BUFLEN];

      //Is part placeable? 
                        eplGetProperty(hSession,
                     hPart,
                     EPL_PROPERTY_ARTICLE_PLACEABLE,
                     0,
                     buf,
                     BUFLEN);

                        bool bPlaceable(_wtoi(buf));

                        if(bPlaceable)
                        {
        //Fill parameters
                                //Part
                                eplSetHandleParam(hSession,
                          hCmdInsertPartSymbol,
                          EPL_PARAM_PART_SYMBOL_INSERT_PART,
                          hPart,
                          0);

        //Page
                                eplSetHandleParam(hSession,
                          hCmdInsertPartSymbol,
                          EPL_PARAM_PART_SYMBOL_INSERT_PAGE,
                          hPage,
                          0);

        //Symbol name
                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_SYMBOL,
                    wcsSymbolName,
                    0);

        //Symbol-file name
                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_SYMBOLFILE,
                    wcsSymbolFile,
                    0);

        //Insertion position X
                                _itow(ptInsert.x,buf,10);

                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_XPOS,
                    buf,
                    0);

        //Insertion position Y
        _itow(ptInsert.y,buf,10);

                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_YPOS,
                    buf,
                    0);

        //Symbol dimensions in X
                                _itow(size.cx,buf,10);

                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_SIZE_X,
                    buf,
                    0);

        //Symbol dimensions in Y
       				 _itow(size.cy,buf,10);

                                eplSetParam(hSession,
                    hCmdInsertPartSymbol,
                    EPL_PARAM_PART_SYMBOL_INSERT_SIZE_Y,
                    buf,
                    0);

        //Execute command
                                if( eplExecuteCommand(hSession,
                             hCmdInsertPartSymbol) != EPL_ERROR)
        {
                                  bRet = true;
        }
                        }
                }
        }

        return bRet;
}

Reference