Hi, i am working on about 1000 .dgn files in Microstation(v22.214.171.1249) and i have the task to find out how many of them have a coordinate system assigned and how many that don't. (those that don't have to be georeferenced later)
I was thinking of running something like the "GEOCOORDINATE DETAILS" command in batch on all the .dgn in a folder and then automaticlly saving the output. But i am not experienced enough to know how to do that.
Any help or ideas is greatly appreciated :)
I've attached a VBA Macro and a Batch Processor command script. If you place the macro in a folder which the variable MS_VBASEARCHDIRECTORIES is assigned to, and then add the following line to a CFG file or your own UCF file:
MS_VBAAUTOLOADPROJECTS > ScanForGCS
Then load up MicroStation, bring up the Batch Processor dialog box, load the attached command script, load the files you want to scan, select them all and then set Initial Model to Default Model Only. The script will automatically scan all models in a file regardless so this just prevents it scanning all models twice.
Then run the batch process job. The Macro will automatically create a text file on your desktop called GCS_Scan_Result.txt.
If a model in a DGN file is found to have a GCS attached it will write it like so:
Design File = C:\Users\Barry\Desktop\Has GCS.dgn | Model = 2D Metric Design | GCS Name = EPSG:4326
I tested the Macro on 2 files, 1 of which I added a GCS and the other file did not. The above line is what was in the text file.
Answer Verified By: Simon Laursen Reinert
Thank you alot for your quick and indepth reply :) I will take a closer look tomorrow.
Tried running it just quickly and it seems like each result overwrites the last in the GCS_Scan_Result.txt, as in it doesn't make a new line between each file being batch processed.
Yeah I noticed that when I tried adding more files for testing. It was due to the text file being opened ForWriting instead of ForAppending.
I did upload the Macro with that fixed so it should be ok if you download it again.
The contents of the GCS_Scan_Result.txt should be deleted (or just delete the file, if it exists) each time before you perform a scan.
This is a downside to using a Batch Processor instead of using VBA to select files and perform actions. If that were the case, then the text file could be blanked automatically but we can't do that with the BatchProcessor as it would simply lose the result of the previous file's scan.
Excellent Barry just tried it and it works even in V8i with datums only readable in CE ie MGA 2020 is not available to V8i it just doesnt see it and mstn v8i says no GCS but your VBA is so clever it reads what V8i cant and reported back that there were mga 2020 datums in several files and in others ( slackers) there we no datums and hence those files were not listed in the text file report even though those files were in the batch.. again thanks so much this will help proof checking of projects so much..
Started msnt work 1990 - Retired Nov 2022 ( oh boy am I old )
But was long time user V8iss10 (8.11.09.919) dabbler CE update 16 (10.16.00.80)
MicroStation user since 1990 Melbourne Australia.click link to PM me