Search This Blog

Friday, July 29, 2005

ADT: Copying Layer Keys Between Layer Key Styles




I know, I hear you, you'd like to upgrade to the next release but you dread searching through the out of the box (OOTB) Layer standards to find all the new Layer Keys. Migrating them between releases isn't so bad (except for the transition to 2004), but moving across multiple releases has you in a cold sweat doesn't it? Sure, you can export them into Excel. It is fairly easy to compare and contrast two layer standards to identify the differences using built in sorting methods. But there's got to be a better way! I'm talking VBA automation here! Here is my version of a tool and a few of my built in macros to assist you in the task. Be sure to download the Excel File! ADT_ABS_LayerKeysCompare.xls

As you can see from the image above, it is fairly easy to cut and paste the layer keys into Excel, perform a little bit of formatting to make the appearance more palatable. I also added in the code to insert the "plot/no plot" symbol and to show an example of the actual color by inserting an aci index color as an image in each cell. Yes, that vba code is also present in the spreadsheet for your use.

Look closely at the toolbar and I'll tell you what the individual tools do.

The first button is the comparison tool. It will launch the VBA macro which displays a dialog box waiting for your input. It will display the available worksheets in two different listboxes. Simply select one worksheet from each list and then click the "Compare LayerKeys" button to run the comparison. You can see the results in the background. Any keys in the "Existing" layer key style (the left listbox) that are not found in the new layer key style (the one selected on the Right) will be identified by changing the excel cell background to red. You can see an example in the above image background.

The second button is the Clear Comparison tool, it will remove the red background from the current active worksheet.

The third button will "color by number" by looking at the number or name entered into the Color column and insert a matching image in the Display column.

The last tool is the "plot or no plot" button to insert the appropriate icon symbol representing whether that layer is plottable or not.

I hope this helps you.... But actually getting those new keys back into your Company standard is another herculean task entirely isn't it? Not anymore! You can use VBA to copy layerkeys out of one layer standard and add them into the other layer standard. It is really quite easy. Here are a couple of screen caps to show how simple it is.



Stay tuned for more when I show you how to actually insert the missing layer keys by copying them out of one Layerkey style and inserting them into your chosen target Layerkey Style. That is real automation and can save you hours of time! VBA and AutoCAD is a powerful tool!