::GetValidLocationToAddItem

From the current selected item(s) in the browser, this command will return the deepest valid (full variable name) container (Assembly/System/Analysis/Template, etc.) for adding an instance of the specified registered entity type.

Syntax

::model::GetValidLocationToAddItem argRegType

Application

MotionView Tcl

Description

From the current selected item(s) in the browser, this command will return the deepest valid (full variable name) container (Assembly/System/Analysis/Template, etc.) for adding an instance of the specified registered entity type.

Inputs

argRegType
We need to send registered entity type (Point,Body,Vector,….) that we are getting the valid location to add to as an argument.

Example

set varParentOfSystem [::model::GetValidLocationToAddItem Point]
 if { [::model::IsValidVarname $varParentOfSystem] } {
          ::model::GetHandleFromFullVarname sh varParentOfSystem
          set new_varname "p_test"
          sh InterpretEntity ph Point $new_varname "\"Point 1\""
          ph InterpretSet SetPoint p_0 10 20 30
          ::model::EvaluateModel
          ph ReleaseHandle
         sh ReleaseHandle
    }
# After this, a point gets created in the deepest container for all of the selected entities in the model browser

Errors

Returns the full varname of a container if successful.