Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Part Quantities

36 REPLIES 36
SOLVED
Reply
Message 1 of 37
SKinzel
2381 Views, 36 Replies

Part Quantities

Our individual part drawings reference the quantity of that part used in an assembly.  Is there any way to get the quantity number for a part from an assembly and insert it in the individual part drawing?  Currently I manually put this in but sometimes I forget to do this or I enter an incorrect number.

 

I haven't been able to find anyway to do this but any ideas on how to do this to keep my opportunites to make a mistake to a minimum?

Stuart Kinzel
Inventor 2013-64bit, HP EliteBook8740w Intel Core i5CPU 2.67 GHz
8GB memory
Windows 7 64bit
36 REPLIES 36
Message 2 of 37
cwhetten
in reply to: SKinzel

You could probably do this with iLogic.  I can look into the code required to do this, if you think an iLogic solution is acceptable.

 

-cwhetten

Message 3 of 37
cwhetten
in reply to: SKinzel

It wasn't too hard, so I did it anyway.  You will probably want to create a custom iProperty in the part to store the value of the assembly quantity.  For example, if your assembly number is 4100, then you could create a custom iProperty called "4100_QTY" (you'll want to name your custom iProperty with some kind of reference to the assembly into which it is placed, since this part may be in multiple assemblies in different quantities).  Then in your assembly, you would have an iLogic rule that has the following code:

 

iProperties.Value("ComponentName:1", "Custom", "4100_QTY") = ThisBOM.CalculateQuantity("Model Data", "ComponentName:1")

Of course, change the "ComponentName:1" value to whatever your part is named in your assembly browser.  You'll have to make sure this rule is run if you make any changes to your assembly, so that the quantity value stored in each part is always up-to-date.  You could use event triggers for this, or some other method, or just remember to manually run your rule before you update your drawings.

 

You will have a similar line of code for each component you wish to treat this way.

 

-cwhetten

Please click "Accept as Solution" if this response answers your question.

Message 4 of 37
SKinzel
in reply to: SKinzel

Thank you.  I'm just starting to learn about iLogic.  I'll try this out. 

 

As I understand it the rule is in the ASSEMBLY and will need to be triggered.  I am thinking that maybe the rule would be triggered on any SAVE of the assembly.  Then when I open the part drawing it should automatically update, correct?

Stuart Kinzel
Inventor 2013-64bit, HP EliteBook8740w Intel Core i5CPU 2.67 GHz
8GB memory
Windows 7 64bit
Message 5 of 37
cwhetten
in reply to: SKinzel

Yes, that would work.  You should set it to trigger BEFORE a save event, so that it saves the documents with the updated numbers.

 

Event Trigger - Before Save.PNG

 

-cwhetten

Please click "Accept as Solution" if this response answers your question.

Message 6 of 37
rhasell
in reply to: cwhetten

Hi

 

I just tested the iLogoc code, pretty cool, It might become painful with a few hundred parts though, perhaps I missed something?

 

Up until now when I have needed this particular feature, is to just to it manually, using a copy and paste.

 

 

Also having the custom field in the Assembly, highlight the entire QTY column, and copy it to the new custom column. It is still a manual process which is succeptable to errors, but pretty quick to do.

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 7 of 37
cwhetten
in reply to: rhasell

You're right, having to add a line for each component is a pain, and you would have to remember to add new lines or remove lines if you add or remove components from your assembly.  Not ideal.

 

With that in mind, I modified the code to take care of these issues.  Here it is:

 

'****************************


oCompDef = ThisDoc.Document.ComponentDefinition
Dim oCompOcc As Inventor.ComponentOccurrence

'get the part number of this assembly and use it to build the name of a custom property, i.e. "4100_QTY"
customPropertyName = CStr(iProperties.Value("Project", "Part Number")) & "_QTY"

