Hi forum,
I have a somewhat overwhelming task infront of me, and was hoping for some help from the forum.
What i have is a set of files that originally came from PDMS. They came in a package of approximately 1000 dgnv7 files. Unfortunately the files do not have any level/ color structure.
I did batch convert the v7dgn files to v8d dgn. After converting the files to v8 the scale is wrong, so I need to fix that. (1meter slab in the V7 file, became 1000meters when converted to V8). At the same time I would like to do a few other things pr file, so I guess this is a good time to try to learn about batch processing and key-in script files. I have never used these tools before, so I am hoping somebody are able to help me out.
The files are basically a large ship that has been split in to 10 sections. Each section consist of around 100 dgn files that again are split on 10 different disciplines. (The file structure looks something like this: Section1-arch1.dgn, Section1-elec1.dgn, Section2-arch10 etc. The level in use has the brilliant name”Level1” for all of the 1000 dgn files…). So If there is a clever/ not to time-consuming way to do this I would like to take all the files for each discipline, and as a minimum, give them a separate color. And maybe also rename the level (Level1) into the name of the discipline it comes from(arc1 etc.), or in to the name of the specific dgn file (Section1-arch1) .
What I am thinking is I will probably have to brake this down in 2 steps, but have no idea how to do it.
My thought was maybe to use batch process to do this on all 1000 dgn files:
Then I would probably have to split the files in to 10 folders, one pr. discipline. And if possible run a batch process pr. folder to remap colors, and rename “Level1” to something that makes more sense. Here is an example for the Arc discipline, pr. file:
Does anyone have a suggestion on how to do this using batch convert/process without involving programing? Any help would be much appreciated as at the moment I’m stuck already on nr 1-wrong scale… (Unless I fix it manually pr. file, using merge in to master on a blank file, and change the scale during the merge etc.)
-regards
helge
The CSV remapping will most likely do 90 % of you colour and level renaming and weights...
I assume even though everything is on level 1 that they at least used different colours for specific things which you could then remap as level names ie
if bolts are always red then you could choose to CSV remap red to new level FASTNERS and weight 1 and this can be done as a batch conversion process too
The reassigning a colour table - easist way is to record a macro and and do the steps by hand, then you can run the macro from the batch processor I would do that first as it will change your colours of existing elements
You can reassign the colour table with ATTACH COLORTABLE NEW TABLE NAME.TBL
IF the new colour table is not in the same path as the active or default ones in Microstation then you will need to have the full file path and name and its better to use " " incase they are spaces in the name...
To remove unused levels just use the compress option and set it to delete unused levels once manually then there after this can also be done in batch processor with keyin compress design
the save settings keyin is FILE DESIGN again add this to your batch process script..
The scale issue is a bit more complex can you upload an original untouched V7 file ie dont convert to v8...
I think it may be a positional units or just units issue, can you also post a copy of your current v8i see file for comparison..
Lorys
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
Unknown said: MbeSetAppVariable "DGNSET", "dgnSet.adv_uorPerStorage", 10000# but changes manually to the above section of the macro script to 10, 100 or 1000 didnt do anything to the actual stored value in the dgn
MbeSetAppVariable "DGNSET", "dgnSet.adv_uorPerStorage", 10000#
but changes manually to the above section of the macro script to 10, 100 or 1000 didnt do anything to the actual stored value in the dgn
Prefer MicroStation VBA to MicroStation BASIC! MicroStation BASIC paid few concessions to MicroStation V8. For example, it knows nothing about level names, so manipulating levels using BASIC is hard. I suspect that the non-functioning BASIC macro you recorded may be attempting to do something to a V7 TCB that doesn't exist in V8. Moral: prefer MicroStation VBA to BASIC!
Regards, Jon Summers LA Solutions
Unknown said: I suspect that the non-functioning BASIC macro you recorded may be attempting to do something to a V7 TCB that doesn't exist in V8. Moral: prefer MicroStation VBA to BASIC!
Your as usual completely right but often the basic macro is easier to just find a single line simple keyin ..
I still like the this approach (especially for Newbies)
1st go to help see if there is a keyin, there often is one listed for single tool options...
2nd try set item tool settings to find a keyin or variable keyin
3rd record a BASIC macro ( if its simple steps ie one tool )
{ Joh forgive this please , I cut my teeth on Texas instrument basic in the 80s and later commodore 64 basic but I'm not a programmer, just a drafter, but I can read basic pretty well but I'm still a rookie with vba, yes I know I need to practice it to get better}
4th extract keyin from macro and try it..
5th Record a VBA macro then test on new file, if it works as is then dont extract anything just use it , it will run in batch process too..
6th if you must have a keyin then try to decipher what the VBA macro is doing and extract out the part you need similar to what Otto did ...
Hi
I scaled all files using Ottos script in V8i, and that worket out just fine! I also tried using the same script in MS CONNECT U1. Maybe not a big supprise, but i did not work. Just out of curiosity and trying to learn, what is the reason for this. Is it the VBA part that has changed/ been rebuilt / renamed going from v8i to connect eddition? Here is a snapshot of what i got out of the messagesenter while trying the script in connect u1
Regards
Helge
Unknown said: Hi I scaled all files using Ottos script in V8i, and that worket out just fine! I also tried using the same script in MS CONNECT U1. Maybe not a big supprise, but i did not work. Just out of curiosity and trying to learn, what is the reason for this. Is it the VBA part that has changed/ been rebuilt / renamed going from v8i to connect eddition? Here is a snapshot of what i got out of the messagesenter while trying the script in connect u1 Regards H
H
IMHO dont use Connect unless you absolutely have to for a feature that is only found in CE, its still too early.. I'm afraid we will have to just stick with V8i ss3 and ss4 for production drawing, for a year or 2 longer until Bentley can sort out all the new issues that CE has created let alone address a lot of promised fixes for V8i that were to be addressed in V8i...
It seems there is no longer an in-line "vba execute" key-in for CONNECT edition. Also the syntax for vba key-ins in CE are different so vba key-ins should start with "macro vba" but there is no "macro vba execute" command. I modified the batch script so it works with CONNECT edition. There are now two files batch script and vba sister file so it is more complicated you have to copy mvba in VBA search directories(it is not enough that it is in same folder as batch script) and hope that it will get executed.
It would be easier if vba macros could be run as batch directly why we need command file if there is no longer UCM/MSBASIC available!?. For me the whole VBA concept for small macros seems broken all these projects, modules just to load one line of code.
#---------------------------------------------------------------------- # # Command file for batchprocess utility # # This command file was originally copied from $(MS_DATA)cmdfiletemplate.txt. # Command file information: # - Lines that start with the '#' character are treated as comments and ignored. # - Max Line length 256 #---------------------------------------------------------------------- #SET UORSPERSTORAGEUNIT <resolution> 'doesn't work #vba run [ScaleFiles]ScaleFileCode 1000 Meter Meter Millimeters raster detach all reference detach all level set display on file:all all set levels on all;selview all place fence active;point absolute lock fence overlap macro vba run [Scale10k]main #;set item toolsettings proportionaltoggle=1" point absolute vba execute ActiveModelReference.UORsPerStorageUnit = 10000 place fence active;point absolute change linestyle scale 1;set item toolsettings usefencetoggle=1;point absolute view off all;view on 1 fit view extended filedesign
Unknown said: The syntax for vba key-ins in CE are different so vba key-ins should start with "macro vba"
Incorrect! You can run a VBA macro in MicroStation CONNECT using the key-in: vba run [ProjectName]ModuleName.MethodName
That's the same as MicroStation V8.
MicroStation CONNECT provides a new macro recorder, referred to as a BMR macro. When you record a macro, the macro is saved as a .bmr file. You can replay a recorded macro using the key-in: MACRO Play macro name
.bmr
You can promote a BMR macro to a VBA project.
It seems these are only for backwards compatibility as it is no longer listed in key-in manager. Also "vba execute" command is not there.