Attribute ID

I have requested for Attribute ID to run microstation VBA programs. It is a while and I am waiting. Any idea how long it takes?

  • I have requested for Attribute ID to run microstation VBA programs

    It's not clear what question you are asking.  You don't need an 'Attribute ID' to run VBA in MicroStation.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon,

    Attached is the code I am trying to run. Please see the attribute ID required. I am new to this.

    User Attribute Example

    This example illustrates how to save data to an element's attributes, and how to retrieve data from an element's attributes.

    This example uses GetUserAttributeData, AddUserAttributeData, CopyString, and CopyLong. AddUserAttributeData adds user attribute data to an element. GetUserAttributeData retrieves user attribute data from an element. Both of these methods use DataBlock objects to exchange data with a macro. In this example, the macro uses CopyLong and CopyString to transfer data to and from the DataBlock.

    
    '  Do not use 22352 as your attribute ID.  You must obtain a 
    '  unique attribute ID from Bentley Systems.
    Private Const attrId As Long = 22352
    '  AddLinkage and GetLinkage both transfer the data using TransferBlock.
    '  That way, it is easy to be certain that the transfer always occur in the
    '  same order.
    Private Sub TransferBlock(dblk As DataBlock, name As String, value As Long, _
                       copyToDataBlock As Boolean)
        dblk.CopyString name, copyToDataBlock
        dblk.CopyLong value, copyToDataBlock
    End Sub
    Sub AddLinkage()
        Dim ele As Element
        Dim id As DLong
        Dim dblk As New DataBlock
        
        id = DLongFromLong(50296)
        
        Set ele = ActiveModelReference.GetElementByID(id)
        
        TransferBlock dblk, "Added by User Attributes Example", 50296, True
        
        ele.AddUserAttributeData attrId, dblk
        ele.Rewrite
    End Sub
    
    Sub GetLinkage()
        Dim ele As Element
        Dim id As DLong
        Dim dblk() As DataBlock
        Dim value As Long, name As String
        
        id = DLongFromLong(50296)
        
        Set ele = ActiveModelReference.GetElementByID(id)
        dblk = ele.GetUserAttributeData(attrId)
        TransferBlock dblk(0), name, value, False
        MsgBox "NAME: " & name & ", VALUE: " & value
    End Sub
    
    Hope this helps understand my question. I have put this in Italics

    Regards,

    Ramesh.P.K.

  • ' Do not use 22352 as your attribute ID. You must obtain a ' unique attribute ID from Bentley Systems. Private Const attrId As Long = 22352

    So you've applied to the Bentley Developer Network (BDN) for an Attribute ID for your company?

    It is a while and I am waiting

    I too have questions put to the BDN and which remain unanswered after many months.  You could try direct contact:  or, nearer home,  and .

     
    Regards, Jon Summers
    LA Solutions

  • Hi Ramesh,

    Attached is the code I am trying to run. Please see the attribute ID required.

    Yes, to use user attributes the ID is required. It works as unique identifier of a company that creates and "owns" the data.

    I am new to this.

    You should be aware to use user attributes is not recommended today (limited is size and functionality, complicated usage, performance issues when modified often etc.).

    Newer versions of MicroStation offer better ways how to store custom data with elements, especially Item Types (users' oriented tool) and EC data (technology).

    You did not follow the forum best practices, so it's not clear what MicroStation version do you use. It's also not described for what purpose you want to use the attributes, so it's hard to say whether a better alternative exists in the discussed case.

    With regards,

      Jan

  • Thanks, Jan.
    Sorry I forgot to mention the version and platform. We will follow the best practices.
    I was trying to retrieve “getuserattributes” to get the linkage data. We are presently using V8i, V8.11.9.916 select series 10 on Windows10
     
    Regards,
    Ramesh.P.K.
     
  • Hi Ramesh,

    I was trying to retrieve “getuserattributes” to get the linkage data.

    To retrieve existing ones or to create and save own data? It's a big difference:

    • To save (attach) own data, the attribute ID is required. Bentley have to assign the ID to your company (to your BDN membership).
    • To retrieve existing data ... it's a bit more complicated:
      To retrieve own data, you have your attribute ID already, so this situation is fine. And there is no reason to retrieve data with other IDs, because they are not yours (and moreover, you do not know used binary structure of such data). But sometimes it's necessary to access the data, where IDs used by MicroStation are mentioned in some header file in MicroStation SDK (but plenty of these information can be accessed using MDL functions). For other IDs, it's about try-and-test approach with a bit of reverse engineering. Such situation is very rare, I remember maybe one or two such requests (that were valid) during my whole developer's career.
    We are presently using V8i, V8.11.9.916 select series 10 on Windows10

    You have not provided any information what type of data and in what structure you would like to attach to elements, so it's hard to guess what solution is the best.

    But I strongly recommend to think about e.g. C# and using EC data. It's not simple task, because EC framework is not well documented and there are not many descriptions how to use EC data (on the other hand, many discussions about CONNECT Edition can be used also as valuable source). On the other hand, to store own data in EC format is automatically compatible with the rest of MicroStation, supported by many tools (especially in CONNECT Edition) and is e.g. automatically converted to i-model.

    To use user attributes in new applications today is like to use steam engine ... it's not very complicated, it will work (because it does not break compatibility), but probably everybody will agree that it's not best solution for future.

    With regards,

      Jan

  • I was trying to getattributes already in the design file. Attached is the snap which shows the same and hope you will understand that this is old time PDS DGN model. Is there we can get at it? Also this example show the cell element as well. This is V8i upgraded file.
     
    Regards,
    Ramesh.P.K.
     
  • PDS Data Linkages

    this is old time PDS DGN model

    Why not tell us that in your first post?

    Intergraph's Plant Design System (PDS) pre-dates MicroStation.  It was the first app to implement element attributes: the ID of a PDS attribute is zero!

    If you're extracting PDS data from MicroStation element attributes, you don't need an ID from Bentley Systems.  In other words...

    Private Const attrId As Long = 0

    You can see that in your screenshot: it's the first DMRS linkage (Database management and retrieval system).

    MicroStation uses data attributes internally for many purposes.  Your screenshot shows four DMRS linkages.  The first is PDS, the others are probably MicroStation linkages that don't interest you.  Read this article about VBA and DMRS linkages.

     
    Regards, Jon Summers
    LA Solutions

  • Well, I could relate my first post with the question in hand. I was purely thinking in terms of Microstation and then I realized that it had something to do with PDS..:)
     
    Regards,
    Ramesh.P.K.