When using custom animation, how and when is a node assigned to a specified register (e.g., REG_A_STR)?

Categories:
Solution Number:
S20629
Last Modified:
2013-08-20
Issue

When using custom animation, how and when is a node assigned to a specified register (e.g., REG_A_STR)?

Solution

The node is only assigned to the register at the time when the macro is evaluated. Looking at the example use of the op_anim_mme_nobj_pos() KP (from the OPNET Simulation Kernel Manual, Chapter Anim-Pk Anim Package), a slightly more verbose set of comments might read:/* Create a macro which draws a line between two nodes. */mid = op_anim_macro_create (node dynconn);/* Determine the positions of the nodes A & B; the position of A is *//* stored in (M,N) and the position of B is stored in (O,P). *//* Note that OPC_ANIM_REG_A_STR is not evaluated yet as any *//* particular node: rather, it is simply a placeholder for the node *//* at the time when the macro is evaluated (below). *//* This is equivalent to saying: At some point in the future, I *//* will specify the value of A. When I do so, M will be set to the *//* x position of that specification, and N will be set to the y *//* position. */ op_anim_mme_nobj_pos (mid, OPC_ANIM_OBJTYPE_NODE, OPC_ANIM_REG_A_STR, OPC_ANIM_REG_M_INT, OPC_ANIM_REG_N_INT, OPC_ANIM_VERTEX_ICON_CTR);op_anim_mme_nobj_pos (mid, OPC_ANIM_OBJTYPE_NODE, OPC_ANIM_REG_B_STR, OPC_ANIM_REG_O_INT, OPC_ANIM_REG_P_INT, OPC_ANIM_VERTEX_ICON_CTR);/* Indicate end of register setup section. */op_anim_mgp_setup_end (mid);/* Add a macro primitive that specifies that a line will be drawn *//* between what is extracted from the values of *//* OPC_ANIM_REG_M_INT, OPC_ANIM_REG_N_INT and *//* OPC_ANIM_REG_O_INT, OPC_ANIM_REG_P_INT *//* This is equivalent to saying: At some point in the future, I *//* am going to draw a line between M, N and O, P. I do not yet know *//* what these points are. */op_anim_mgp_line_draw (mid, OPC_ANIM_COLOR_GREEN, OPC_ANIM_REG_M_INT, OPC_ANIM_REG_N_INT, OPC_ANIM_REG_O_INT, OPC_ANIM_REG_P_INT);/* Execute the macro for source & destination nodes. *//* This is the place where we actually specify the nodes *//* that were previousley abstracted by *//* OPC_ANIM_REG_A_STR and OPC_ANIM_REG_B_STR. *//* We will evaluate all the marco primitives that we have*//* thus far built up for this macro, based on the nodes *//* that we specify. */op_anim_igp_macro_draw (vid, OPC_ANIM_RETAIN, mid, OPC_ANIM_REG_A_STR, src_nd_name, OPC_ANIM_REG_B_STR, dst_nd

Environment

DES Kernel->Process Modeling/Coding,Application Modeling->Custom Applications

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case