# IRiTSBCommand Interface Reference

Inherits IDispatch.

List of all members.

## Public Member Functions
HRESULT | ConnectTSToSpace ([in] BSTR bstrSpaceName)
HRESULT | AttrClean ([in] BSTR bstrSpaceName)
HRESULT | HookToScene ([in] BSTR bstrTSScene)
HRESULT | CreateTSToolbar ([in] BSTR bstrTSname,[in] BSTR bstrTSWinID,[in] SHORT x=0,[in] SHORT y=0)
HRESULT | SuggestTSState ([in] DWORD state,[in] DWORD value)
HRESULT | XorTypeTSState ([in] DWORD state,[in] DWORD value)
HRESULT | InfoRequest ([in] DWORD state,[in] DWORD value)
HRESULT | SuggestTSStateByAlias ([in] BSTR szAlias)
HRESULT | GetAliasStateAndValue ([in] BSTR szAlias,[out] DWORD *state,[out] DWORD *value)
HRESULT | InfoRequestByAlias ([in] BSTR szAlias)
HRESULT | XorTypeTSStateByAlias ([in] BSTR szAlias)
HRESULT | ChangeStatesAndValuesToAliases ()
HRESULT | GetStateAndValueAlias ([in] DWORD state,[in] DWORD value,[out] BSTR *szAlias)
HRESULT | DeleteTmpTextures ()
HRESULT | UpdateTSToolbar ([in] BSTR bstrTSname)
HRESULT | RunUserPluginByIndex ([in] VARIANT index)
HRESULT | RunUserPluginByPath ([in] BSTR szPath)
HRESULT | OpenUserPluginPanelByIndex ([in] VARIANT index)
HRESULT | OpenUserPluginPanelByPath ([in] BSTR szPath)
HRESULT | OpenTSWindow ([in] BSTR name)
HRESULT | OpenTSWindowByHWND ([in] DWORD id,[in] DWORD hWnd)
HRESULT | OpenTSWindowByID ([in] DWORD id)
HRESULT | CloseTSWindowByID ([in] DWORD id)
HRESULT | ResetTSWindows (void)
HRESULT | SetBridgeSyncStatus ([in] VARIANT vStatus)
HRESULT | SetRefreshRate ([in] VARIANT vFPS)
HRESULT | Connect (void)
HRESULT | PutActiveFrame ([in] BSTR bstrNodeName,[in] VARIANT vFrame)
HRESULT | FlushSyncEvents (void)
HRESULT | SetBridgeHalfLoop ([in] VARIANT vEnabled)
HRESULT | RsTSEventsStatus ([out, retval] VARIANT *pvEventsBlocked)
HRESULT | BlockRsTSEvents ([in] VARIANT vBlockEvents)
HRESULT | SynchronizeObject ([in] BSTR bstrObjName)
HRESULT | SetBridgeSyncMethod ([in] VARIANT vMethod)
## Properties
VARIANT | AnimationFrame`[set]`
VARIANT * | AnimationFrame`[get]`

## Detailed Description

The IRiTSBCommand interface provides methods that allows you to control bridge synchronization.

Root-level name in the scripting engine's name space: tSBridge

## Member Function Documentation

HRESULT IRiTSBCommand::ConnectTSToSpace | ( | [in] BSTR | bstrSpaceName | ) |

Tell bridge which space should be synchronized with Modeler's scene.

- This command is called automatically after New Scene with Space.CurrentScene() as the parameter.
- It creates all the objects that are necessary to connect Modeler-side scene with the given workspace scene/encapsulator.

Parameters:

  | bstrSpaceName | [in] Full string identification name of the space that should be synchronized.

        tSBridge.ConnectTSToSpace('/Project/Space 3D');

HRESULT IRiTSBCommand::AttrClean | ( | [in] BSTR | bstrSpaceName | ) |

Remove all the bridge's attributes from specified object.

