op_ima_obj_attr_set_color()
Abstract
Assigns the value of a color attribute in the specified object.
Syntax
op_ima_obj_attr_set_color (objid, attr_name, value)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of the object-of-interest [An object ID can be obtained from several KPs in the Topo and Id packages: op_id_self(), op_topo_parent(), op_topo_child(), op_id_from_userid(), and op_id_from_name().] |
attr_name |
const char* |
name of the attribute-of-interest [This value must be a defined attribute of the specified object.] |
value |
PrgT_Color |
new value for the specified attribute |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the attribute value was successfully set; OPC_COMPCODE_FAILURE otherwise.
Example
/* Update the link's color. */
PrgT_Color new_color = prg_color_from_string ("red");
op_ima_obj_attr_set_color (link_objid, "color", new_color);
Details
This KP will not report an error if the attribute is not found; you must check the return value to discover this. By not reporting errors, this KP eliminates the need to use op_ima_obj_attr_exists() beforehand to prevent warnings from being generated.
Purpose
Provides a mechanism to dynamically assign object attributes during the course of a simulation. This KP works identically to op_ima_obj_attr_set(), but applies only to object attributes of data type PrgT_Color. Refer to op_ima_obj_attr_set() for full purpose and details.
Errors
- Same as op_ima_obj_attr_set().
Reference
- Use the KPs op_ima_obj_attr_get_color() or op_ima_obj_attr_get() to obtain the value of an object color attribute
- Use the KPs op_ima_sim_attr_get_color() or op_ima_sim_attr_get() to obtain the value of a simulation color attribute
- Use the KP op_id_self() to obtain the object ID of the surrounding processor or queue
- Use the KP op_id_from_name() to obtain the object ID of an arbitrary object