Updating objects and 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

To update objects and relationships, there is no need to learn any additional code. You simply access the interfaces and properties, setting values as needed. An example of querying for a ProcessInstrument and updating the operating temperature is as follows:

' Begin transaction

Dim lcolTransaction As New ObjectDictionary(Me.SPFSession)

' Find an instrument

Dim lobjInstr As IObject = Me.SPFSession.GetObjectByName("CV-101", "IProcessInstrument")

' Change the operating temperature

With lobjInstr.Interfaces("IInstrument").Properties("Instrument_OperatingTemperature")

.Value = "150"

.UoM = "C"

End With

' Add this instrument to the transaction

lcolTransaction.Add(lobjInstr)

' Commit transaction

lcolTransaction.Commit()