Match Icon Check Boxes
Many years ago I created a MicroStation basic macro that would check the boxes of the match element command. At the time, MicroStation J did not save these settings, so every time you used the command you would have to check the boxes for the element attributes you wanted to change. In MicroStation V8i these settings are saved, so you only have to check the boxes one time. The basic macro (before VBA) was really simple and you could record it using the record macro dialog. VBA of course is just as easy – as we will see in a moment.
Do we still need a macro like this one? If you want all options on, or all off then there may still be room in your toolbox for this macro. It’s easy enough to record the action of checking these boxes (and unchecking the boxes). You can then add these new commands to your MicroStation menus. I like the idea of adding a couple of extra commands in my tasks menu, but adding new icons to the toolbox or pull down menu can work too.
To record the macro, open the VBA Project Manager dialog – Utilities | Macro | Project Manager.
The project manager dialog will open.
Before we record the check boxes we need to start the Match command. You can select the command from the Task menu, or type the keyin “match icon”.
The settings dialog changes to show the Match Element Attribute controls.
To record, highlight the Default VBA and then click the red button in the Project Manager dialog. Check the boxes.
Now, click the stop button (white square) in the Project Manager dialog.
Open the Visual Basic Editor (icon that looks like a dialog box – to the right of the triangle).
The visual basic editor will contain the macro you just recorded. It will look similar to the following.
You can remove all of the Dim statements because these are not used. Remove the second last line too, CommandStatement.StartDefaultCommand. This command will stop the match command and select your default command (usually smart selector). Finally, remove all of the extra lines. The finished macro will look like this.
Repeat these steps but uncheck the boxes. Or, copy and paste Macro1 (change the new sub name to Macro2). Replace the value -1 with 0. This new macro will uncheck all of the boxes.
If you want a different name for a macro, just change the sub name. Instead of Macro1() you could replace that with MatchChkAll() and for Macro2() maybe this could be MatchChkNone().
To run the vba you can use the keyin, vba run Macro1. But, we also want to make sure tha the Match Element Attributes command has been started. So, use the following keyin,
match icon;vba run Macro1
Run this keyin from the keyin browser, add an icon to the Change Attributes toolbox and maybe create a new task. With just a little bit of effort you can optimize your workflows and create a more productive CAD environment.
About Mark Stefanchuk: Mark is a VP and senior consultant with CAD Management Resources, Inc. He divides his time between developing innovative custom software solutions and helping clients navigate complex design automation environments. If you would like to find out how he can assist you with your design technology he can be reached directly at email@example.com.