Original Article Date: March 27, 2006
With thanks to Robert McCartney for contributing this VBA macro that will help you to remap your elements from one set of attributes to another. It's a nice alternative to MicroStation's remapping utility. 2006-05-30 Application updated. 2006-06-07 Application updated.
Download 295.zip and extract ElementReMap.mvba from the zip file. Place the mvba in the folder pointed to by MS_VBASEARCHDIRECTORIES Keyin vba load elementremap to load the project, or... Configure MS_VBAAUTOLOADPROJECTS to automatically load the mvba project upon startup. Keyin VBA RUN [RemapElements]main to run the macro, or... Place the keyin on a function key or custom button for quick and easy access. This macro creates and applies element remapping patterns to migrate data from one set of symbology attributes to another. The remapping patterns are loaded and saved to XML records for storage and viewing via a web browser. Once loaded you'll notice four distinct tabs: 1. Active Remapping Attributes 2. Remap Pattern List 3. Element Remapping 4. Element Attributes Active Remapping Attributes The data in this tab is used to build the remapping patterns. The content displayed in the Active Element Attributes section on the left side is populated by the ReScan Attriubtes button on the fourth tab. You then select which elements to remap and select your output (destination) attributes. In a nutshell... 1. Load the element attributes via the fourth tab. 2. Define an element attribute filter 3. Define the target element attribute - This is a pattern. 4. Save or load a pattern from the second tab 5. Remap the element attributes by selection set, selected models or design file. For example: In the image below you can see that all elements in my test file were drawn in colour 0, style 0, and on the default level. The only significant variation are the two different weights.
In order remap the block lines to the proper level and change thier symbologys, I've selected the line strings on the default level that are drawn in colour 0, weight 1 and style 0. In the Intended Element Attributes section, I've selected the desired output actions which is to move them to the level called Block Line and change the symbology to ByLevel.
Select the Save Active Remap Pattern to save this information and write it to the second tab called Remap Pattern List. The lower portion of this tab allows you to write the patterns to an external XML file that will be written to the root of your C:/ drive.
Process the data by navigating the the third tab titled Element Remapping. Note that there is an undo button provided or you can use Edit > Undo from MicroStation.
Choosing Select Single Element or Selection Set will be determined by the Remapping Option chosen. If the Apply Selected Remap Pattern option is chosen for use with Select Single Element or Selection Set then only the first pattern from the list will be tested. Multiple remap patterns can only be used when doing a file Scan/Remap or Model Scan/Remap. So if you set the Remapping Option to Filter with Active Attributes then only the current dialog attributes will be scanned/remapped. If you choose Apply Selected Remap Pattern then all the selected remap patterns will be tested and the remap attributes applied if they pass...Depending the absolute/relative mode of course.... When remapping there are two modes: Absolute - An element must pass the entire attribute filter criteria before it can remapped. i.e: The element must match the selected level, type, colour, weight, style attributes in order to be remapped. Relative - Any element attribute which matches the selected filter attribute, and has a target attribute selected, will be remapped. ie: If the element colour matches the filter then it will be remapped to the new attribute if selected.
This program was developed on MicroStation 08.05.01.25 and is NOT guaranteed to work on all versions of MicroStation. Please test this software on a copy of your drawing until you are comfortable working with it. Thank you. This program is supplied as is. AskInga, Bentley Systems Inc., and the author of the program assumes no liability for damages direct, indirect, or consequential, which may result from the use of this program. Use this program at your own risk.
AskInga Article #295