Is there a API call to compare active document and the document from Vault
Here is a function I use in my macros to check the file in the vault against the file in the local directory. "Directory" can be set as a constant or a variable. "pdmConn" would be the IConnection object. "fileName" is the filename of the document in question.
'verify if file already exists in local folder; set to false only if file in vault is newer than existing file in directory
Private Function getFile(fileName As String) As Boolean
'Author : Ken Puls (www.excelguru.ca)
'Macro Purpose: Check if a file or folder exists
If dir(directory & "\" & fileName, vbDirectory) <> vbNullString Then
If pdmConn.GetSpecificDocument(fileName).DateModified <= FileDateTime(directory & "\" & fileName) Then
getFile = False: Exit Function
getFile = True
Are you using ePDM or WorkgroupPDM?
Matt - Thank you for the code
I guess Date is the way to compare the files - What I am thinking is more about features since a file is checked out the Vault still have the same date; however, what if you make some changes on it and have not saved it yet
Date is not that reliable. Use the UpdateStamp property from the vault and compare it to the file. This is only an indicator that something of "substance" has change. I have never found a list of things that fall into or outside of this category but it does serve as a good indicator that the two files are not the same. I actually use a combination of the two just warn the user and let them decide what action should be taken.
Thank you, Bill
According to the API online help:
Gets the date on which this document was last updated.
The update stamp is an integer representing the time stamp. The update stamp in a SolidWorks document is incremented when:
•the state of the model changes (for example, you suppress or unsuppress a feature in a part or an assembly)
•the geometry changes (for example, any action that requires a rebuild)
This time stamp is not incremented for such operations as color changes, feature or configuration name changes, and so on.
I think it's good idea to use UpdateStamp on local document compared to the same one from the Vault with DateModified
And yet, I have seen the update stamp change by doing nothing more than putting the file in the vault. It also does NOT change if any properties such as part number/description are modified. But, as I stated before, it is darn good indicator. Date generally works (as a backup) except that SW likes to update all the components of an assembly even if they did not changes. This typically will not change their update stamp (but not alway) but it will change their file date/time.
Retrieving data ...