Editing Config Specific Props from BOM question

Programming and macros
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Editing Config Specific Props from BOM question

Unread post by loeb »

I'm writing a macro that will iterate through a BOM and will edit configuration specific properties of parts/assemblies in the BOM. To be clear, I want to edit the part/assembly files themselves. This is a big step beyond anything I have written before and have a question.

I know how to traverse the bom and identify the components in each row using "swBOMTableAnn.GetComponents2". I think I then need to use "OpenDoc7" on each component so that I can then use "swCustPropMgr.Add3" to edit their configuration specific custom properties. Am I taking the correct approach?

Thank You
User avatar
AlexB
Posts: 498
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 28
x 266
x 444

Re: Editing Config Specific Props from BOM question

Unread post by AlexB »

If you're in an assembly, then you don't necessarily have to call OpenDoc#. You can likely just get the ModelDoc2 from each Component2 interface and manage the custom properties without having to open/activate each child document.

If you manage to get some code together, I'm sure others in addition to myself would be happy to take a look to help you over some road blocks or improve anything.
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Re: Editing Config Specific Props from BOM question

Unread post by loeb »

AlexB,

I'm opening the parts/assemblies as I'm going through a drawing BOM.

I managed to get my code working today, much like I described. Now, to move them to the vault and check them in and figure out how the PDM API...

Thank you for your offer of help. I might just take that you up on that.
User avatar
gupta9665
Posts: 407
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 427
x 447

Re: Editing Config Specific Props from BOM question

Unread post by gupta9665 »

loeb wrote: Tue Sep 10, 2024 6:16 pm AlexB,

I'm opening the parts/assemblies as I'm going through a drawing BOM.

I managed to get my code working today, much like I described. Now, to move them to the vault and check them in and figure out how the PDM API...

Thank you for your offer of help. I might just take that you up on that.
Please note that PDM API is not supported in Standard version. So you will need PDM professional in order to use the APIs.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
Post Reply