Reply
Solved! Go to solution

Check if DrawingView IsUpToDate

Hello everybody,

 

i try to check if the drawing views of a draft are up to date. Here is my code:

 

    Private Function UpToDate(filename As String) As Boolean

        UpToDate = True
        Dim draft As SolidEdgeDraft.DraftDocument

        draft = DirectCast(System.Runtime.InteropServices.Marshal.BindToMoniker(filename), SolidEdgeDraft.DraftDocument)

        'draft = objApp.Documents.Open(filename)

        'Is the draft uptodate?
        For Each objSheet As SolidEdgeDraft.Sheet In draft.Sections.WorkingSection.Sheets
            For Each objDrawingview As SolidEdgeDraft.DrawingView In objSheet.DrawingViews
                If Not objDrawingview.IsUpToDate Then
                    UpToDate = False
                    Exit For
                End If
            Next objDrawingview
            If Not UpToDate Then Exit For
        Next objSheet

        'draft.Close()

        draft = Nothing

        Return UpToDate

    End Function

The function always returns true, even if the drawing is not up to date.

If i really open the draft (uncomment the two lines and comment the "BindToMoniker" line) everything works fine, but needs a lot of time.

 

Any suggestions?

 

Greetings from Germany

Christian

Greetings from Germany
Christian Kunkel
https://c-k-m.info
3 REPLIES
Solution
Solution
Accepted by topic author ckunkel72
‎08-26-2015 04:32 AM

Re: Check if DrawingView IsUpToDate

I just wrote a test case and confirmed what you're seeing. Sure seems like a bug and really unfortunate if it is. I'd really like to hear why we're seeing it work differently in this case. Next logical step is to submit an IR with GTAC.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Check if DrawingView IsUpToDate

I have found the solution!

If i add

draft.Activate()

after the DirectCast(...

it works fine.

 

Greetings from Germany

Christian

Greetings from Germany
Christian Kunkel
https://c-k-m.info

Re: Check if DrawingView IsUpToDate

Interesting. I suppose when the UI is visible, Activate() is invoked automatically...? We can only speculate. Glad you figured out a workaround. Good detective work!

Jason Newell
Applications Architect
www.jasonnewell.net