- It is useful if you want to export an object(s) and be sure all the bridge package objects are removed from exported object.

Parameters:

  | bstrSpaceName | [in] Use full name as the parameter of the object from which the attributes should be removed. If "/" is specified, the whole context will be cleared. If you use "", then just selected object will be cleared.

Remarks:
  After using this command be aware that the bridge will stop working.
  - You can activate it again from Model view if you activate the whole scene synchronization.
  - You can do it by load a scene or if you turn off and then again turn on bridge with Modeler->workspace synchronization.

        tSBridge.AttrClean('/Project/Space 3D/Cube');

HRESULT IRiTSBCommand::HookToScene | ( | [in] BSTR | bstrTSScene | ) |

Method reconnects 3D objects between Modeler scene and workspace View.

- This command is called automatically after Modeler or workspace loads a scene.
- You can use it to partially restore the bridge connection after AttrClean method.

Parameters:

  | bstrTSScene | [in] Full string name identification of the TSScene object. It should be located in /Project space.

        tSBridge.HookToScene('/Project/Space 3D');

HRESULT IRiTSBCommand::CreateTSToolbar | ( | [in] BSTR | bstrTSname,
|  | [in] BSTR | bstrTSWinID,
|  | [in] SHORT | x = `0`,
|  | [in] SHORT | y = `0` |
| ) |  |  |

CreateTSToolbar

Parameters:

  | bstrTSname | [in] .
  | bstrTSWinID | [in] .
  | x | = 0 [in] .
  | y | = 0 [in] .

HRESULT IRiTSBCommand::SuggestTSState | ( | [in] DWORD | state,
|  | [in] DWORD | value |
| ) |  |  |

SuggestTSState

Parameters:

  | state | [in] .
  | value | [in] .

HRESULT IRiTSBCommand::XorTypeTSState | ( | [in] DWORD | state,
|  | [in] DWORD | value |
| ) |  |  |

XorTypeTSState

Parameters:

  | state | [in] .
  | value | [in] .

HRESULT IRiTSBCommand::InfoRequest | ( | [in] DWORD | state,
|  | [in] DWORD | value |
| ) |  |  |

InfoRequest

Parameters:

  | state | [in] .
  | value | [in] .

HRESULT IRiTSBCommand::SuggestTSStateByAlias | ( | [in] BSTR | szAlias | ) |

Call to execute a Modeler's action.

- This has the same effect as if you click on a Modeler's button.

Parameters:

  | szAlias | [in] Action identification. For possible values see /Toolbar Prototypes Encapsulator and all toolbars whose name begins with tS. The action you can find in Command connector.

Example:

        // Assign rubber physics material for selected object/s
        tSBridge.SuggestTSStateByAlias("PhysicsLocalRubberButton");

See also:
  XorTypeTSStateByAlias

  InfoRequestByAlias

HRESULT IRiTSBCommand::GetAliasStateAndValue | ( | [in] BSTR | szAlias,
|  | [out] DWORD * | state,
|  | [out] DWORD * | value |
| ) |  |  |

GetAliasStateAndValue

Parameters:

  | szAlias | [in] .
  | state | [out] .
  | value | [out] .

HRESULT IRiTSBCommand::InfoRequestByAlias | ( | [in] BSTR | szAlias | ) |

Call to execute a Modeler's info action.

- This has the same effect as if you right click on a Modeler's button.

Parameters:

  | szAlias | [in] Info action identification. For possible values see /Toolbar Prototypes Encapsulator and all toolbars whose name begins with tS. The action you can find in RClickCommand connector.

Example:

        // Display physical properties for selected object/s
        tSBridge.InfoRequestByAlias("PhysicsLocalRubberButton")

See also:
  XorTypeTSStateByAlias

  SuggestTSStateByAlias

HRESULT IRiTSBCommand::XorTypeTSStateByAlias | ( | [in] BSTR | szAlias | ) |

