Set oSymbols=Projects.Items("Active Symbol")
For Each oSymbol In oSymbols
'Only attempt to change view options if they are default
If oSymbol.Item("Symbol Style") Is Nothing Then
'If stereotypes can apply to the symbol, try these first
Select Case oSymbol("Class Name")
Case "OCD::Instance":
Try oSymbol,oSymbol
End Select
'If still default 2nd attempt based on dict item stereotype
If oSymbol.Item("Symbol Style") Is Nothing Then
Set oDictItem = oSymbol.Item("Dict Item")
If Not oDictItem Is Nothing Then
Try oSymbol,oDictItem
'If still default 3rd attempt based on stereotype on
'underlying type (part or port type)
If oSymbol.Item("Symbol Style") Is Nothing And _
(oDictItem("Class Name")="Role" Or _
oDictItem("Class Name")="Attribute") Then
Set oType = oDictItem.Item("Class")
Try oSymbol,oType
End If
End If
End If
End If
Next
'Attempts to change the view options on Symbol oSymbol based on the sterotypes applied to oItem
Sub Try(oSymbol,oItem)
Set oStereotypes = oItem.Items("Stereotype")
For Each oStereotype In oStereotypes
Set oStereotypeStyle = oStereotype.Item("Symbol Style")
If Not oStereotypeStyle Is Nothing Then
oSymbol.Add "Symbol Style", oStereotypeStyle
oSymbol("View Show Stereotype")="FALSE"
Exit For
End If
Next
End Sub