'loop through each component in this assembly
For Each oCompOcc In oCompDef.Occurrences
    oCompName = oCompOcc.Name
    
    'get the part number of the current occurrence
    oCompPartNumber = oCompOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
    
    customPropertySet = oCompOcc.Definition.Document.PropertySets.Item("Inventor User Defined Properties")
    
    'test if the custom property already exists
    Try
        prop = customPropertySet.Item(customPropertyName)
    Catch
        'assume error means iProperty doesn't exist, so create the property
        customPropertySet.Add(0, customPropertyName)
    End Try
    
    'set the value of the custom property in the current occurrence to equal its quantity in the assembly
    iProperties.Value(oCompName, "Custom", customPropertyName) = ThisBOM.CalculateQuantity("Model Data", oCompPartNumber)
Next

iLogicVb.UpdateWhenDone = True

'****************************

This new code will work no matter how many components are in the assembly, and even works (without modification) when you add or remove components.

 

I wrote it to build the name of the custom iProperty based on the part number of the assembly that contains the rule.  So, like in the example I mentioned earlier, if your assembly part number is 4100, then this code will take that value and create a custom iProperty called 4100_QTY.  You can modify this to be whatever you wish.  If you aren't sure how to do that, just ask and I can help you modify the code.

 

This rule is flexible enough that you can copy and paste it into any of your assemblies without modifying the code.

 

-cwhetten

Please click "Accept as Solution" if this response answers your question.

 

Message 8 of 37
SKinzel
in reply to: SKinzel

Thanks.  I'm definately going to give this a try.  It might be a couple of weeks before I get time to play with it.

Stuart Kinzel
Inventor 2013-64bit, HP EliteBook8740w Intel Core i5CPU 2.67 GHz
8GB memory
Windows 7 64bit
Message 9 of 37
rhasell
in reply to: cwhetten

Very cool, thanks.

 

I have run it briefly and will definately store it for later use. Does what you said it would, I will probably add some some code from other snippets to step through the Sub-assemblies as well, if I get it right I will post the update.

 

With a bit of modification this snippet has lots of other uses as well.

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 10 of 37
cwhetten
in reply to: rhasell

I also thought about going through sub-assemblies.  But, you might not always want to do that.  If some of your sub-assemblies have drawings of their own, then you would want its sub-components to have quantities from the sub-assembly, not the higher assembly, right?

 

Then again, if some of your sub-assemblies are phantom, then you would definitely want the rule to run through them and set the quantities of the sub-components from the highter assembly.

 

It's kinda tricky.

 

-cwhetten

Message 11 of 37
00ash00
in reply to: cwhetten

Hi All,

 

I found this bit of code which i use from the top level assembly file (as an external rule) to add total Qty for the project to each part. It puts the value in the iProperties "Authority" cell and i then call that cell up on my drawing in a note

Ash

Dell - T1650
Intel(R)Xeon(R) CPU E3-1290 V2 @ 3.70GHz
16GB
64-Bit
Windows 7 Pro
Inventor 2013 Build: 138
Message 12 of 37
SKinzel
in reply to: cwhetten

I did a copy and paste of the code into a new rule, named QTY, and received an error.  Attached is the error dialog box that pops up when I save the rule

Stuart Kinzel
Inventor 2013-64bit, HP EliteBook8740w Intel Core i5CPU 2.67 GHz
8GB memory
Windows 7 64bit
Message 13 of 37
cwhetten
in reply to: SKinzel

Hmm...  I'm not quite sure what is happening here.  Is it possible for you to attach your assembly so I can take a closer look?  I would need to see exactly what is going on in your specific assembly to even begin to sleuth out the cause of this error.

Message 14 of 37
mrattray
in reply to: SKinzel

