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: 

iLogic - Assembly Rule to multiple BOMQuantity in parts

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Doug_Newnham
2232 Views, 3 Replies

iLogic - Assembly Rule to multiple BOMQuantity in parts

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

3 REPLIES 3
Message 2 of 4
Doug_Newnham
in reply to: Doug_Newnham

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.

Message 3 of 4
BLHDrafting
in reply to: Doug_Newnham

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.

Brendan Henderson

Web www.blhdrafting.com.au
Twitter @BLHDrafting

Windows 7 x64 -64 GB Ram, Intel Xeon E5-1620 @ 3.6 GHz
ATI FirePro V7800 2 GB, 180 GB SSD & 1 TB HDD, Inv R2016 PDSU SP1 (Build 210), Vault 2016 Professional Update 1 (Build 21.1.4.0)
Message 4 of 4
Doug_Newnham
in reply to: BLHDrafting

Hi Brendan,

My solution also didn't take into account frame generator items (which limits its usefulness). I will give patterning the assembly at the top level a go.

You are right they all seem to involve some level of human involvement. One reason why despite peoples objections I always insist on checking drawings.

Thanks for the tip!

Regards,

Doug Newnham

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

Post to forums  

Autodesk Design & Make Report