# IRiNetwork Interface Reference

Inherits IDispatch.

List of all members.

## Public Member Functions
HRESULT | NtConnectTo ([in] BSTR bstrClientName,[in] BSTR bstrClientPassword,[in] BSTR bstrLocSharedSpace,[in] BSTR bstrServerAddr,[in] VARIANT vPort,[in] VARIANT vSyncRate)
HRESULT | NtDisconnect ([in] BSTR bstrName)
HRESULT | OpenNetworkView ([in] BSTR bszNetwork)
HRESULT | NtOpenView (void)
HRESULT | OpenPrivilegesPanel ()
HRESULT | SetPrivileges ([in] BSTR bstrNodeName,[in] VARIANT bRecursive,[in] VARIANT vOperation,[in] BSTR bstrKeys,[in] VARIANT vSetOperation)
HRESULT | GetNodeStatus ([in] BSTR bstrNodeName,[out, retval] VARIANT *pvRetInfo)
HRESULT | NtSetCNotifSounds ([in] VARIANT vEnabled)
HRESULT | NtGetCNotifSounds ([out, retval] VARIANT *pvEnabled)
HRESULT | NtSetCAutoReconnect ([in] VARIANT vEnabled)
HRESULT | NtGetCAutoReconnect ([out, retval] VARIANT *pvEnabled)
HRESULT | GetNodeSessionId ([in] VARIANT vNodeName,[in] VARIANT vIndex,[out, retval] VARIANT *pvSessionId)
HRESULT | GetNodeSessionNickName ([in] VARIANT vNodeName,[in] VARIANT vIndex,[out, retval] VARIANT *pvNickname)
HRESULT | NtSetCDefaultServerAddr ([in] VARIANT vAddress)
HRESULT | NtGetCDefaultServerAddr ([out, retval] VARIANT *pvAddress)
HRESULT | NtSetCDefaultServerPort ([in] VARIANT vPort)
HRESULT | NtGetCDefaultServerPort ([out, retval] VARIANT *pvPort)
HRESULT | ReplaceAddrInSSS ([in] BSTR bstrObjName,[in] BSTR bstrOrigAddr,[in] BSTR bstrNewAddr)
HRESULT | EnterSharedSpace ([in] BSTR bstrSSSNode)
HRESULT | GetNearestSharedSpace ([in] BSTR bstrNodeName,[out, retval] VARIANT *pvSharedSpaceName)
HRESULT | GenerateCacheIIDAttr ([in] BSTR bstrNodeName)
HRESULT | RemoveCacheIIDAttr ([in] BSTR bstrNodeName)
HRESULT | PurgeCache ([in] DWORD dwKeepDays)
HRESULT | NtOpenViewEx ([in] BOOL bAutoLogin)
HRESULT | NtGetFirstServerPortRange ([out, retval] VARIANT *pvPort)
HRESULT | NtGetLastServerPortRange ([out, retval] VARIANT *pvPort)
HRESULT | NtSetServerPortRange ([in] VARIANT vFirstPort,[in] VARIANT vLastPort)
HRESULT | LoadNetworkPropsFromCfgFile ([in] VARIANT vFilePath)
HRESULT | NtCreateServerView ()
## Properties
VARIANT * | ConLocal ([in] BSTR szNodeName,[in] BSTR szConName)`[get]`
VARIANT | ConLocal ([in] BSTR szNodeName,[in] BSTR szConName)`[set]`

## Detailed Description

The IRiNetwork interface provides methods that allow you access and modify the Shared Space.

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

## Member Function Documentation

HRESULT IRiNetwork::NtConnectTo | ( | [in] BSTR | bstrClientName,
|  | [in] BSTR | bstrClientPassword,
|  | [in] BSTR | bstrLocSharedSpace,
|  | [in] BSTR | bstrServerAddr,
|  | [in] VARIANT | vPort,
|  | [in] VARIANT | vSyncRate |
| ) |  |  |

Method creates Client object and sets its attributes.
Once the object is created and set, the object then automatically tries to connect to the server.

