Ok Ladies and Gents (others welcome as well) .. my first question of 2008 will be something I have pondered for a while and hopefully with the great minds here we can devise a solution ...
I have a whole library of autocad blocks that I must import into cell libraries. Now let me explain the problems I have faced before I am given specifics on how to create the darn things ... already had a ton of trial and error and found the following to be true ...
We need the cells aka blocks to be unshared (a concept foreign in AutoCAD) thus for assemblies where there are nested cells, I must open each cell independently, drop all shared cells to normal cells and save the file. Not too dificult for a dozen or so cells with a few nested cells, however, we are talking about hundreds of cells with some of them having nearly 50 shared cells ... this would be a daunting task for anyone .. monumental even.
Next issue ... AutoCAD blocks are inserted using insbase as the origin of the block, when placing a cell in microstation, insbase is also observed if the cell was imported from a dwg, however, future editing of the drawing when attempting to programmatically alter the cell, microstation ignores insbase and substitutes 0,0,0 as the origin, thus when attempting to manipulate cells, the result is often unpredictable.
Finally, the importing of dwg or dgn files directly into a cell library causes some other issues, namely, the specific model must be selected manually, the cell type may need to be modified and descriptions may need to be added.
This brings me to the point I am at today ...
I have created a VBA macro that opens all of the autocad drawings in a specific folder, moves all geometry in the drawing in modelspace from the current insbase to 0,0,0 and resets insbase to 0,0,0, zoom extents, then wblocks the drawing to purge layers, unreferenced blocks, linetypes, textstyles, etc. This works exactly as planned without hitch .. remember I am an AutoCAD guy, not a Microstation guy .. but I am muddling through ...
Now, on the microstation side I have created a VBA macro that opens all the DWG files in a specific folder, saves them as a DGN, sets "Model" as the active model, deletes all other models (i.e. Layout1 etc), drops all shared cells to geometry and recreate them as normal cells while deleting the shared cells, changes the name of the default model "Model" to the drawing name, changes the description of the model to the drawing name, saves the dgn and repeats until all dwg files are created as dgn files. Unfortunately this seems to be the only method by which I can delete the extra layouts as you can't delete them in DWG files .. at least I havn't been able to.
The final piece of this puzzle is what is eluding me ... I need to import all of the models in the dgn files with the same name as the dgn file to a cell library (I know a cell library is simply a design file with multiple models) ...
Doing this manually is as simple as opening the models window, selecting the "import model" button, select the dgn, select the model, and click ok ... imagine doing this thousands of times over ... I can easily see myself missing a file or worse, importing a model twice with different names ... I don't want that to happen ...
So, I need help ... help in figuring out a method by which I can automate the automatic importing of the default model into the current design file.
I tried to record a macro of the process needed to import them, but the method would still require the manual selection of buttons ...
VBA seems to be the best at handing this, but if someone has a MDL app that will do it or is close, that would be ok too.