Skip to content

EVAL_EXPRESSION

The command EVAL_EXPRESSION evaluates a core expression without the need of an EXPRESSION attribute.

Syntax

leo-grammar
CC "Core" EVAL_EXPRESSION coreExpr [ objid:idValue | modelid:intValue ]

#-->RESULT ecode:intValue result:value
CC "Core" EVAL_EXPRESSION coreExpr [ objid:idValue | modelid:intValue ]

#-->RESULT ecode:intValue result:value

Parameters

  • <main-parameter (strValue) - coreExpr, is a string containing a core expression.
  • objid (idValue) - id of an object if the expression is object-related
  • modelid (idValue) - id of a model if the expression is model-related

Returns

  • ecode (intValue) - Contains the error code or is 0 in case of success.
  • result(anyValue) - is the same type as the expression's result type and contains the expression's result. If the command failed result is of type STRING and contains an error message.

Details

For mode details about expressions visit www.adoxx.org

See Also

Examples

asc
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "")
{
   CC "AdoScript" ERRORBOX "Select an instance first!"
   EXIT
}

# from the list of selected objects, extract the first objectid
SET firstselected:(token(objids,0," "))

CC "Core" EVAL_EXPRESSION (aval("Double")**2 + aval("Integer")**3) objid:(VAL firstselected)

IF ((ecode)!=0)
{
  CC "AdoScript" ERRORBOX ("Error ("+(STR ecode)+"): "+result)
  EXIT
}

CC "AdoScript" INFOBOX ("Double**2 + Integer**3 = "+(STR result))
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "")
{
   CC "AdoScript" ERRORBOX "Select an instance first!"
   EXIT
}

# from the list of selected objects, extract the first objectid
SET firstselected:(token(objids,0," "))

CC "Core" EVAL_EXPRESSION (aval("Double")**2 + aval("Integer")**3) objid:(VAL firstselected)

IF ((ecode)!=0)
{
  CC "AdoScript" ERRORBOX ("Error ("+(STR ecode)+"): "+result)
  EXIT
}

CC "AdoScript" INFOBOX ("Double**2 + Integer**3 = "+(STR result))

Preparing

  • Get selected objects
  • pick first selected

Interesting

  • EVAL_EXPRESSION evaluate a core expression
  • check error code
  • show result

Versions and Changes

Available since ADOxx 1.3