Parameters:

  | bstrClientName | [in] Client's login name. It will be used as name of the created Client node as well. Empty strings are mapped as "UnknClient".
  | bstrClientPassword | [in] Client's login password.
  | bstrLocSharedSpace | [in] Full name identification of the space that will be synchronized with server. An empty string value '' will be mapped as the current scene space (usually '/Project/Space 3D').
  | bstrServerAddr | [in] Server address.
  | vPort | [in] Communication port.
  | vSyncRate | [in] Synchronization rate. Defines number of times per second, that the client space is synchronized with the server.

Returns:
  Standard HRESULT processing can be applied to the result.

Example:

     Net.NtConnectTo('MyUserName', 'MyPasswd', Space.CurrentScene(), '192.168.0.1', 1109, 15.0);

HRESULT IRiNetwork::NtDisconnect | ( | [in] BSTR | bstrName | ) |

Disconnect Client object and delete it from Network Space.

Parameters:

  | bstrName | [in] Full name identification of the object located in Network Space (Str.ID = "/Network") that will be disconnected and then deleted. Empty string value '' will be mapped as 'UnknClient'.

Returns:
  Standard HRESULT processing can be applied to the result.

Example:

     Net.NtDisconnect('MyUserName');

See also:
  NtConnectTo

HRESULT IRiNetwork::OpenNetworkView | ( | [in] BSTR | bszNetwork | ) |

Use to open network view/panel window.

Parameters:

  | bszNetwork | [in] Full name identification of the Client object that the view should be connected to.

Returns:
  Standard HRESULT processing can be applied to the result.

Example:

     Net.OpenNetworkView('/Network/MyUserName');

See also:
  NtConnectTo

HRESULT IRiNetwork::NtOpenView | ( | void |  | ) |

Use this method to open a network view.
If you are already connected, standard network view is opened and no other action is executed.
In case you are not logged in yet, then the login view opens.

Returns:
  Standard HRESULT processing can be applied to the result.

See also:
  OpenNetworkView

     Net.NtOpenView();

HRESULT IRiNetwork::OpenPrivilegesPanel | ( |  | ) |

Opens privileges panel.

Returns:
  Standard HRESULT processing can be applied to the result.

Example:

     Net.OpenPrivilegesPanel();

See also:
  SetPrivileges

HRESULT IRiNetwork::SetPrivileges | ( | [in] BSTR | bstrNodeName,
|  | [in] VARIANT | bRecursive,
|  | [in] VARIANT | vOperation,
|  | [in] BSTR | bstrKeys,
|  | [in] VARIANT | vSetOperation |
| ) |  |  |

Set privileges for specified object.

Parameters:

  | bstrNodeName | [in] Full name identification of the object for which the privileges will be set.
  | bRecursive | [in] Specify true if you want to set the privileges for sub-objects as well.
  | vOperation | [in] Kind of operation for which the privileges will be set. 0 Access privileges will be changed. 1 Privileges to change Privileges will be set. 2 Set Enter privileges. 3 Set Moderator privileges.
  | bstrKeys | [in] List of keys separated by ";" character.
  | vSetOperation | [in] 0 Replace value (SET). 1 Union value (OR). 2 Subtract value. 3 Intersect value (AND). 4 Clear value.

Returns:
  Standard HRESULT processing can be applied to the result.

            // Allow Visitor(s) to manipulate the whole selected object.
            Net.SetPrivileges(Node.FirstSelected(), true, 0, 'Visitor', 1);

See also:
  OpenPrivilegesPanel

HRESULT IRiNetwork::GetNodeStatus | ( | [in] BSTR | bstrNodeName,
|  | [out, retval] VARIANT * | pvRetInfo |
| ) |  |  |

Detect network status for specified object.
Use it to find whether the object is placed in Shared Space or not.
Also used to find out whether your script is running on server or client machine.
It is important mainly for activities that are placed into Shared Space.
With this method you can detect if your script is running on server and prevent the dual execution on client machine.

Parameters:

  | bstrNodeName | [in] Full name identification of the object. If NULL or empty string is specified, current scene object is used.

Returns:
  pvRetInfo [out, retval] Returns filled IRsReturn object with 2 parameters:
  NtNodeStat
  - 0 if the object is not in Shared Space
  - 1 if the object is located on Server.
  - 2 if it is located on Client machine.
  NumLocSS Number of shared spaces in which the object is included (usually only 1 or 0).

  Standard HRESULT processing can be applied to the result.

