Element properties using VBA

We are using connect edition of Microstation on windows 10 OS
I wanted the properties of the elements(see attached image) to be written to a text file or excel sheet. Any help is appreciated. I wanted to see this happen using mVBA.

  • I wanted to see this happen using mVBA

    What's special about VBA?  If you're using MicroStation CONNECT, then what about using a Report?  No programming required!

    You should provide more clues to enable us to help more:

    1. Are you using plain old MicroStation or some other product (e.g. pipe design)?
    2. What app. created that pipe model?
    3. Can post a small sample DGN file?

     
    Regards, Jon Summers
    LA Solutions

  • Thank you, Sir.
     
    VBA is just a comfortable and simple tool for me to work on these kinds of requirements involving both data and graphics..
    If we can generate a report nothing like that. I would be delighted.
     
    1. This file was originally developed in Bentley AutoPlant(Plant 3D Modelling).
    2. A module which is used to convert these native files, is Imodeler, again a Bentley product. iModeller generates i.DGN files of which I have taken snaps of properties in plain Microstation connect edition.
    3. I will try and get a small sample file. Just trying to remove the confidential info, if any.
     
    In the meantime,  could you let me know how we can get it as a report. Attached is the snap shot of the same object where I have marked in color showing Link and Xattributes field. Hope this helps.
     
    Regards,
    Ramesh.P.K.
     
     
  • Hi Ramesh,

    We are using connect edition of Microstation

    Please respect the best practices and specify the used product including its exact version. There have been released more than 20 version of MicroStation CE.

    I wanted to see this happen using mVBA.

    It is not how (professional) software development works ;-)

    When there is a goal or requirement, always available tools must be checked, whether they can be used and whether they allow to solve the requirement. MicroStation VBA is very limited, simple "hobby tool", with two main problems: The language + environment itself, and limited API in MicroStation (comparing to C++ and NET APIs).

    It is very simple to reach VBA limits, when more complex data structures are accessed.

    I wanted the properties of the elements(see attached image)

    They are not element properties.

    In MicroStation terminology, the element properties are level, color etc. What is on your picture, looks like EC data, which are data external to an element (there is a reference between original element and the data).

    I have marked in color showing Link and Xattributes field. Hope this helps.

    User data (links) are binary data, attached together with the element (in the element structure). Without further analysis (e.g. to use "analyze element" key-in) it cannot be told what data it holds. VBA can access it (search for "linkages" in VBA help), but because they are binary, with unknown structure (defined by the data author), applications should never access the linkages data, other than created by the application itself.

    XAttributes are not accessible directly by VBA (there is no such API). They are there, because EC data is stored as XAttributes elements.

    iModeller generates i.DGN files of which I have taken snaps of properties in plain Microstation connect edition.

    Data, attached to elements, is in i-model stored as EC data, and in MicroStation GUI displayed as is on your screenshot.

    The only way, how to access them from VBA, is to use PropertyHandler. See VBA help for description and examples, but be aware this approach is limited and it does not allow to access the data fully, only values. Plus there are some other limitations, so in some situations, VBA can be enough, but some other, depending on data structure and conditions, NET or C++ code must be used.

    With regards,

      Jan

  • Thanks Sir, once again. I will figure out the correct version and let you know. We will let the weekend and Christmas happen with Good Wishes for all.
    Your explanations is pretty elaborate and neat. I am novice both to Microstation and programming..:) . Please excuse me for this.
    I thought that the 3 images I sent(in my previous 2 mails) could explain in detail the background. I will use the Analyse Element and let me know what comes out.
     
    Regards,
    Ramesh.P.K.
     
     
  • I am novice both to Microstation and programming

    In that case a Report is your best approach.

     could you let me know how we can get it as a report

    Without seeing sample data, we can't confirm that it is possible to write a Report.

     
    Regards, Jon Summers
    LA Solutions

  • I am a little wary of sending data in public domain. Can I send it across to you? Could you provide me your ID.
    As mentioned, I want to see how far I can go, to get at the root of EC data items.
    If reports are best, I can stay with that for now.
     
    Thanks,
    Ramesh.P.K.
     
  • I am a little wary of sending data in public domain

    There is no request to share complete model, where sharing is of course arguable. But to share e.g. one component (valve, pipe...) should not be a problem.

    Can I send it across to you? Could you provide me your ID.

    Please read and respect community best practices! The communication is based on public sharing of ideas, not requesting direct response. When you want anybody solves your problem (in other than shared voluntary public way), ask and negotiate commercial service.

    I want to see how far I can go, to get at the root of EC data items.

    In VBA, PropertyHandler is the only (but limited) way. When there is a request beyond VBA capability, you have to learn EC data concept and EC API (regardless C++ or NET is used).

    If reports are best, I can stay with that for now.

    See MicroStation documentation how to create report and try it. No further advice can be provided without testing real data: What is represented in MicroStation GUI as data, available for an element, can be internally converted from many formats (because MicroStation historically offers several different ways how to store custom data with elements), and different tools (e.g. reports) and APIs (VBA, C++, NET) may offer different level of functionality.

    Regards,

      Jan

  •  
    I tried to delete components and make a small piece. But the message returned was It is a read only file
    Anyways I will figure this out and send a smaller sample in this forum.
     
    It is my mistake that I wanted to ask for some advise in this forum, assuming it is a small feature, that I could not understand as I was new to this place.
    I will look at your suggestion to check for a commercial alternative, if required and I am more than willing for that if it is a sizeable assignment.
     
    I will have someone in my office with C++ experience to look at this as well.
     
    By the by I figured out the version we are using : It is Microstation Connect Edition Update 16, Version 10.16.02.34
    Going further I will avoid getting this communication on a one to one, but rather go by the forum.
     
    Regards,
    Ramesh.P.K.
     
     
     
  • I tried to delete components and make a small piece. But the message returned was It is a read only file

    If the original file is i-model, it is read-only and cannot be edited. Try to reference it to empty file and copy the selected element(s) from reference to the active model. MicroStation should ensure all necessary data is copied automatically at background (but be aware i-model can be generated to do not allow copying).

    With regards,

      Jan

  • Great. I will look at it and let you know. Thanks for the explanation.
    The source is an iModel. In the future we will be developing the native model and also the iModel in our office.
     
    Regards,
    Ramesh.P.K.