Display quantity in a drawing

Display quantity in a drawing

Anonymous
Not applicable
7,246 Views
23 Replies
Message 1 of 24

Display quantity in a drawing

Anonymous
Not applicable

Hello,

I would like to display the total quantity of each part of my project on its corresponding drawing. Is it possible in some way (using an iLogic rule?) to obtain the total number of a given part from the topmost assembly or BOM?

Thank you

Daniel

(Inventor 2016)

0 Likes
Accepted solutions (2)
7,247 Views
23 Replies
Replies (23)
Message 2 of 24

salariua
Mentor
Mentor

Where do you intend to show the quantity?

 

on the view description, on the titleblock, note, symbol?

 

you can create a custom iPropety which stores the quantity and show it on the drawing... or iLogic/VBA

 

this shows you how to create a coordinated BOM, and on this principle, you can add quantity to items as well as custom property. That will only work with project files, not library, or content center which read-only files.

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 3 of 24

Anonymous
Not applicable

Hello,

 

Thanks a lot for your answer. I would like to show it in the title block, and having a custom iproperty is just perfect for this. It seems to work, with one flaw. I have created a custom iproperty column called "Total quantity" in the BOM of the topmost assembly, as you proposed, and copied the quantity information into this column. However, this is a manual step, and it does not automatically update with the model.

Thanks a lot

Daniel

0 Likes
Message 4 of 24

salariua
Mentor
Mentor

Hi @Anonymous

 

Are you interested in PartsOnly or subassemblies as well?

 

I think rather than calculating the number of occurrences everytime it's best we access BOM directly and pull the quantity but are you interested in PartsOnly or Structured tab? subassemblies as well?

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 5 of 24

Anonymous
Not applicable

Hello,

parts only. I create a BoM for the whole collaborative project, indicating who needs to procure which parts. This BoM automatically includes the total quantity of each item, so I have no problem here. However, I also want to indicate the total quantity of each individual part in its own drawing, so that the engineer/technician can manufacture the right quantity without having to look at the global parts list.

 

thank you

Daniel

0 Likes
Message 6 of 24

salariua
Mentor
Mentor
Accepted solution

Try this:

 

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
		
Dim oAssyDef As AssemblyComponentDefinition
oAssyDef = oDoc.ComponentDefinition

Dim oBOM As BOM
oBOM = oAssyDef.BOM

oBOM.PartsOnlyViewEnabled = True

'change Item("Parts Only") to Item(3) or your language specific description
'if you don't run Inventor english
Dim oBOMView As BOMView = oBOM.BOMViews.Item("Parts Only")

Dim oBOMRow As BOMRow

For Each oBOMRow In oBOMView.BOMRows
    'Set a reference to the primary ComponentDefinition of the row
    Dim oCompDef As ComponentDefinition
    oCompDef = oBOMRow.ComponentDefinitions.Item(1)
    
    Dim CompFullDocumentName As String = oCompDef.Document.FullDocumentName
    Dim CompFileNameOnly As String
    Dim index As Integer = CompFullDocumentName.lastindexof("\")
    
    CompFileNameOnly = CompFullDocumentName.substring(index+1)
    
    'MessageBox.Show(CompFileNameOnly)
    
    Dim Qty As String
    Qty = oBOMRow.TotalQuantity
    
    iProperties.Value(CompFileNameOnly, "Custom", "Qty") = Qty
Next


To be honest I haven't investigated the cases where you would have suppressed components (LOD), merged components (same part number) or virtual parts (you won't detail them on drawings anyway)

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 7 of 24

karthur1
Mentor
Mentor

Do you use the same parts in different projects.... or is what you're making sort of a "one-of" creature?

 

Thanks

0 Likes
Message 8 of 24

kelly.young
Autodesk Support
Autodesk Support

Have you explored in the Parts List Edit > R+Click Format Column... > Substitution Tab > Enable Value Substitution Radio > Browse Properties > choose desired (Unit Qty) > Sum of Values.

 

 A while back I stumbled across this and it worked in a similar situation so thought I would throw it out there see if it helps.

0 Likes
Message 9 of 24

salariua
Mentor
Mentor

@kelly.young wrote:

Have you explored in the Parts List Edit > R+Click Format Column... > Substitution Tab > Enable Value Substitution Radio > Browse Properties > choose desired (Unit Qty) > Sum of Values.

 

 A while back I stumbled across this and it worked in a similar situation so thought I would throw it out there see if it helps.


@kelly.young. I fail to see how this would work on part drawing unless you place the main iam Parts List in the part drawing but then you can't filter the Parts List to show just one part.

 

Best option would be Ballooned Items and you attach a balloon but that doesn't work on part views (part drawings).

 

can you detail your idea? maybe I am missing something.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 10 of 24

karthur1
Mentor
Mentor

@salariua wrote:

Try this:

......<<Insert Code Here>> 
To be honest I haven't investigated the cases where you would have suppressed components (LOD), merged components (same part number) or virtual parts (you won't detail them on drawings anyway)


Adrian,

I see that your code runs thru all the parts in the assembly and writes a custom property "Qty" in each of them.  I "re-use" parts, so it wouldn't be practical to do this in my situation.  I am not sure what the original poster is trying to do either.  I would like to be able to show the qty needed for each "Project" so to speak.  The way I currently do this now is to generate a parts only list and print the details to pdf.  I then manually write the value for the qty on each detail sheet.  This is time consuming and error prone, but I dont really see another way to do it since I reuse the parts from job to job.

 

