EBDN - Community - Question & Answers

  Friday, 17 December 2021
  2 Replies
  0.9K Visits
0
Votes
Undo
How to add destinations to a Wire in Engineering Base from VBA? The following snippet doe snot work


Public Function store(ByRef parent As ObjectItem) As ObjectItem
Dim coreParent As ObjectItem
Set coreParent = EbHelper.FindOrCreateCableParent(parent, data, GetCableName)

Set wire = coreParent.NewChild(aucObjWire, aucWireUnspecified)

SetAttribute wire, aucAttrDesignation, GetWireName

Dim contactEnd1 As ObjectItem
Set contactEnd1 = EbLocator.FindContact(...)
Dim contactEnd2 As ObjectItem
Set contactEnd2 = EbLocator.FindContact(...)

If (contactEnd1 Is Nothing = False And contactEnd1 Is Nothing = False) Then
Call wire.TargetAssociations.New(aucRolePin1Wire, contactEnd1)
Call wire.TargetAssociations.New(aucRoleWire2Module, contactEnd2)
End If

wire.Children.StoreAll
wire.store

Set store = wire
End Function


Contact 1 and 2 are of type aucObjDevices of type Socket. What am i missing?