Example:

        StatusObj = Net.GetNodeStatus(Node.FirstSelected());
        var status = StatusObj.Param("NtNodeStat");
        switch (status)
        {
            case 0:
                strStatus = "Selected object in not in Shared Space";
                break;
            case 1:
                strStatus = "This script runs on server and found that selected object is in Shared Space";
                break;
            case 2:
                strStatus = "This script runs on client and found that selected object is in Shared Space";
                break;
        }

HRESULT IRiNetwork::NtSetCNotifSounds | ( | [in] VARIANT | vEnabled | ) |

Set client notify sounds status.

Parameters:

  | vEnabled | [in] Put true to enable sounds (login, chat and etc.) and false to disable all sounds for all clients.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.NtSetCNotifSounds(true);

HRESULT IRiNetwork::NtGetCNotifSounds | ( | [out, retval] VARIANT * | pvEnabled | ) |

Get client notify sounds status.

Returns:
  vEnabled [out, retval] true if sounds are enabled.

  Standard HRESULT processing can be applied to the result.

Remarks:
  Be aware that the sound status is automatically set by Desktop Preferences object.

            var notifySound = Net.NtGetCNotifSounds();
            System.Trace(notifySound);

HRESULT IRiNetwork::NtSetCAutoReconnect | ( | [in] VARIANT | vEnabled | ) |

Set clients' auto-reconnect status.

Parameters:

  | vEnabled | [in] If true then after a ctx load tries connect to Shared Space, if the ctx file was created while the client was logged in. If @ false and client was logged in while the ctx was created, then client's Active attribute will be set to as well.

Returns:
  Standard HRESULT processing can be applied to the result.

            Net.NtSetCAutoReconnect(true);

HRESULT IRiNetwork::NtGetCAutoReconnect | ( | [out, retval] VARIANT * | pvEnabled | ) |

Get clients' auto-reconnect status.

Returns:
  vEnabled [out, retval] true if automatic login is enabled.

  Standard HRESULT processing can be applied to the result.

Remarks:
  Be aware that the reconnect status is automatically set by Desktop Preferences object.

            var autoRecon = Net.NtGetCAutoReconnect();
            System.Trace(autoRecon);

HRESULT IRiNetwork::GetNodeSessionId | ( | [in] VARIANT | vNodeName,
|  | [in] VARIANT | vIndex,
|  | [out, retval] VARIANT * | pvSessionId |
| ) |  |  |

Get session Id for specified object and Shared Space.
Method enumerates all Shared Spaces in which the object is located and returns session Id.

Parameters:

  | vNodeName | [in] Specify object full name identification for which you want get the session Id. If no object is specified, then the current scene will be checked.
  | vIndex | [in] If object is located in more than one Shared Space, specify the index of the Shared Space for which the session Id will be returned. Use GetNodeStatus method to find in how many Shared Spaces it resides in.

Returns:
  pvSessionId [out, retval] Returns desired session Id.
  If NULL or empty string is returned, then the object is not located in Shared Space or vIndex is wrong.

  Standard HRESULT processing can be applied to the result.

            var nodeSessID = Net.GetNodeSessionId(Space.CurrentScene(), 1);
            System.Trace(nodeSessID);

HRESULT IRiNetwork::GetNodeSessionNickName | ( | [in] VARIANT | vNodeName,
|  | [in] VARIANT | vIndex,
|  | [out, retval] VARIANT * | pvNickname |
| ) |  |  |

Get client/server nickname for specified object and Shared Space.
Method enumerates all Shared Spaces in which the object is located and returns session nickname if found.

Parameters:

  | vNodeName | [in] Specify object full name identification for which you want get the nickname. If no object is specified, then the current scene will be checked.
  | vIndex | [in] If object is located in more than just one Shared Space, specify index of the Shared Space for which the nickname will be returned. Use GetNodeStatus method to find in how many Shared Spaces the object is included in.

Returns:
  pvNickname [out, retval] Returns desired nickname.
  If NULL or empty string is returned, then the object is not located in Shared Space or vIndex is wrong.

  Standard HRESULT processing can be applied to the result.

            var nodeSessNN = Net.GetNodeSessionNickName(Space.CurrentScene(), 1);
            System.Trace(nodeSessNN);