Call to execute a Modeler's action that is specified as a switch.

- This has the same effect as if you click on a On-Off Modeler's button.

Parameters:

  | szAlias | [in] Action identification. For possible values see /Toolbar Prototypes Encapsulator and all toolbars whose name begins with tS. The action you can find in Command connector.

Example:

        // Turn on or off the physics gravitation
        tSBridge.XorTypeTSStateByAlias("GravitationPadButton");

See also:
  SuggestTSStateByAlias

  InfoRequestByAlias

HRESULT IRiTSBCommand::ChangeStatesAndValuesToAliases | ( |  | ) |

ChangeStatesAndValuesToAliases

HRESULT IRiTSBCommand::GetStateAndValueAlias | ( | [in] DWORD | state,
|  | [in] DWORD | value,
|  | [out] BSTR * | szAlias |
| ) |  |  |

GetStateAndValueAlias

Parameters:

  | state | [in] .
  | value | [in] .
  | szAlias | [out] .

HRESULT IRiTSBCommand::DeleteTmpTextures | ( |  | ) |

Method deletes all temporarily created textures.

- It is called automatically after each tS7 startup.

HRESULT IRiTSBCommand::UpdateTSToolbar | ( | [in] BSTR | bstrTSname | ) |

UpdateTSToolbar

Parameters:

  | bstrTSname | [in] .

HRESULT IRiTSBCommand::RunUserPluginByIndex | ( | [in] VARIANT | index | ) |

RunUserPluginByIndex

Parameters:

  | index | [in] .

HRESULT IRiTSBCommand::RunUserPluginByPath | ( | [in] BSTR | szPath | ) |

RunUserPluginByPath

Parameters:

  | szPath | [in] .

HRESULT IRiTSBCommand::OpenUserPluginPanelByIndex | ( | [in] VARIANT | index | ) |

OpenUserPluginPanelByIndex

Parameters:

  | index | [in] .

HRESULT IRiTSBCommand::OpenUserPluginPanelByPath | ( | [in] BSTR | szPath | ) |

OpenUserPluginPanelByPath

Parameters:

  | szPath | [in] .

HRESULT IRiTSBCommand::OpenTSWindow | ( | [in] BSTR | name | ) |

OpenTSWindow

Parameters:

  | name | [in] .

HRESULT IRiTSBCommand::OpenTSWindowByHWND | ( | [in] DWORD | id,
|  | [in] DWORD | hWnd |
| ) |  |  |

OpenTSWindowByHWND

Parameters:

  | id | [in] .
  | hWnd | [in] .

HRESULT IRiTSBCommand::OpenTSWindowByID | ( | [in] DWORD | id | ) |

OpenTSWindowByID

Parameters:

  | id | [in] .

HRESULT IRiTSBCommand::CloseTSWindowByID | ( | [in] DWORD | id | ) |

CloseTSWindowByID

Parameters:

  | id | [in] .

HRESULT IRiTSBCommand::ResetTSWindows | ( | void |  | ) |

ResetTSWindows

HRESULT IRiTSBCommand::SetBridgeSyncStatus | ( | [in] VARIANT | vStatus | ) |

Set bridge synchronization status.

- This status is set automatically from desktop preferences, so use it only temporarily to speed up your scripts.

Parameters:

  | vStatus | [in] Status of the bridge. Possible values: 0 - always off. 1 - always on. 2 - turn off if possible (the auto state).

See also:
  SetRefreshRate

  SetBridgeHalfLoop

  SetBridgeSyncMethod

HRESULT IRiTSBCommand::SetRefreshRate | ( | [in] VARIANT | vFPS | ) |

Set bridge synchronization refresh rate.

- This status is set automatically from desktop preferences.
- It is possible you change it temporarily, but it is recommended you
  change it directly in Desktop preferences object string ID: /Preferences/Desktop).

Parameters:

  | vFPS | [in] Refresh rate in frames per seconds.

