Saved view is not restored in 64 bit Connect Edition

Hi all,

I am quite new to Microstation. We have some Macros running well on 32 bit Microstation version 08.11.09.089. When we change to use 64 bit MicroStation Connect version 10.12.00.40, there are some issues, some of which have been fixed by adding PtrSafe and changing Long type to LongPrt in declare statements. But I am not able figure out how to fix the following issue.

Before running the Macro, the view is like attached image 1 (before process). After running the Macro, it shrinks and zoom way out as shown in image 2 (after process). Please note the view is supposed to be the same before and after process as it works that way in 32 bit MicroStation. The view change happens when calling the following sub. Specifically, it happens after executing this line: vw.ApplySavedViewElement SV, msdCopyViewPortApplySize. When I debug this Macro on both 32 bit and 64 bit MicroStation, I notice some values for SV properties are different between this two version. Other variables have same values. I am not sure if it's related to the issue and have no idea how to fix. Any help is greatly appreciated.

Sub RestoreView(strName As String, viewNumber As Long)
Dim vw As view
Dim SV As SavedViewElement

Set SV = ActiveDesignFile.FindSavedView(strName) ' Not using optional arguments

If Not SV Is Nothing Then
Set vw = ActiveDesignFile.Views(viewNumber)
vw.ApplySavedViewElement SV, msdCopyViewPortApplySize
End If
End Sub

Parents
  • I created a SaveView named MySV in my DGN file and add vw.Redraw in your original code.  Then the code works well in my MSCE U11.

    Sub RestoreView(strName As String, viewNumber As Long)
        Dim vw As View
        Dim SV As SavedViewElement
        
        Set SV = ActiveDesignFile.FindSavedView(strName) ' Not using optional arguments
        
        If Not SV Is Nothing Then
            Set vw = ActiveDesignFile.Views(viewNumber)
            vw.ApplySavedViewElement SV, msdCopyViewPortApplySize
            vw.Redraw
        End If
    End Sub
    
    Sub Main()
       RestoreView "MySV", 1
    End Sub
    



  • Thanks for the reply. Were you able to see the same issue I have before adding vw.Redraw?  I added vw.Redraw to my code, but still has same issue. When I debug, I notice vw.Redraw doesn't get executed. After execution of vw.ApplySavedViewElement SV, msdCopyViewPortApplySize, it exits the sub, didn't go to the line vw.Redraw. I am wondering if this is related to SaveView function, but it's just my guess. Can you see any issue with the following code? 

    Function SaveView()
    Dim SV As SavedViewElement
    
        Set SV = ActiveDesignFile.FindSavedView("E3Temp")
        If Not SV Is Nothing Then
          SV.IsLocked = False
          ActiveModelReference.RemoveElement SV
        End If
    
        Set SV = CreateSavedViewElement(1, "E3Temp", "Temp view")
        ActiveModelReference.AddElement SV
    End Function

  • I can run your code smoothly in my MSCE-U13 without any issue. The result is as below:



  • Thanks. So back to original issue, what could be the possible cause to make the window shrink after running macro? since I have very little knowledge on MS and vba and no idea what cause that issue. Please note that the same code runs well without this issue in 32 bit MS. This only happens in 64 bit MS.

Reply Children
No Data