Sometimes when you copy/paste from this forum you get little "turds" that find their way into your code. Try a copy/paste from the attached text file, instead (it's the same code as posted by cwhetton).

Mike (not Matt) Rattray

Message 15 of 37
IgorMir
in reply to: SKinzel

Just out of curiosity - what, an old fashion way of collecting quantity of parts used in assembly doesn't work any more? Here is a picture of how it has been done before.

Regards,

Igor.

Web: www.meqc.com.au
Message 16 of 37
mrattray
in reply to: IgorMir

A lot of fabrication houses (like mine) have assembly specific details, where the detail has assembly specific information on it such as quantity. It's not up to a CAD guy to completely change the way a long established business conducts its business. I believe this is the problem that the original poster has: how do you get the part file to know assembly specific information?

A parts list is the way to go for a manufacturing environment, but AutoDesk (and other CAD packages, too) have always left us fab guys to fend for ourselves with backdoor workarounds like the previously posted BOM code.

Mike (not Matt) Rattray

Message 17 of 37
IgorMir
in reply to: mrattray

Frankly, Mike, I don't understand a meaning of your response. I reply to the OP with the intention to show, that there is no need to dive in the deep end of the pool before investigating at least some of the options available to the software users. And that's it. To the extend - this particular topic (and some others) remind me of the days of AutoCAD. People were way to keen to customise the soft before looking into the depth of the software itself.

You have been marked on this forum as a Pro (given the amount of your posts, of course). But I guess - it is not good enough. The original question was - how to indicate on the drawing how many parts are used in the assembly, related to that drawing? Didn't I answer that question deep enough?

Best Regards,

Igor.

Web: www.meqc.com.au
Message 18 of 37
SKinzel
in reply to: mrattray

Many years ago we were mostly a job shop.  And to this day a lot of what we do, repair of rotating equipment, means we make one or two of something for a specific job.  I believe this is why the quantity was originally placed on the individual part detail drawings.  However, now we also make custom reducers and putting a quantity on the individual drawing really doesn't make much sense to me since an assembly may have multiples of that part AND there may be multiple quantities of that assembly on an order.  Since they (the powers that be) wouldn't let me leave off the quantity we compromised and the quanitity I call out on the part drawings is the quanitity of that part in ONE assembly since one order may have multiples of the assembly and later orders may have different quantities.  Occasionally this ends up causing some confusion but the inertia to change how things are done is immense and I've mostly given up.

 

We were a small family company that has grown to be part of a large (2 billion/yr) company and a lot of our procedures are still the small family company way.  I'm sure if the professional drafters and engineers on this board saw how some of our drawings look you'd just shake your head and turn away.

Stuart Kinzel
Inventor 2013-64bit, HP EliteBook8740w Intel Core i5CPU 2.67 GHz
8GB memory
Windows 7 64bit
Message 19 of 37
mrattray
in reply to: IgorMir

I'm not sure how I offended you. This is the original question:


@SKinzel wrote:

Our individual part drawings reference the quantity of that part used in an assembly.  Is there any way to get the quantity number for a part from an assembly and insert it in the individual part drawing?  Currently I manually put this in but sometimes I forget to do this or I enter an incorrect number.

 

I haven't been able to find anyway to do this but any ideas on how to do this to keep my opportunites to make a mistake to a minimum?




@IgorMir wrote:
The original question was - how to indicate on the drawing how many parts are used in the assembly, related to that drawing?

These are not the same questions. While your answer was correct for what you appear to have believed was the answer, it is not an acceptable answer to the question posed.

Now, I've reread my post a couple times here and I fail to see what it is that I said about the difference between fabrication needs and manufacturing needs that has upset you so much. Could you please explain to me how I've upset you?

Mike (not Matt) Rattray

Message 20 of 37
mrattray
in reply to: SKinzel

The way my shop does it is we have an "order info" block on every detail. So we have a job number, order number, and order quantity in that block and then the quantity per assembly in the regular title block.

I really feel your pain here, it was horribly backwards to me when I started here. I'm going to guess that your shop is just like mine in that every tiny change in protocol causes a riot on the shop floor, too.

Mike (not Matt) Rattray

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report