Page 1 of 1

VBA PDM TASK and PDM Document ID

Posted: Mon Apr 29, 2024 9:59 pm
by mp3-250
Since I had enought of SOLIDWORKS PDM File Version Upgrade Tool being broken, I am writing my own PDM TASK ror my purpose,

I will lauch a task that:
・open a part file (ignores SLDASM)
・cache locally the latest version
・checkout the file
・set the document properties (image quality etc)
・cycle through configurations and force rebuild them
・save
・checkin overwriting the latest version and deleting the locally cached version


I am looking for a way to backup locally (i.e. outside the vault) the file before checking it out.

The original SOLIDWORKS PDM File Version Upgrade Tool will save a .bak file into the archive server folder (0~F) with the HEX value of document ID as a filename. For the moment I do not want to write the archive server disk, but I would like to create a folder named as the PDM DocumentID on the TASK machine desktop and save the backup file inside it.

Is there a way to get the DocumentID from a VBA PDM TASK script?

Re: VBA PDM TASK and PDM Document ID

Posted: Tue Apr 30, 2024 7:19 am
by SPerman
I find several references to DocumentID in something called the PDM Pro API Web Service. Here is one link, but there are many.

https://help.solidworks.com/2022/englis ... Ni4wLjAuMA..

Re: VBA PDM TASK and PDM Document ID

Posted: Tue Apr 30, 2024 8:30 am
by AlexB
The ID within the sql server is the same as the IEdmFile5.ID property. Convert this value to hex and you have your folder name.
image.png

Re: VBA PDM TASK and PDM Document ID

Posted: Tue Apr 30, 2024 9:53 am
by bnemec
If the data set has any assemblies with virtual components would those sldasm files need to be opened to get the virtual part files updated?

Re: VBA PDM TASK and PDM Document ID

Posted: Tue Apr 30, 2024 11:31 am
by mp3-250
AlexB wrote: Tue Apr 30, 2024 8:30 am The ID within the sql server is the same as the IEdmFile5.ID property. Convert this value to hex and you have your folder name.
image.png
Thank you! IEdmFile5.ID property is what I was looking for to get the file ID.

https://help.solidworks.com/2023/englis ... mbers.html

I have already used the Document ID outside the macro world to recover some cold storage file.
After DEC ->HEX conversion the last digit of the HEX ID is the archive server folder name in which the file resides.

Now I have to figure out how to backup and rename that file outside the vault, so I could checkout and edit the one inside the vault overwriting the latest version like the FVUT. And properly log every operation. =)

I still do not understand why I have to fix by myself what it was supposed to be a working PDM tool...

Re: VBA PDM TASK and PDM Document ID

Posted: Tue Apr 30, 2024 11:34 am
by mp3-250
bnemec wrote: Tue Apr 30, 2024 9:53 am If the data set has any assemblies with virtual components would those sldasm files need to be opened to get the virtual part files updated?
A virtual part is saved inside the SLDASM data, and it is temporary cached inside the user temp folder when opened in solidworks. To update its properties its assembly must be opened otherwise that part is not accessible.