Evaluates an expression.
struct resbuf*
ade_expreval(
ads_name ename,
char* expr,
char* type);
Returns the value of the expression or NULL.
ename | Optional drawing object name. Required if the expression uses object properties or data. |
expr | Expression to evaluate. |
type | Expected return type: "short", "long", "real", "string", or "point". |
The following sample displays the .Length property of a pline entity which has been converted to Meters.
A selection set of entities from the current drawing is created using acedSSGet(). Each entity is passed to ade_expreval()along with any additional parameters. The resbuf returned by ade_expreval() contains the converted result which is then displayed. Then it releases the resbuf, as required.
ads_name ename; ads_name selectionSet; char* pszExpr = "(* .LENGTH .3048)"; char* pszReturnType = "real"; struct resbuf* pEntLengthToM = NULL; acedSSGet("x", NULL, NULL, NULL, selectionSet); long ssLength; acedSSLength( selectionSet, &ssLength; ); for( int i = 0; i < ssLength; ++i ) { if( acedSSName(selectionSet, i, ename) == RTNORM ) { pEntLengthToM = ade_expreval(ename, pszExpr, pszReturnType); if (pEntLengthToM != NULL){ struct resbuf* rb = pEntLengthToM; while(rb != NULL) { acutPrintf( "\nThe current entities .LENGTH value converted to Meters is: %.4lf" , rb->resval.rreal); rb = rb->rbnext; } } } } acutRelRb(pEntLengthToM);