Developing VBA Applications with Microstation

To make applications, Microstation supports different languages, including Microstation Development Language (MDL) which is preferred by the Bentley gurus. It also supports basic old from many years ago and at one time endured Java, hence that version called Microstation J.

But to develop with pleasure and without much return, the most practical is about the Visual Basic module that comes with the program, in versions prior to XM (8.9) includes a full Visual Basic 6.3 editor, in the latest goes beyond.

Visual basic microstation

To start

It is clear, that someone who has no idea of ​​programming does not have much to do. However, for someone who understands object-oriented programming, and has played with Visual Basic 6, you will find yourself almost dying of laughter. With the program usually come some examples, but here, the trick that I have seen use the technicians: Use macros.

Microstation facilitates the saving of routines in the form of macro in mvba extension, when viewing the code it is easier to start in the way how the programming works for Microstation instead of To make shirt sleeves right from the start. For now I will use the example of Mexican friends, who in the past week I was asked for help to thematize in Geographics.

How to Create a Macro.

Utilities> macro> project manager.

Visual basic microstation

A new project is created here, and named. They are usually stored in Program Files / Bentley / workspace / projects / vba But you can select any destination.

Visual basic microstation

How to save it.

To start recording, press the blue wheel icon. The program will keep everything done from then on.

For example: Place a Fence view, Turn off all levels with the exception of apple and centroid boundaries, transfer boundary links to centroids, create 62 level shapes, turn off boundaries, move centroid links to shapes, load command to thematize, thematize according to sector In which are the apples with a specific color for each sector, put the legend.

The process can be paused, or terminated with the red box icon. If the button is pressed play, the program will execute the complete routine as I have saved it. The usefulness of this even without programming is very interesting if you can get the benefit, I've seen menus made purely by non-programmers.

If it is desired that every time we run Geographics The macro is loaded, the fourth column is activated Auto-load, And that will create a variable in the file Msgeo.ucf.

How to edit the code.

To view the code, you press the button that opens the Visual Basic Editor.

Visual basic microstation

Everything is saved as a single module, but in case of doing it step by step, it then facilitates the integration of statements. It can also be executed with the option step by step, Which would allow running in parts as a debugger.

Visual basic microstation

The example I am showing you, which the friends of the north have already worked on, includes separately modules to ensure the connection to the database, the execution of the routine of ligues, the creation of linked entities, the application of the theme and one for global configurations. The code can carry password, Which prevents the operators from causing a disaster or facilitate the separation of libraries of classes that we do not want to share with the user programmer.

4 Replies to "Development of VBA applications with Microstation"

  1. Tere. Selline küsimus. Kas teie koodisüsteemid ja andmete export / import Trimble S6 ja PowerDraft-i tegelete? Otsin programeerija.

Leave an answer

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.