Microstation-Bentley

Developing VBA Applications with Microstation

To make applications, Microstation supports different languages, including Microstation Development Language (MDL) which is preferred by Bentley gurus. It also supports old basic since many years ago and at one time it supported 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 programming idea does not have much to do. However, for someone who understands OOP, and has played with Visual Basic 6, you will find yourself almost dead laughing. Some examples usually come with the program, but here is the trick I've seen technicians use: 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 save everything that is 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 entire routine as I have saved it. The usefulness of this even without programming is extremely interesting if you can take advantage of it, I have seen menus made in pure macro 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 if you do it step by step, it then facilitates the integration of statements. It can also be run with the option Step by Step, Which would allow running in parts as a debugger.

Visual basic microstation

The example that I am showing you, which my friends from the north have already worked on, includes separately modules to ensure the connection to the database, the execution of the routine of links, the creation of linked entities, the application of the theme and one for global settings. 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.

Golgi Alvarez

Writer, researcher, specialist in Land Management Models. He has participated in the conceptualization and implementation of models such as: National Property Administration System SINAP in Honduras, Management Model of Joint Municipalities in Honduras, Integrated Cadastre-Registry Management Model in Nicaragua, Territory Administration System SAT in Colombia . Editor of the Geofumadas knowledge blog since 2007 and creator of the AulaGEO Academy that includes more than 100 courses on GIS - CAD - BIM - Digital Twins topics.

Related Articles

4 Comments

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

  2. You smoke vector tobacco just that.

Leave a comment

Your email address will not be published. Required fields are marked with *

Back to top button