Hi,
I've got a problem accessing by VBA user attributes stored in Linkages in a dgn file.
Could somebody please have a look on below code and advice. The TransferBlock procedure for sure works fine because I tried it in different macro which shows the id of selected element (not feature).
The macro itself is a modified one from Bentley Map V8i Development and Product Customization Guide.
I attach the .mvba file and sample dgn.
clsLoadProperties:
Implements ILocateOpEventsPrivate Sub ILocateOpEvents_OnCleanup()End SubPrivate Const lIDGL As Long = 889 ' ID of mine attributePrivate Sub ILocateOpEvents_OnFinished(ByVal locateOP As xft.ILocateOp) Dim fe As FeatureEnumerator Dim oElement As element Dim IDglReturn As Long Dim tDBlock() As DataBlock Set fe = locateOP.GetLocatedFeatures Dim oFeature As feature Do While fe.MoveNext Set oFeature = fe.Current tDBlock = oFeature.Geometry.GetUserAttributeData(lIDGL) TransferBlock tDBlock(0), 0, IDglReturn, False With oFeature .SetProperty "id_gl", IDglReturn .ApplyAttributeChanges .Write (False) End With Loop End Sub Private Sub ILocateOpEvents_OnRejected(ByVal RejectedReasonType As xft.LocateOpRejectedReasonType, RejectedReason As String)End SubPrivate Sub ILocateOpEvents_OnTerminate()End SubPrivate Sub ILocateOpEvents_OnValidate(ByVal RootFeature As xft.IFeature, ByVal element As element, Point As Point3d, ByVal View As View, Accepted As Boolean, RejectReason As String)End SubPrivate Sub TransferBlock(dBlk As DataBlock, lOffset As Long, value As Long, _ copyToDataBlock As Boolean) With dBlk .Offset = lOffset .CopyLong value, copyToDataBlock End WithEnd Sub