See also:
  SetBridgeSyncStatus

  SetBridgeHalfLoop

  SetBridgeSyncMethod

HRESULT IRiTSBCommand::Connect | ( | void |  | ) |

Connect

HRESULT IRiTSBCommand::PutActiveFrame | ( | [in] BSTR | bstrNodeName,
|  | [in] VARIANT | vFrame |
| ) |  |  |

Use this method to put scene or object to a specific frame.

- If auto-record is turned on in Modeler, a new key-frame will be created for the next object move, scale or rotation.

Parameters:

  | bstrNodeName | [in] Object string scene identification for which the frame should be changed. If you specify '', then it will be set for the whole scene.
  | vFrame | [in] Desired frame number.

Example:

        // Put Modeler's scene to frame 10 and be sure it is immediately done
        tSBridge.PutActiveFrame('', 10);
        tSBridge.FlushSyncEvents();

See also:
  FlushSyncEvents

HRESULT IRiTSBCommand::FlushSyncEvents | ( | void |  | ) |

Flush all the bridge's synchronization events that are waiting in theevent queue.

- You can use this command e.g. after PutActiveFrame if you want be sure the scene or object is in desired frame.

HRESULT IRiTSBCommand::SetBridgeHalfLoop | ( | [in] VARIANT | vEnabled | ) |

Turn on or off the procedural animation support.

- Use this method only inside your script, as it is set automatically by Desktop preferences object located in /Preferences space.

Parameters:

  | vEnabled | [in] true to activate or false to disable the support.

Remarks:
  The animation support allows you to make an action with object in Modeler e.g. move a 3D object, then execute a script action in workspace and at the same time synchronize the scene with again Modeler.

See also:
  SetBridgeSyncStatus

  SetRefreshRate

  SetBridgeSyncMethod

HRESULT IRiTSBCommand::RsTSEventsStatus | ( | [out, retval] VARIANT * | pvEventsBlocked | ) |

Use this method to detect whether Workspace->Modeler synchronization events are enabled or not.

Returns:
  pvEventsBlocked [out, retval] Returns true if the events are blocked.

See also:
  BlockRsTSEvents

HRESULT IRiTSBCommand::BlockRsTSEvents | ( | [in] VARIANT | vBlockEvents | ) |

Block Workspace->Modeler synchronization events.

- You can use this method to speed up your scripts.

Parameters:

  | vBlockEvents | [in] Use true to block events and false to enable them again.

Remarks:
  Be sure you always restore the original settings that you can detect through RsTSEventsStatus method.

See also:
  SynchronizeObject

HRESULT IRiTSBCommand::SynchronizeObject | ( | [in] BSTR | bstrObjName | ) |

Execute this method if you want to synchronize object in Workspace scene with Model scene.

- Usually this should be done after you block events with BlockRsTSEvents method and you enable them again.
- See MakeTree object located in My Activities library for an example.

Parameters:

  | bstrObjName | [in] Scene name of the object that is to be synchronized with Modeler's scene. If empty string is specified, the whole Workspace scene will be synchronized.

HRESULT IRiTSBCommand::SetBridgeSyncMethod | ( | [in] VARIANT | vMethod | ) |

Set bridge synchronization method.

- This status is set automatically from desktop preferences, so it is recommended to use it only temporary from your scripts.

Parameters:

  | vMethod | [in] Synchronization method. Possible values: 0 - full synchronization. 1 - merge contents.

See also:
  SetBridgeSyncStatus

  SetRefreshRate

  SetBridgeHalfLoop

## Property Documentation

VARIANT IRiTSBCommand::AnimationFrame`[set]`

Set specified animation frame to modeler.

Parameters:

  | vFrame | [in] Frame number to set.

VARIANT * IRiTSBCommand::AnimationFrame`[get]`

Get animation frame.

Returns:
  *pvFrame [out,retval] Current trueSpace animation frame.