Skip to content

GET_OBJ_NAME ​

The command GET_OBJ_NAME retrieves the name of an instance. This instance must exist in any loaded model - which one is determined automatically!

Syntax ​

leo-grammar
CC "Core" GET_OBJ_NAME objid:id

#-->RESULT ecode:intValue objname:strValue
CC "Core" GET_OBJ_NAME objid:id

#-->RESULT ecode:intValue objname:strValue

Parameters ​

  • objid (idValue) -

Returns ​

  • ecode (intValue) - Contains the error code or is 0 in case of success.
  • objname (strValue) -

Details ​

See Also ​

Examples ​

asc
# get current model
SEND "GET_ACTIVE_MODEL" to:"Modeling" answer:modelid

IF (LEN (modelid) = 0)
{
  CC "AdoScript" ERRORBOX ("Please open a model!")
  EXIT
}

# get all objs of class
CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(VAL modelid) classname:"Aktivität"

IF (LEN (objids) = 0)
{
  CC "AdoScript" ERRORBOX ("You have no instances of class 'Aktivität'!")
  EXIT
}

# get name of first object
CC "Core" GET_OBJ_NAME objid:(VAL token (objids, 0, " "))

CC "AdoScript" INFOBOX ("First 'Aktivität' found is called '" + (objname) + "'")
# get current model
SEND "GET_ACTIVE_MODEL" to:"Modeling" answer:modelid

IF (LEN (modelid) = 0)
{
  CC "AdoScript" ERRORBOX ("Please open a model!")
  EXIT
}

# get all objs of class
CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(VAL modelid) classname:"Aktivität"

IF (LEN (objids) = 0)
{
  CC "AdoScript" ERRORBOX ("You have no instances of class 'Aktivität'!")
  EXIT
}

# get name of first object
CC "Core" GET_OBJ_NAME objid:(VAL token (objids, 0, " "))

CC "AdoScript" INFOBOX ("First 'Aktivität' found is called '" + (objname) + "'")
  • get active model's id
  • determine all instances of class "Aktivität"
  • check if any instance was found
  • get name of first instance and show infobox

Versions and Changes ​

Available since ADOxx 1.3