insert symbols from project library with hierarchical names
How to insert instances of linked symbols from the library into a new screen, using hierarchical naming:
Notice the ".Pump" for the symbol in the project library called "Pump"
Take care, each symbol receives a unique symbol number!
VBA Code:
Sub insertLinkedSymbols()
Dim myScr As DynPicture
Dim myElem As Element
Dim i
Set myScr = MyWorkspace.ActiveDocument.DynPictures.Item("a")
If Not myScr Is Nothing Then
For i = 0 To 10
Set myElem = myScr.Elements.Item("Pump" & i)
If myElem Is Nothing Then
Set myElem = myScr.Elements.Create("Pump" & i, tpSymbolLnk)
myElem.DynProperties("SubstituteCombinedName") = True
myElem.DynProperties("LinkName") = ".Pump"
myElem.DynProperties("PropSymbolNumber") = i
myElem.Name = "Pump" & i
myElem.Top = 100 + (50 * i)
myElem.Height = 50
End If
Next i
End If
End Sub
This is a migrated post! Originally posted on 14.09.2011 by user markclemens. Please be aware that information can be outdated.