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.
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||
ANGLE | [IN, OPTIONAL] Float |
Text angle. (Default = 0) | ||||||||||||||||||||||||||||||||||||||||||||||||
SIZE | [IN] Integer |
Text size in 1/100 mm. | ||||||||||||||||||||||||||||||||||||||||||||||||
COLOR | [IN, OPTIONAL] Integer |
Line color.
|
||||||||||||||||||||||||||||||||||||||||||||||||
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. |
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. |
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; } |