It would be good to show the qty in a drawing label or a custom symbol, but I guess somewhere I would have to tell it what assembly to pull the qty from.

 

Any suggestions?

 

Kirk

0 Likes
Message 11 of 24

Anonymous
Not applicable

All parts are project-specific, I do not use them elsewhere.

0 Likes
Message 12 of 24

salariua
Mentor
Mentor

@karthur1 wrote:

It would be good to show the qty in a drawing label or a custom symbol, but I guess somewhere I would have to tell it what assembly to pull the qty from.

Any suggestions?

 


Hi Kirk.

 

What you want is possible but the workflow would be a little different. Instead of modifying each part's properties to add a custom value we would add this as cosmetic feature/element in the drawing.

 

Several options to add it to the drawing:

-iProperties (of the drawing)

-Parameters (of the drawing)

-Just a string of text in the drawing.

 

First, two options are best because we can find them and update them if needed but the string of text would be a bit more difficult unless we add some key words to the text so we can do a string search.

 

We would then need to give you a Browse For dialog which will allow you to select the Assembly you need quantity for.

 

A possibly better solution would be for you manually add main Assembly path to the code instead of browsing for it on every drawing. When you finished working on this project you edit the code and it will update drawings with a single click rather than hunt and pick with browse for dialog.

 

Is the Drawing project specific?

or

Does the part have a single drawing which needs updating for every project you use it?

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 13 of 24

Anonymous
Not applicable

You are a magician. Thank you!

 

As an idea for the other thread in this discussion: if you know at the beginning of your project how your topmost assembly would be called, you can create your own template files in your project directory, and place an iLogic rule into the drawing template which reads the quantity from the Bo of this topmost assembly. Or in fact it could read the filename of the topmost assembly from a text file, and then you can easily define/change the topmost assembly file later on as well, without the need to change the iLogic rule in all of your drawings.

Message 14 of 24

karthur1
Mentor
Mentor

salariua wrote:

 

What you want is possible but the workflow would be a little different. Instead of modifying each part's properties to add a custom value we would add this as cosmetic feature/element in the drawing.

Several options to add it to the drawing:

-iProperties (of the drawing)

-Parameters (of the drawing)

-Just a string of text in the drawing.

First, two options are best because we can find them and update them if needed but the string of text would be a bit more difficult unless we add some key words to the text so we can do a string search.

We would then need to give you a Browse For dialog which will allow you to select the Assembly you need quantity for.

A possibly better solution would be for you manually add main Assembly path to the code instead of browsing for it on every drawing. When you finished working on this project you edit the code and it will update drawings with a single click rather than hunt and pick with browse for dialog.

Is the Drawing project specific?

or

Does the part have a single drawing which needs updating for every project you use it?


The parts "usually" has a single drawing and the quantity needs to be change with each project.  In some cases, I will place multiple parts on a detail sheet rather than doing one-sheet-one-part.  In either case, I would like to show the quantity for the entire project. Either way, if I write some custom property to the part or the idw, it will have to be check-out of vault, then check-in.  This will increment the vault version. I am sort of concerned what this will do to my vault database size.

 

Do you think we need to move this to a new thread? I would hate to hijack Daniels thread. 

 

Kirk

0 Likes
Message 15 of 24

salariua
Mentor
Mentor

@karthur1 wrote:

 

The parts "usually" has a single drawing and the quantity needs to be change with each project.  ... will have to be check-out of vault, then check-in.  This will increment the vault version.


You can edit the drawing without checkout from vault, which I think you do anyway. Add Quantity, No Checkout, Print, Close Without Saving.

 


@karthur1 wrote:
In some cases, I will place multiple parts on a detail sheet rather than doing one-sheet-one-part.

 

So we are better off to add the Project Quantity to the View Label, main view or all views, your choice. I've done something similar but on assembly drawing. For small number of parts, we detail them on the assembly drawing and we added quantity on the view label. Check this post and if you have multiple parts lists, this one, just to get an idea of what's possible.

 


@karthur1 wrote:

Do you think we need to move this to a new thread? I would hate to hijack Daniels thread. 

 


I would post it on Inventor Customization forum because more skilled people can jump in and speed it up. I am only a copycat that knows how to find bits of code to get things done but I will help as much as I can. 🙂

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 16 of 24

karthur1
Mentor
Mentor

Adrain,

 

Never thought about just updating the idw and not saving it.  Guess that would work. Will take a look at the links.

 

Thanks

Kirk

0 Likes
Message 17 of 24

karthur1
Mentor
Mentor

Adrain,

 

Never thought about just updating the idw and not saving it.  Guess that would work. Will take a look at the links.

 

Thanks

Kirk

0 Likes
Message 18 of 24

salariua
Mentor
Mentor

ghost in the machine.... the Matrix is changing I guess.

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 19 of 24

donaldleigh
Advocate
Advocate

Hi Adrian.

 

Your code works great. Thanks

 

what if I wanted to include all assemblies as well?

 

Donald

0 Likes
Message 20 of 24

salariua
Mentor
Mentor
Accepted solution

Hi @donaldleigh,

 

I found some good examples for your. Please give them a try and if they don't work we can try and help you our.

 

Remember to activate the specific BOM View before running the code, be that "Parts Only", "Structured" or "Model Data" and to disable the rest if you don't use them. That will speed up drawings, parts list, bom, etc.

 

Good code. Just change from filling in iProperties Authority to Custom Quantity.

 

Similar code, different post.

 

Similar, needs rework

 

And some help pages >>here<<.

 

Good Luck

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!