mdlIObject ReplaceEntity
Replaces an existing entity with a new entity using the class variable name from the MDF file.
Syntax
mdlIObject_handle ReplaceEntitynew_handle, old_handle, class_var, varname, is_pair
Application
MotionView Tcl Modify
Description
Inputs
- new_handle
- The handle for the new entity.
- old_handle
- The handle of the current entity. The new entity handle replaces the old handle.
- class_var
- For example the class variables are:
- "body_ent"
- For body class
- "vector_ent"
- For vector class
- "graphic_ent"
- For graphic class.
- varname
- The local variable name and default label for the new entity.
- is_pair
- The Boolean flag that is used to determine if the entity is created as a single or a pair.
Example
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 BeginFlatListFastGet "body"
myModelName GetChildHandleByIdx mybody 2
myModelName ReplaceEntity newbody mybody body_ent body_new false
myModelName EndChildFastGet
newbody ReleaseHandle
myModelName ReleaseHandle
myClientName ReleaseHandle
myWindowName ReleaseHandle
myPageName ReleaseHandle
myProjectName ReleaseHandle
mySessionName ReleaseHandle
hwi CloseStack
Error
Returns 0 if successful, otherwise an error code.
or
Returns the name of the new_handle (in the example above it returns "newbody").