Apply the same view attribute to multiple models (Connect U16)

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. 

Thanks,

Kevin

Parents
  • Hi Kevin

    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?

  • Kevin,

    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.

  • 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.

    1. Create a new DGN or DGNLIB file (if DGNLIB, create it in a folder that assigned to MS_DGNLIBLIST (though ultimately not important as I will explain later)
    2. Open the new file and set the view attribute settings that you want to have applied to the sheet models, and then create a Saved View using Method:From View. This will be our Saved View Template.
    3. Load the Batch Processor and add however many DGN files you wish to update.
    4. Load the Command Script
    5. Select all the DGN files and change the Initial Model to Default Model Only and press apply to selection.
    6. Press Process Batch Process Job.

    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: 

    • ACS Triad
    • Custom Line Styles
    • Line Weights
    • Text
    • Hatch/Patterns
    • Dimensions
    • Fill 

    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

    Examples:

    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.2.61

    ORD - 2021 R1 10.10.1.3

    ORD 2022 R1.1 - 10.11.3.2

    ORD 2022 R3 -  10.12.2.4

    Microstation v8i SS 10 - 08.11.09.919

    Power InRoads v8i - 08.11.09.615

    ProjectWise - 10.0.3.453

Reply
  • You should be able to do this with a batch process. Create a text file with the required key-ins to set the attributes

    Examples:

    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.2.61

    ORD - 2021 R1 10.10.1.3

    ORD 2022 R1.1 - 10.11.3.2

    ORD 2022 R3 -  10.12.2.4

    Microstation v8i SS 10 - 08.11.09.919

    Power InRoads v8i - 08.11.09.615

    ProjectWise - 10.0.3.453

Children