mdlIObject ReplaceEntityAdvanced

Replaces an existing entity with a new entity using MDL statement keywords and the remaining statement tokens.

Syntax

mdlIObject_handle ReplaceEntityAdvancednew_handle, old_handle, keyword, tokens

Application

MotionView Tcl Modify

Description

This command replaces an existing entity with a new entity using MDL statement keywords and the remaining statement tokens.
Note: The variable name and label for the new entity are copied from the old entity. You can specify the type for the replacement entity and any other token used in the MDL statement (other than the variable name and label).

Inputs

new_handle
The handle for the new entity.
old_handle
The handle of the current entity.
keyword
The entity's MDL statement keyword.
tokens
The remaining tokens for the corresponding MDL statement.

Example

To append a floating marker on B_Ground at the global origin, then use the mdlIModel ReplaceEntityAdvanced command to replace that floating marker with a floating marker on B_Ground, but at p_0.r:
hwi OpenStack
hwi GetSessionHandle mySessionName 
mySessionName GetProjectHandle myProjectName 
set activePageNum [myProjectName GetActivePage]
myProjectName GetPageHandle myPageName $activePageNum
set activeWinNum [myPageName GetActiveWindow]
myPageName GetWindowHandle myWindowName $activeWinNum
myWindowName GetClientHandle myClientName 
myClientName GetModelHandle myModelName 
myModelName InterpretEntity pt0 PointPair p_0 "\"Point Pair\"";
myModelName InterpretSet SetPoint p_0 "" 0.0 50.0 50.0 0.0 -50 50;
myModelName InterpretEntity mark_handle Marker mrk_0 "\"Marker 0\"" B_Ground P_Global_Origin "FLOATING";
pt0 ReleaseHandle;
myModelName Evaluate;

myModelName BeginFlatListFastGet "Point"
myModelName GetChildHandleByIdx point_handle 2
set pointvar [point_handle GetFullVarname]
tk_messageBox -message "$pointvar";
myModelName EndChildFastGet

myModelName ReplaceEntityAdvanced newmark_handle mark_handle Marker B_Ground $pointvar Floating;
newmark_handle ReleaseHandle
point_handle ReleaseHandle
myModelName ReleaseHandle
myClientName ReleaseHandle
myWindowName ReleaseHandle
myPageName ReleaseHandle
myProjectName ReleaseHandle
mySessionName ReleaseHandle
hwi CloseStack

Errors

Returns 0 if successful, otherwise an error code.

or

Returns the name of the new_handle (in the example above it returns "newmark_handle").