Test to see if document has changed

Test to see if document has changed

CAD-e-Shack
Enthusiast Enthusiast
828 Views
5 Replies
Message 1 of 6

Test to see if document has changed

CAD-e-Shack
Enthusiast
Enthusiast

Is there a test I can do to a drawing to see if it has been modified since opening?

 

The code I've written needs to be able to differentiate so as to minimize user input. I can make it work one way or the other,but I need some sort of marker that I can insert into an if statement to determine whether to simulate user input for changes made, or exit with no changes.

0 Likes
Accepted solutions (1)
829 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Try adding ModelGeometryVersion to an attribute and compare the ModelGeometryVersion for changes.

0 Likes
Message 3 of 6

CAD-e-Shack
Enthusiast
Enthusiast

I may need to be treated like a vba rookie here.

 

I was hoping to find something like what Excel has where I can test if "Activeworkbook.saved = true" which means there have been no changes since the last save.

 

I tried setting up attributes, but I really have little undestading what they reference to and how they work.

0 Likes
Message 4 of 6

Anonymous
Not applicable
Accepted solution

ModelGeometryVersion can used to track the changes made to the referenced part of the drawing. If you want to check the drawing only  try the below code.

Public Sub Drawing_Change()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
   
    If oDoc.Dirty = True Then
        MsgBox ("Changes Have been made")
    Else
        MsgBox ("No changes made")
    End If
End Sub

 this will show if any changes made after the last save.

0 Likes
Message 5 of 6

CAD-e-Shack
Enthusiast
Enthusiast

OK, I see how it works. I was looking to compare it to the checked-out file. If there were no changes since check-out then a save & check-in would be required.

 

As is, if there have been saved changes since check-out the system reads the file as not having changed at all.

0 Likes
Message 6 of 6

Anonymous
Not applicable

How to check wheher the drawing Drawing document has been modified or not? 

ModelGeometryVersion is not the part of drawing document.

0 Likes