Hi Guys,
First post here. I have used Inventor for quite a while but never for much more than the odd 3D model.
I have recently created templates that allow me to use Inventor to create detailed fabrication drawings rather than relying on AutoCAD. But I have run across a question with regards to the BOM. Let me try and explain my issue.
I currently create assemblies for fabricated items. However, in the complete (or top level assembly) there may be multiple fabricated items (assemblies required). At the moment I create the BOM and manually edit the quantities required to reflect the number of assemblies (and resulting parts) that are required.
In some research I was able to find a post that got me part of the way to a solution. In my assembly file I created a parameter called "AssemNo" which is meant to reflect the number of assemblies required. In my part files I created a parameter called "AssemQty". I would insert the following iLogic code for each part in the assembly:
quantity - This.BOM.CalculateQuantity("Model Data", "PartNumber")*AssemNo
Parameter("Part Name:1", "AssemQty") = quantity
This works but it requires me to create that line of code for every part in my assembly. I know an iLogic code can be created to search an assembly and change parameters of all parts (see below as an example to copy Occurence name to iProperties >
' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
Dim oName As String
oName = oOccurrence.Name
iProperties.Value(oOccurrence.Name, "Project", "Part Number") = oName
MessageBox.Show(oOccurrence.Name, "iLogic")
Next
Can the two be combined? Any ideas would be appreciated.
Thanks,
Doug Newnham
Solved! Go to Solution.
Solved by Doug_Newnham. Go to Solution.
I guess if I wait long enough a solution will seem obvious. For peoples interest the following code worked for me.
' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
Parameter(oOccurrence.Name, "AssemQty") = ThisBOM.CalculateQuantity("Model Data", iProperties.Value(oOccurrence.Name, "Project", "Part Number"))*AssemNo
Next
Hope this helps someone.
Welcome to the forum Doug.
There are many ways to achieve workarounds to get asembly quantities. But they always falter when the human is involved. Forgetting to run the rule or to change that custom iProperty that shows the QTY on the drawing.
A failsafe method is to pattern the items at the top assembly level. All sub-assemblies and parts will have thier qty's multiplied by the patterned number. I regularily pattern an assy of 100 odd items at a pitch of 0.00000000000000001. You won't see the pattern offset in the model or on a drawing.
Just my 2 cents worth.