MicroStation users sometimes want something different from the set of tools provided in the product.
Q How can I select elements that use a particular line style in MicroStation?
Questions similar to this, posed by MicroStation users and VBA developers, appear on the Bentley Discussion Groups, typically the MicroStation Forum or Programming Forum.
A This VBA project implements a tool that selects elements having a named line style.
The tool provides a dialog that contains a Combo Box having a list of line styles in the active DGN file. Choose a line style and click the Select button.
Optionally, click the Include Line Styles by Level button. When that option is ticked, the tool will find not only elements assigned the named line style, but also those elements on a level where the level uses a By Level line style.
The Select by Line Style tool scans the active model for elements having the chosen line style. The elements that match the search are highlighted, and you can see the number of elements found in the No. Found text box.
You don't need to be a VBA whizz to use this tool. Download the VBA project and key-in the command to run it.
If you are a VBA whizz, then the project is not locked. You can see the source code and modify it as required.
Key-in the following to start Select by Line Style and pop its dialog …
vba run [SelectByLineStyle]modMain.Main
Optionally, you can supply a line style name …
vba run [SelectByLineStyle]modMain.Main style name
The above code is available in this MicroStation
VBA project.
Unpack the ZIP archive and copy SelectByLineStyle.mvba
to a location where MicroStation
can find it.
A good place to copy it would be \Workspace\Standards\vba
.
To start selecting, type the following into MicroStation's keyin dialog …
vba run [SelectByLineStyle]modMain.Main
You will see the Select by Line Style dialog (VBA UserForm
).
Select by Line Style is freeware. We also grant you the right to copy and modify the code. Consequently, the software is not supported. It is not declared to fit for any purpose: use at your own risk.
Post questions about MicroStation programming to the MicroStation Programming Forum.