HRESULT IRiNetwork::NtSetCDefaultServerAddr | ( | [in] VARIANT | vAddress | ) |

Set default server address.

Parameters:

  | vAddress | [in] Default server address. If not set or it is empty, then the default server address is searched in /Network space.

Returns:
  Standard HRESULT processing can be applied to the result.

Remarks:
  The default settings is stored in /Network/NetProperties object.

            Net.NtSetCDefaultServerAddr();

HRESULT IRiNetwork::NtGetCDefaultServerAddr | ( | [out, retval] VARIANT * | pvAddress | ) |

Get default server address.

Returns:
  pvAddress [out, retval] Returns default server address stored in /Network/NetProperties object.

  Standard HRESULT processing can be applied to the result.

     var defServeAdd = Net.NtGetCDefaultServerAddr();

HRESULT IRiNetwork::NtSetCDefaultServerPort | ( | [in] VARIANT | vPort | ) |

Set default server port.

Parameters:

  | vPort | [in] Default server port. If not set, it is empty or set to 0, then the default server port is searched in /Network space.

Returns:
  Standard HRESULT processing can be applied to the result.

Remarks:
  The default settings is stored in /Network/NetProperties object.

     Net.NtSetCDefaultServerPort();

HRESULT IRiNetwork::NtGetCDefaultServerPort | ( | [out, retval] VARIANT * | pvPort | ) |

Get default server port.

Returns:
  pvPort [out, retval] Returns default server port stored in /Network/NetProperties object.

  Standard HRESULT processing can be applied to the result.

     var defServePort = Net.NtGetCDefaultServerPort();

HRESULT IRiNetwork::ReplaceAddrInSSS | ( | [in] BSTR | bstrObjName,
|  | [in] BSTR | bstrOrigAddr,
|  | [in] BSTR | bstrNewAddr |
| ) |  |  |

Replace server addresses in SharedSpaceSettings objects.

Parameters:

  | bstrObjName | [in] Object identification for which the replace will be executed (all sub-objects are enumerated). If it is not specified, current scene is enumerated.
  | bstrOrigAddr | [in] Original address.
  | bstrNewAddr | [in] New address.

Returns:
  Standard HRESULT processing can be applied to the result.

            var objName = Node.FirstSelected();
            var origAdd = tsportal.caligari.com;
            var newAdd = tpportal.caligari.com;
            Net.ReplaceAddrInSSS(objName, origAdd, newAdd);

HRESULT IRiNetwork::EnterSharedSpace | ( | [in] BSTR | bstrSSSNode | ) |

Try to enter specified Shared Space.

Parameters:

  | bstrSSSNode | [in] Full name of Shared Space Settings object that holds information about the shared space.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.EnterSharedSpace('/Project/NewSharedSpace');

HRESULT IRiNetwork::GetNearestSharedSpace | ( | [in] BSTR | bstrNodeName,
|  | [out, retval] VARIANT * | pvSharedSpaceName |
| ) |  |  |

Get the closest Shared Space in which the given object is included. To find other shared spaces call this method again with returned Shared Space. To get total number of the Shared Spaces call GetNodeStatus.

Parameters:

  | bstrNodeName | [in] Full name of the object for which you want to find nearest Shared Space.

