Hello all,
I currently have a program using the API which runs in the background to get every file and cache them locally from the PDM. This program inserts every file record into a database so a different program can use that db to do our necessary work. This scanning program is just suppose to see when a new file is on the PDM and make sure they are cached locally so we can retrieve them as necessary. The program runs and it is currently taking 6 hours! Which is a ridiculously long amount of time. Does anyone know of a way to do this and make it much faster? The part of the program that takes 3/4ths of the time is the caching files from PDM. I have tried multiple different flags (EdmGetCmdFlags). This has seemed to be the best 1 that works and caches the files to the server.
Egcf_IncludeAutoCacheFiles 2048 = Selects the Check Out dialog box Get checkbox for the latest version if the referenced file is not in the local cache
Here is my caching file method
filePathsNcount = new Tuple, int>(PDMfilePaths, PDMfileCount);
UpdateLocalCache(edmVault5, filePathsNcount);
private void UpdateLocalCache(EdmVault5 vault5, Tuple, int> filePaths)
{
try
{
if (filePaths != null)
{
IEdmBatchGet pdmBatchGetUtil;
pdmBatchGetUtil = (IEdmBatchGet)vault5.CreateUtility(EdmUtility.EdmUtil_BatchGet);
EdmSelItem[] pdmSelItems;
pdmSelItems = new EdmSelItem[filePaths.Item2];
for (int i = 0; i <= filePaths.Item2 - 2; i++)
{
string filePath = filePaths.Item1[i];
IEdmFile5 pdmFile;
IEdmFolder5 pdmFolder;
pdmFile = vault5.GetFileFromPath(filePath, out pdmFolder);
pdmSelItems[i].mlDocID = pdmFile.ID;
pdmSelItems[i].mlProjID = pdmFolder.ID;
}
pdmBatchGetUtil.AddSelection(vault5, ref pdmSelItems);
pdmBatchGetUtil.CreateTree(0, 2048);
pdmBatchGetUtil.GetFiles(0);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
SolidworksApi/macros