Hello, is it possible to apply view attributes to multiple models in a file with a single tool / key-in or command? Our programmer has a VBA macro that creates multiple sheet models in a file (anywhere from 5-200) but a few of the view attributes need to be adjusted after those models have been created. I've looked in the help file & searched the forum but I don't see anything about this.
The logical move would be to correctly set the view display settings in the VBA before creating the models.
Alternatively you can import a Saved View and apply the settings and then delete the Saved View.
Barry, can you apply a saved view to a group of models instead of having to get into the models individually?
I presume the scenario you infer is how to change the view attributes of a DGN file with multiple Sheet Models, that has already been created?
Barry, yes. Our programmer is looking into changing the VBA code for the future, but this is for DGN files that have already been created. Apparently Bentley changed the process when creating models with a macro in connect as compared to V8i. Our V8i macro copies the default model in the file (which has all of the view attributes properly set & settings saved) to make the new models. Connect doesn't honor those settings when copying the default model to create the new models, hence the reason for the need to change view attributes in multiple models.
KKnepper said:Connect doesn't honor those settings when copying the default model to create the new models
If I said I was surprised to hear that, I would be lying.
The answer to the question is yes you can do that and here is how I suggest you do it using VBA.
The Macro I wrote will loop through all Models in the DGN file; it will ignore Design and Drawing Models and only operate on Sheet Models. When the View Attributes have finished being applied to all sheet models, the Saved View is removed from the DGN file.
In the test case below, I started with a single DGN file, changed the model from Design to sheet. I created a mix of elements which would be effected by the change of View Attributes, its quite self explanatory. I then duplicated the model 2 times. The only difference between the models content is the Text String at the top is changed to reflect the model name. With 1 test file created, I duplicated it and again changed the same text string to reflect the different file name. These 2 test files should be sufficient to prove that multiple files containing multiple sheet models can have the same View Attribute settings applied view a single Saved View. The Saved View I created turns off all of the following view attribute types:
As you can see, it works fine however the only thing I was unable to achieve programmatically was accessing the Saved View from the DGNLIB in the same way I would with a Text or Dimension Style in a DGNLIB, so I had to instead specify the full path to the DGNLIB containing the Saved View Template. However, the macro was written quickly and seems to do just fine what I set out to achieve.
You should be able to do this with a batch process. Create a text file with the required key-ins to set the attributes
VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Transparency True
VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Transparency False
VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 LevelOverrides True
VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 LevelOverrides False
Open Batch Process and set the path to the text file. Load all of the .dgn files and make sure Process All Models is selected.
Microstation CONNECT 10.17.00.209
ORD CONNECT 2021 R1 10.10.1.3
Microstation v8i SS 10 08.11.09.919
Power InRoads v8i 08.11.09.615
Mwlong, thanks for the input. It's been a while since I've used script files.
It's been a while for me as well. It took a while to think about how to accomplish the task as I was stuck thinking you would need to use a macro to process the models. I forgot about the Batch Process utility. It can be a life saver at times.