Expanding edges - 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

A much better way of traversing across multiple relationships is through EdgeDefs. The Client API support for EdgeDefs is identical to support for expanding RelDefs with one small difference. Until now, we have been dealing with InterfaceDefUIDs and RelDefUIDs. Those are easy because the Schema Editor makes the UID equal the name. It does this for several types of objects like ClassDef, InterfaceDef, PropertyDef, and RelDef. However, EdgeDefs do not have this constraint. The UIDs are generated from the name, but they are prefixed with 'EDG_'.

Let's say that we have an EdgeDef named NavFunctionalUnitToPlant to do the same job as the last example. The code to traverse that edge is as follows.

lobjPlant = lobjUnit.GetEnd1Relationships().GetRel("EDG_NavFunctionalUnitToPlant").GetEnd2()

With EdgeDefs, you still must pay careful attention to the cardinality of the edge. However, using criteria on the EdgeDef you can turn a "to many" traversal into a "to one."