Hi,
I would like to obtain, in a structured parts list, the total number of ITEM in the sub-assembly.
See the picture attached for the example.
I have found an iLogic rule to create an user ipropertie in each part, with the total nomber of this part in all the assemby (included all sub-assemblies).
I would like to know if it is possible to obtain the total of this part only in the sub-assembly. Is it possible with an iLogic rule or VBA ? Because I'm not a expert in programming ...
Thanks for your solutions !
Best regards.
Hi,
I wrote a blog for your question. Hooe it helps.
http://adndevblog.typepad.com/manufacturing/2013/12/bom-item-total-quantity-by-sub-assemby.html
Hi,
I tried to use the rule u have on the blog, but when i run it i get a empty blank window? and then nothing?
And in what property is the qty stored?
Hi,
Thanks for the answer, but it is not exactely what I want.
I try to export a structured BOM with the total quantity for the parts in each sub-assembly, and the same component can be in several sub-assembly.
Thanks for your help. Regards,
Vincent
Hi,
do you actually mean the BOM view of "Parts Only"? If yes, you just need to check the relevant objects of BOM. Here is a simple VBA code. Of course, the quantity includes the number if the part is also insterted to top assembly directly. You could just count the number in top assembly and decrease the number from total quantity .
Sub test() Dim oBOM As BOM Set oBOM = ThisApplication.ActiveDocument.ComponentDefinition.BOM 'enable part only view oBOM.PartsOnlyViewEnabled = True Dim oPartOnlyView As BOMView Set oPartOnlyView = oBOM.BOMViews("Parts Only") Dim oBomRow As BOMRow For Each oBomRow In oPartOnlyView.BOMRows Dim oPartName As String oPartName = oBomRow.ComponentDefinitions(1).Document.DisplayName Dim oPartTotalQuantity As Integer oPartTotalQuantity = oBomRow.TotalQuantity Debug.Print "Part: "; oPartName & " Total Quantity: " & oPartTotalQuantity Next End Sub
Check out this thread and see if this is what you are looking for.
http://forums.autodesk.com/t5/Inventor-Customization/Qty-in-bom/m-p/4618825#M47203
Dan
Hi,
Thanks for your reply.
I Copy-Cut the iLogic rule in my assembly, but I have this error:
System.ArgumentException: Paramètre incorrect. (Exception de HRESULT : 0x80070057 (E_INVALIDARG))
à System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
à Inventor.BOMViews.get_Item(Object Index)
à LmiRuleScript.Main()
à Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
à iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
What am I doing wrong ?
Thanks for your answer.
Regards,
Vincent
Hi,
Thanks for your reply.
Unfortunately, it doesn't work, always the same error !
Personnaly, I don't understand ...
Regards,
Vincent
Just curious. What is your active project set to?
Hi,
I'm not sure I understand your question.
I'm testing the rule on two projects, one Vault, one non-Vault, but nothing change...
I do a new assembly with two news parts, but it is the same thing.
I test on another PC, and I have always the same error ...
Regards,
Vincent
Jefkee,
Yes this code works in 2013 as well.
Vrosselet,
Do you have a sample assembly that you can upload for me to test?
Hi,
Thanks for all your reply.
I found the problem: it is a language problem, because I'm working on a french version. I install the english language pack and I have no error yet.
But how works this rule ? nothing change on the assembly.
Should I do something special in the assembly ?
Regards,
Vincent
Ahhh. good 'o language pack. forgot to mention that. What the rule does is create a custom iproperty called "cQTY". That custom iproperty will contain the quantity of that part for the assembly that the rule ran on. In the BOM, display the cQTY property and you should see the values. Hopefully this is what you were trying to do.