VBA PDM TASK and PDM Document ID

Programming and macros
User avatar
mp3-250
Posts: 540
Joined: Tue Sep 28, 2021 4:09 am
Answers: 18
Location: Japan
x 601
x 282

VBA PDM TASK and PDM Document ID

Unread post 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?
User avatar
SPerman
Posts: 1854
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 13
x 2030
x 1693
Contact:

Re: VBA PDM TASK and PDM Document ID

Unread post 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..
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
AlexB
Posts: 445
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 24
x 243
x 392

Re: VBA PDM TASK and PDM Document ID

Unread post 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
User avatar
bnemec
Posts: 1859
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2456
x 1333

Re: VBA PDM TASK and PDM Document ID

Unread post 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?
User avatar
mp3-250
Posts: 540
Joined: Tue Sep 28, 2021 4:09 am
Answers: 18
Location: Japan
x 601
x 282

Re: VBA PDM TASK and PDM Document ID

Unread post 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...
User avatar
mp3-250
Posts: 540
Joined: Tue Sep 28, 2021 4:09 am
Answers: 18
Location: Japan
x 601
x 282

Re: VBA PDM TASK and PDM Document ID

Unread post 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.
Post Reply