Creating relationships - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

Using the GeneralUtilities class once again, there are two methods helpful to creating relationships.

Public Shared Function InstantiateRelation(ByVal pstrDefUID As String, ByVal pobjIObject1 As IObject, ByVal pobjIObject2 As IObject, ByVal pblnInstantiateOnly As Boolean) As IObject

One thing to notice about this is that it returns IObject. An example of using this to create a relationship between a host and vault is as follows.

Dim lobjVaultHostIObj As IObject = GeneralUtilities.InstantiateRelation("SPFVaultHost", lobjVaultIObj, lobjHostIObj, False)

...

lobjVaultHostIObj.GetClassDefinition.FinishCreate(lobjVaultHostIObj)