I am trying to use VBA to rename the Default model within a series of existing dgn files, however I can find no way to isolate it.
The only obvious difference between the Default model and the other models is that the Default model cannot be deleted.
I could find the Default model in a file by deleting each model in turn to see if it throws an error, then undo the deletion if it doesn't.
The one that throws the error is the default, but that's a pretty crude way to do it.
Because the Models Dialog box tool bar grays out the Delete command when the Default model is selected, there is obviously some way to isolate it.
Can someone please advise how to do it cleanly.
Hi Bob,
please read and follow the forum best practices.
I am always surprised again and again how many people think everybody else will be happy to write an answer or to provide a solution without knowing at least product and version used and code that does not work. To be software developer requires to be precise and handle details, because many information, bugs and their solutions and workarounds depends on the version used.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Searching MicroStation VBA help file for "default model" phrase leads quickly to Changing an Attachment to Reference the Default Model code snippet example. Based on the code it seems this should work:
Dim defaultModel As ModelReference Set defaultModel = ActiveDesignFile.DefaultModelReference