All
Is there a fast way ie VBA to rename all sheet models in a project to that of the File name. Where there are multiple sheet models they take on a 1, 2, 3 4 5
File A
1234_0001.dgn
Design model is called Design Model
Sheet model is called Sheet
File B
1234_0002.dgn
This means that in Sheet Indexing, ALL the sheets are called and displayed as Sheet
As you can see this makes the use of Sheet Indexing useless for historical dgn files, where the sheet name wasn't important
Another option is to change the view options within the Sheet Index dialog so we can choose which columns to display.
Ian
Hello,
your query has been moved to the MicroStation Programming forum.
Regards
Hi Ian,
Ian Lapper said:Is there a fast way ie VBA to rename all sheet models in a project to that of the File name.
Yes, it's possible to do it using VBA. Here is a code snippet to demonstrate how to do it. It's pretty simplified, so e.g. how to remove file extension from the name is done using not very robust way, but it should work in normal situations.
Option Explicit Public Sub RenameSheet() IterateOpenedDesignFile End Sub Private Sub IterateOpenedDesignFile() Dim model As ModelReference For Each model In ActiveDesignFile.Models If model.Type = msdModelTypeSheet Then ProcessSheetModel model End If Next End Sub Private Sub ProcessSheetModel(sheetModel As ModelReference) Dim fileName As String fileName = GetFileNameWithoutExtension sheetModel.name = sheetModel.name & " (" & fileName & ")" End Sub Private Function GetFileNameWithoutExtension() As String Dim fileNameWithExt As String fileNameWithExt = ActiveDesignFile.name If InStr(fileNameWithExt, ".") > 0 Then GetFileNameWithoutExtension = Left(fileNameWithExt, InStr(fileNameWithExt, ".") - 1) End If End Function
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point