Navigating the schema - 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

In some cases you may have a need to navigate around the schema for a particular class definition. The code example below shows how to navigate from a ClassDef to InterfaceDefs and then to PropertyDefs.

'

' Find the classdef

'

Dim lobjClassDef As IClassDef = Me.GetClassDefinition

'

' Get all the realized interfacedefs

'

Dim lobjIDefs As IObjectDictionary = lobjClassDef.GetRealizedInterfaceDefs

With lobjIDefs.GetEnumerator

Do While .MoveNext

'

' Use ToInterface because we are going to call a method on it otherwise .Interfaces("IInterfaceDef")

'

Dim lobjIDef As IInterfaceDef = CType(.Value.ToInterface("IInterfaceDef"), IInterfaceDef)

With lobjIDef.GetExposedPropertyDefs.GetEnumerator

Do While .MoveNext

Dim lobjPDef As IPropertyDef = CType(.Value.ToInterface("IPropertyDef"), IPropertyDef)

Loop

End With

Loop

End With

'

' Get all the Properties

'

Dim lobjExposesRels As IRelDictionary = lobjIDefs.GetEnd1Relationships.GetRels("Exposes")

If lobjExposesRels.Count > 0 Then ' Collection will always be initialized

Dim lobjPDefs As IObjectDictionary = lobjExposesRels.GetEnd2s

End If