I have a macro to print drawing. I want automatically 'GET' the drawing in my EPDM.
Anyone has any suggestion?
Here is some basic code you can start with. This will get a local copy of a file and its references. Be very careful using this. For one, I don't advocate hard-coding a password in the macro. Second, this does not check whether you have the file checked out, doesn't check whether the version you're getting is newer than the version you have, etc. If this is used wrong you could screw things up.
Sub GetLocal(strFilePath As String)
Dim vault As EdmVault5
Dim edmFile As IEdmFile5
Dim edmFolder As IEdmFolder5
Const username As String = "<your user name>"
Const password As String = "<your password>"
Const vaultname As String = "<your vault name>"
If strFilePath = "" Then Exit Sub
Set vault = New EdmVault5
vault.Login username, password, vaultname
Set edmFile = vault.GetFileFromPath(strFilePath, edmFolder) 'get file object
If edmFile Is Nothing Then Exit Sub
edmFile.GetFileCopy 0, 0, edmFolder.ID, 0 'get local copy
'Get all referenced files (e.g. assembly components, parents of mirrored parts)
Dim batchGet As IEdmBatchGet
Set batchGet = vault.CreateUtility(EdmUtil_BatchGet)
Dim selList(0) As EdmSelItem
selList(0).mlDocID = edmFile.ID
selList(0).mlProjID = edmFolder.ID
batchGet.AddSelection vault, selList
batchGet.CreateTree 0, EdmGetCmdFlags.Egcf_Nothing
batchGet.GetFiles 0, Nothing
there is an option in the EPDM option Dialog
as I use the german version, I don´t know the correct Translation but it should be
"prompt for check out file, if it is read-only"
Retrieving data ...