AnsweredAssumed Answered

PDM API - first pdm macro - clear cache command not working yet

Question asked by Robert Voogt on Sep 3, 2018
Latest reply on Sep 4, 2018 by Robert Voogt

HI all,


I'm working on writing a macro to do the following:


Get latest version of Folder A (in pdm)

Process certain macro on folder A

Empty local cache

Get lateste version of Folder B, etc.

Until it reaches the last given folder.


(I have to empty the local cache every time between the folders because they are so large.)


So I start with this:


Dim swApp As Object
Sub main()

Dim vault As EdmVault5

Set vault = New EdmVault5

' Change "My Vault" to your vault name

vault.LoginAuto "Foodmate", 0

' Change the number 2 in the following line to match the number of folders

Dim folders(1) As EdmSelItem

' The folders array index starts with 0.

' mlDocId = 0 tells EPDM you want all the files in the folder

folders(0).mlDocID = 0

folders(0).mlProjID = vault.GetFolderFromPath("C:\PDMWorks View\Foodmate\Sub samenstellingen\SA00000000-SA00009999").ID

Dim bg As IEdmBatchGet

Set bg = vault.CreateUtility(EdmUtil_BatchGet)

bg.AddSelection vault, folders()

bg.CreateTree 0, EdmGetCmdFlags.Egcf_SkipExisting

bg.GetFiles 0, Nothing

End Sub


I run it in Solidworks, I have referenced PDMWorks Enterprise 2015 Type Library.


It indeed sets all files local, it just takes a while. I hope that running a macro after this only starts when all files are truly local. Is there a way to have the macro wait until the complete folder is local?