Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count how many parts in assembly that are the same part.

Status
Not open for further replies.

bguenther

Mechanical
Nov 3, 2008
37
Hi,
Sorry for making so many posts, but I have one more spot where I am stuck. I need the qty of each part in the active assembly. Currently I am looping through all the parts so there is probably just some code that i could put in the loop that would count how many parts of each there is. Any body done this before or got any ideas.Thanks.
 
Replies continue below

Recommended for you

There's no way I know of to directly get the component count through the API. You will have to somehow count 'em up as you loop through the tree. One way to do this would be to use the Excel list you are making. I assume you are wanting to put the quantity in there anyway in some other column. Basically, before adding any part to the Excel list, loop thru the Excel list and see if the part number already exists in the list. If it does, increment its qty column instead of adding it to the end of the list.

-handleman, CSWP (The new, easy test)
 
Hmmm.. Dummy of BOM that is interesting had not thought of that, I'll see if I can pull that off. If not then I might just go with checking to see if it already exists in the excel sheet like handleman suggested. Thanks
 
bguenther,

Which version of SW are you using?

SW2009 has a built in "BOM from assy model" function.

[cheers]
 
CorBlimeyLimey,
I am using SW2008 SP4.0. So you just make a drawing add a BOM and read the QTY column and then I would use that to put in my excel sheet ?
 
Yes, for SW08 ... or you could use the macro TheTick suggested, to create the BOM directly from the model. No drawing required.

SW09, has that same function built in.

[cheers]
 
I have used the custom filter at the top of the feature tree in an assembly to see all of the instances in an assembly. It's more of a quick and dirty way instead of creating a BOM.
 
I'd recomend using the macro TheTick suggested. It gets the component count (and other properties) and will export it to a spreadsheet. You should be able to extract some code from it.

Joe
SW Office 2008 SP4.0
P4 3.0Ghz 3GB
ATI FireGL X1
 
I guess I am pretty dumb because that macro is very confusing to me, I can't figure out what code is all needed to do that job.
 
The Advanced Select Functionality might be able to do this. You can set filter criteria like Volume = Value or Component name contains "WORD" and then use that to select the components and get a count of the objects selected.

In 2008 you also might try the Assembly Xpert which can count the number of components that are unique parts or configurations.

Michael
 
Just so everyone is on the same page, this thread is really sort of a continuation of thread770-230036.

-handleman, CSWP (The new, easy test)
 
I guess it is sort of , sorry I did not intend on this being a repost.
 
I certainly didn't mean that it was a repost, because it is a slightly different question and this is really the best place for it. However, people were giving answers that either had already been given or were not necessarily in the direction you were looking to go, based on information in the other thread.

-handleman, CSWP (The new, easy test)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor