EPLAN.EPLAN21.TEXT.CREATE

Contents

Description

Command for inserting a text into a page.

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

Parameters

All parameters have the prefix "EPL_PARAM_TEXT_CREATE_".

ParameterID Type Description
PAGE [IN]
EplHandle
Handle of the page into which the text is to be inserted.
XPOS [IN, OPTIONAL]
Integer
X coordinate of text to be inserted. (Default = 0)
YPOS [IN]
Integer
Y coordinate of text to be inserted. (Default = 0)
TEXT [IN]
String
Contents of text to be inserted
FONT [IN, OPTIONAL]
Integer
Character set. (Default = 0)
JUSTIFY [IN, OPTIONAL]
Integer

Text alignment:

0 = Basis line, left-aligned (default = 0)
1 = Basis line, right-aligned
2 = Basis line, centered
3 = Bottom, left-aligned
4 = Bottom, right-aligned
5 = Bottom, centered
6 = Top, left-aligned
7 = Top, right-aligned
8 = Top, centered
9 = Center, left-aligned
10 = Center, right-aligned
11 = Center, centered
ANGLE [IN, OPTIONAL]
Float
Text angle. (Default = 0)
SIZE [IN]
Integer
Text size in 1/100 mm.
COLOR [IN, OPTIONAL]
Integer

Line color.
Default setting:

0 = Black (default = 0)
1 = Red
2 = Yellow
3 = Green
4 = Cyan
5 = Blue
6 = Magenta
7 = White
8 = Gray
9 = Red 50%
10 = Yellow 50%
11 = Green 50%
12 = Cyan 50%
13 = Blue 50%
14 = Magenta 50%
15 = Violet
STYLE [IN, OPTIONAL]
Integer
Line type (default = 0)
PENWIDTH [IN, OPTIONAL]
Integer
Line width. (Default = 0)
RESULT [OUT]
EplHandle
After execution of the command, this parameter can be used to query the handle of the created text object.

Error Messages

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

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 page.
EPL_ERR_FAILED The text could not be created.
EPL_ERR_INVALID_ARGUMENT The PAGE parameter is not an object of the Page type.

Example

The following example shows a function which inserts a text into a page. The handle of the page object must be determined first.

EplHandle
createText(EplSession s, EplHandle page, wchar* wcsText)
{
        EplHandle hRet(EPL_ERROR);

        //Create Create.Text command
        EplHandle cmdCreateText = eplCreateCommand(s, L"EPLAN.EPLAN21.TEXT.CREATE");

        if(cmdCreateText != EPL_ERROR)
        {
                //Set parameters
                //
                //Page handle
                eplSetHandleParam(s,
                                  cmdCreateText,
                                  EPL_PARAM_TEXT_CREATE_PAGE,
                                  page,
                                  0);

                //Pen size
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_PENWIDTH,
                            L"1",
                            0);

                //Text color
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_COLOR,
                            L"7",
                            0);

                //Font
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_STYLE,
                            L"0",
                            0);

                //Character set
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_FONT,
                            L"0",
                            0);

                //Font size
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_SIZE,
                            L"10000",
                            0);

                //Text
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_TEXT,
                            wcsText,
                            0);

                //Text alignment:
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_JUSTIFY,
                            L"0",
                            0);

                //Text angle
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_ANGLE,
                            L"0",
                            0);

                //X/Y coordinates
                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_XPOS,
                            L"100000",
                            0);

                eplSetParam(s,
                            cmdCreateText,
                            EPL_PARAM_TEXT_CREATE_YPOS,
                            L"100000",
                            0);

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

                eplCloseObject(s, cmdCreateText);
        }

        return hRet;
}

Reference