Questions similar to these appear in the Be Communities MicroStation Programming Forum.

This page lists some solutions to common MicroStation VBA (MVBA) problems. Tips are published as examples and are not necessarily working code.

Place Line with Terminator

Place Line with Terminator dialog

The Place Line with Terminator tool was developed in response to a request by a MicroStation user in the MicroStation Forum.

The purpose of the tool is to let a user place a set of lines, where each line has a terminator cell placed coincident with its end point …

Place Line with Terminator Screenshot

The Place Line with Terminator tool should work in a 2D or 3D DGN model. I developed it using MicroStation 2024. It should work also in MicroStation V8i or MicroStation CONNECT.

Dialog

Place Line with Terminator dialog

When you first run the macro using the key-in below, it pops the Place Line with Terminator dialog.

The Terminator Settings group shows the name of the terminator cell and the desired scale used for placement. The macro assumes that you have set the active cell library and a cell in that library designated the terminator cell. See MicroStation help about the Cell Library Dialog, where you'll find a section about specifying the terminator cell.

Place Line with Terminator Key-Ins

Load the VBA project using key-in
vba run [PlaceLineWithTerminator]modMain.main

You don't need to know anything about VBA to use our tool. If you're not interested in the description of the VBA code that follows, then skip to the download section.

Place Line with Terminator Tool: VBA Code Overview

The macro has threee VBA modules …

Module modMain Contains the Main entry point and some standard code and data
Class clsLineCreator Implements IPrimitiveCommandEvents as the line placement tool
UserForm frmPlaceLineWithTerminator User interface for this macro

Click the Place Line button to start. The button create a class that Implements IPrimitiveCommandEvents. As you place data points the class accumulates the points in a dynamic array along with the point count. The class display your progress by creating a temporary line-string in the _Dynamics event.

When you click the Reset button, the macro creates a LineElement and adds the terminator cell at each vertex.


Download

Download the Place Line with Terminator Tool

You can download the PlaceLineWithTerminator MVBA project. The project includes the MVBA project PlaceLineWithTerminator.mvba.

Questions

Post questions about MicroStation programming to the MicroStation Programming Forum.