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.
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
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.
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.
If a fence is active, the Use Fence option is enabled. Toggle that option if you want to use the current fence contents.
If a Selection Set is active, the Use Selection Set option is enabled. Toggle that option if you want to use the current Selection Set contents.
Leave both options off if you want to scan all line elements in the active DGN model.
Click the Change Direction button to begin. The tool gets a list of lines and line-string, then changes the direction of each.
The tool lets you know how many lines were changed.
You can download the Change Line Direction MVBA project.
The ZIP file includes the MVBA project
vba run [ChangeLineDirection]modMain.Main
Post questions about MicroStation programming to the MicroStation Programming Forum.