Use VBA to Add Qty Req'd to Custom Properties for Components from the ****'y?

Use VBA to Add Qty Req'd to Custom Properties for Components from the ****'y?

tdswanson
Collaborator Collaborator
3,717 Views
24 Replies
Message 1 of 25

Use VBA to Add Qty Req'd to Custom Properties for Components from the ****'y?

tdswanson
Collaborator
Collaborator

Hello:

 

I'd like to create a macro that I can run from within an assembly that will loop through each BOM item and add the quantity req'd to a custom property within the component.  I'm very familiar with VBA from Office, but I'm new to it with respect to Inventor so I'm pretty fuzzy with object titles and options.  Can someone assist with the coding?

 

Here's an outline of what I'd like to do:

 

Execute Macro from within Assembly file

 

For Each BOM Item to # of BOM Items

 

  If Vendor = "Make" then

    Set Component Custom Property "Qty_Reqd" = Total Qty from BOM

  Endif

 

Next BOM Item

 


Can someone help and/or Is there an easier way?

 

Thanks!!

0 Likes
Accepted solutions (2)
3,718 Views
24 Replies
Replies (24)
Message 21 of 25

MegaJerk
Collaborator
Collaborator

Do you mean -  have it go through the component parts of the top level assembly without going through any of the sub-assemblies or their component parts? 




If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 22 of 25

Nsteel
Contributor
Contributor

moreso that if the top level assembly contains multiple instances of sub-assemblies "A" & "B" and parts "C" & "D"

it would only count these and not the items within "A" & "B".

 

Thanks.

 

0 Likes
Message 23 of 25

GosponZ
Collaborator
Collaborator
Message 24 of 25

Nsteel
Contributor
Contributor

Just what I was looking for.

Thanks a lot!!!

 

0 Likes
Message 25 of 25

GosponZ
Collaborator
Collaborator

I'm glad this share help. Smiley Wink

0 Likes