How to batch change the state of Assemblies/parts in SW19 PDM

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
Jacomuller
Posts: 51
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 36
x 5

How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by Jacomuller »

We have hundreds of parts and assemblies in a certain workflow state. I am the PDM administrator and I want to change the workflow state of all those parts with a VBA macro. I did some google searches but couldn't find any sample code. Si there anybody with some ideas how to do this? Most of the parts are in workflow state PD2. I need to skip PD3 and PD4 and move them on, without any approvals to PD5. Any Ideas :roll:
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by jcapriotti »

You don't need a macro (there is no VBA option for PDM). You need a transition from the current state (P2) to the other state (P5). Then you just create a search that finds the parts you want to transition, right click them all and change state on them using that new transition.

That said, without knowing your workflow process and your PDM skillset, this is something you have to be careful with depending on transition actions that occur in the in between states. Things like Incrementing revisions and variable updates. You may need to duplicate some of them.
Jason
Jacomuller
Posts: 51
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 36
x 5

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by Jacomuller »

Thanks @jcapriotti , lazy me :) . I was hoping for a bit of code to transition a list of part through 5 states with the click of a button. No worries, I will do it the hard way then. grumph
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by jcapriotti »

Well, you could modify all of the transitions to temporarily make them "Automatic". I've never tried that many but it should go through them all to end up in the final state.
Jason
User avatar
mp3-250
Posts: 654
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 735
x 357

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by mp3-250 »

@jcapriotti just wanted to say that VBA can be used with PDM, I have made a custom task in VBA that replace the bugged version up tool of PDM: I can login into our vault, get latest, checkin, checkout and the only issue is (for a non IT person like me) the lack of documentation (to use an euphemism) and almost no examples around the web.
User avatar
SPerman
Posts: 2080
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 14
x 2256
x 1902
Contact:

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by SPerman »

There is no VBA option for PDM standard. Maybe that is what he meant.
-
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
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by jcapriotti »

mp3-250 wrote: Mon Dec 09, 2024 5:17 pm @jcapriotti just wanted to say that VBA can be used with PDM, I have made a custom task in VBA that replace the bugged version up tool of PDM: I can login into our vault, get latest, checkin, checkout and the only issue is (for a non IT person like me) the lack of documentation (to use an euphemism) and almost no examples around the web.
His comment was VBA Macro which to me means old Visual Basic for applications code running in something like Word or Excel. I'm not aware if you can access PDM using that method. You can write vb.net or c# apps compiled as an exe and access your vault or call the EXE from a transition using the Transition Action "Execute Command". We do this with a number of programs.

I was under the impression that Jacomuller simply need to bypass some of the workflow states as a administrator. This is simple to do as a bypass transition that only the administrator has access to see.
Jason
Jacomuller
Posts: 51
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 36
x 5

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by Jacomuller »

@jcapriotti @SPerman , I have done a number of VBA macro's for Solidworks. For example, I have a macro that will with a click of the button, create a PDF file as well as a DXF file of a drawing. It will then save those files in the PDM, delete copies of old versions on the those files on the factory server, outside of the PDM and replace it with the new versions of those files. I also have a macro that will create shop floor papers for production with all sheet metal parts in an assembly. So, I have done a bit of work in Solidworks with VBA, normally I use VBA in ACCESS and EXCEL, but I am no expert in the Solidworks/PDM API :)
User avatar
SPerman
Posts: 2080
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 14
x 2256
x 1902
Contact:

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by SPerman »

To be clear, there is no API support for PDM standard. That has nothing to do with API for solidworks.
image.png
Solidworks PDM Professional has a full API library available.
SOLIDWORKS PDM Professional API Help

And to clarify an earlier statement; I use the terms VBA and VB6 interchangeably. AFAIK, they are the same language, although it is likely there are minor differences between the two, especially considering VBA is still supported and VB6 has been dead for 15 years. The built in solidworks API editor is VB6. I have no idea about PDM API, as I only have a standard license.
-
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
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by jcapriotti »

Jacomuller wrote: Tue Dec 10, 2024 3:28 pm @jcapriotti @SPerman , I have done a number of VBA macro's for Solidworks. For example, I have a macro that will with a click of the button, create a PDF file as well as a DXF file of a drawing. It will then save those files in the PDM, delete copies of old versions on the those files on the factory server, outside of the PDM and replace it with the new versions of those files. I also have a macro that will create shop floor papers for production with all sheet metal parts in an assembly. So, I have done a bit of work in Solidworks with VBA, normally I use VBA in ACCESS and EXCEL, but I am no expert in the Solidworks/PDM API :)
That's what I was suspecting. You're talking about the built-in VBA inside of SolidWorks or like you find in Word/Excel. Those are based on the old VB6 language. There is vb.net for which you need a copy of Visual studio to build code and compile standalone EXE/DLL programs files. PDM doesn't have a VBA environment like those apps. I didn't think it was possible but you might be able to use the VBA in SolidWorks to perform PDM commands, at least this video indicates you can although not sure what the limits are.



If this is a function you need to perform frequently from within SolidWorks, it may be worth it. A PDM Add-in would likely be better and more stable. If this is a one off activity, the workflow bypass is a better solution. At least with the add-in or bypass, you don't have to open SolidWorks or the model, you don't even need SolidWorks installed so non-cad users could do it.
Jason
Jacomuller
Posts: 51
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 36
x 5

Re: How to batch change the state of Assemblies/parts in SW19 PDM

Unread post by Jacomuller »

Thanks for the feedback - I have been programming in VB6 for many years - I am very old school. :)

I will put this one in the "too hard basket" for now. I am a Mechanical engineer doing some programming for fun. Thanks again for your time.
Post Reply