Questions similar to these appear in the Bentley Community Discussion Groups. This article was written to provide a solution to the question: How do I change the direction of multiple lines at once?

MicroStation Visual Basic for Applications (MVBA) extends Microsoft VBA to provide 2D and 3D extensions for drawing and modelling.

Change Direction Tool

MicroStation lines have a direction. That is, a line from A to B is different to a line from B to A. Mathematically, a line is a vector.

Sometimes we want to change the direction of a line. A line from A to B is changed to be a line from B to A. Its coordinates remain the same. MicroStation provides a command CHANGE DIRECTION

However, that command is awkward to use when there are scores of lines to modify. This VBA project was developed to simplify the task of changing the direction of multiple lines simultaneously.

Change Direction dialog

Finding Lines

The Change Line Direction tool provides three ways to work with lines …

To start the Change Line Direction tool key-in …

VBA RUN [ChangeLineDirection]modMain.Main

The Change Line Direction dialog opens.

Leave both options off if you want to scan all line elements in the active DGN model.

Execute Change Line Direction

Click the Change Direction button to begin. The tool gets a list of lines and line-string, then changes the direction of each.

Change Direction completed

The tool lets you know how many lines were changed.

Acknowledgements

This VBA project evolved from a response to a Bentley Community Discussion Groups question by most valued professional (MVP) Jan Šlegr.



Download

Download the Change Line Direction Tool

You can download the Change Line Direction MVBA project. The ZIP file includes the MVBA project ChangeLineDirection.mvba.

Questions

Post questions about MicroStation programming to the MicroStation Programming Forum.