Returns:
  pvSharedSpaceName [out, retval] Returns root of the nearest shared space in which the bstrNodeName is included. if the object is not included in any shared space, then empty string is returned.

  Standard HRESULT processing can be applied to the result.

     var nearSS = Net.GetNearestSharedSpace(Node.FirstSelected();

HRESULT IRiNetwork::GenerateCacheIIDAttr | ( | [in] BSTR | bstrNodeName | ) |

Generate cache identification number. The number is stored in CON_CMD_NETWORK_MANUAL_CACHE_IID (con.name: NetManualCacheIID) connector as IID. This IID is used for manual cache system for object's version identification and has sense to be used only on the top level objects in the Shared Space.

Parameters:

  | bstrNodeName | [in] Full name of the object for which you want generate new cache IID. If you don't specify the object, then current selection is enumerated and the IID is set for all selected nodes. If a sub-object already has an assigned IID, then it is removed and replaced with this new one.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.GenerateCacheIIDAttr(Node.FirstSelected());

HRESULT IRiNetwork::RemoveCacheIIDAttr | ( | [in] BSTR | bstrNodeName | ) |

Remove cache identification attribute CON_CMD_NETWORK_MANUAL_CACHE_IID (con.name: NetManualCacheIID) so the node will no longer be cached.

Parameters:

  | bstrNodeName | [in] Full name of the object for which you want remove cache IID. If you don't specify an object, then current selection is enumerated and the IID is removed from all selected nodes.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.RemoveCacheIIDAttr();

HRESULT IRiNetwork::PurgeCache | ( | [in] DWORD | dwKeepDays | ) |

Remove objects from network cache.

Parameters:

  | dwKeepDays | [in] Objects accessed outside this parameter will be deleted. (not accessed means no activity; not selected or manipulated or such).

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.PurgeCache(30);

HRESULT IRiNetwork::NtOpenViewEx | ( | [in] BOOL | bAutoLogin | ) |

Use this method to open a network view.
If you are already connected, standard network view is opened and no other action is executed.
In case you are not logged in yet, then the login view opens.

Parameters:

  | bAutoLogin | [in] Specify true for automatic connection.

Returns:
  Standard HRESULT processing can be applied to the result.

See also:
  OpenNetworkView

     Net.NtOpenViewEx(true);

HRESULT IRiNetwork::NtGetFirstServerPortRange | ( | [out, retval] VARIANT * | pvPort | ) |

Read the first port of the server range.

Returns:
  pvPort [out, retval] Returns the first server port.

  Standard HRESULT processing can be applied to the result.

     var fPort = Net.NtGetFirstServerPortRange();

HRESULT IRiNetwork::NtGetLastServerPortRange | ( | [out, retval] VARIANT * | pvPort | ) |

Read the last port of the server range.

Returns:
  pvPort [out, retval] Returns the last server port.

  Standard HRESULT processing can be applied to the result.

     var lPort = Net.NtGetLastServerPortRange();

HRESULT IRiNetwork::NtSetServerPortRange | ( | [in] VARIANT | vFirstPort,
|  | [in] VARIANT | vLastPort |
| ) |  |  |

Use this method to set the server's port range.

Parameters:

  | pvFirstPort | [in] Set the first server port.
  | pvLastPort | [in] Set the last server port.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.NtSetServerPortRange(1100, 2500);

HRESULT IRiNetwork::LoadNetworkPropsFromCfgFile | ( | [in] VARIANT | vFilePath | ) |

Call this method to restore the NetProperties node from config file.

Parameters:

  | vFilePath | [in] Full file path of the config file. If it is not specified, the default file path is used (application directory).

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.LoadNetworkPropsFromCfgFile();

HRESULT IRiNetwork::NtCreateServerView | ( |  | ) |

Method creates and opens the Server View for remote manipulation.

Returns:
  Standard HRESULT processing can be applied to the result.

     Net.NtCreateServerView();

## Property Documentation

VARIANT * IRiNetwork::ConLocal([in] BSTR szNodeName, [in] BSTR szConName)`[get]`

Find whether specified connector is local or not.

Parameters:

  | szNodeName | [in] Full name of object.
  | szConName | [in] Connector name.

Returns:
  pVal [out, retval] Returns true if connector is local.

  Standard HRESULT processing can be applied to the result.

            var nodeName = Node.FirstSelected();
            var conName = Mesh;
            var isLocal = Net.ConLocal(nodeName, conName);
            if(isLocal == true)
            {
                System.Alert(isLocal);
            }
            else
            {
                System.Alert("not local");
            }

VARIANT IRiNetwork::ConLocal([in] BSTR szNodeName, [in] BSTR szConName)`[set]`

Set for connector whether it will be local or not. If a connector is local, it's value is not synchronized via network.

Parameters:

  | szNodeName | [in] Full name of object. If not specified, the first selected object is used.
  | szConName | [in] Connector name. If not specified, all connectors are set for the object and all sub-objects except owner and sub-objects connectors.
  | val | [in] Set to true to make the connector local.

Returns:
  Standard HRESULT processing can be applied to the result.

            Net.ConLocal(nodeName, conName, true);