Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Is it possible to have iLogic rule create parts lists out of View Representations?
Solved! Go to Solution.
Re: ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
tagging along..
-------------------------------------------------------------------------------------
2012 Product Design Suite Ultimate
Windows 7 64 bit
90G OCZ SATA 3 SSD (My SSD is faster than your HDD)
Core I7 920 processor, ATI HD6970 graphics card, 12G Corsair RAM

iLogic set BOM via LOD
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Infoseeker,
If you are use the iLogic function IsActive to suppress component instances, their BOM structure is set to Reference. Therefore the suppressed occurrence, and only that occurrence will be removed from the BOM.
So IsActive not only suppresses the occurrence it also set's it's BOM structure as if you'd right clicked on it and selected BOM Structure > Reference. Recall that this is different that setting the BOM structure in the BOM editor or via the Document Settings, those 2 methods set it per file, rather than per assembly occurrence.
With this in mind here is an example rule. In this rule you select an item (on screen or in the browser, and it will be toggled on/off, and removed or added to the BOM. This is just a quick example to demonstrate the concept.
But to speak to the original request: I suspect you could use this idea to look at each occurrence in an assembly and check it's visibility setting (per the current Design View Representation) and then toggle the BOM structure for that occurrence to Reference if the occurrence is not visible.
I'm short on time, so I can't have a look at this anytime soon, but I thought I'd throw this out in case someone else wants to give it a shot.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'set a reference to the assembly component definition.
'this assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'get currently selected component
Dim oOccurrence as ComponentOccurrence
Try
oOccurrence = ThisDoc.Document.SelectSet.Item(1)
Catch
MessageBox.Show("Please select a component before running this rule.", "iLogic")
Return
End Try
'set the selected item
'oOccurrence = ThisApplication.ActiveDocument.SelectSet.Item(1)
'activate the Master LOD so we can read in the names of all the components
oAsmCompDef.RepresentationsManager.LevelOfDetailRe presentations("Master").Activate
InventorVb.DocumentUpdate(False)
'define an arraylist to hold the list of LOD rep names
Dim NameList As New ArrayList()
'define LOD rep
Dim oLODRep As LevelOfDetailRepresentation
'Look at the LOD reps in the assembly
For Each oLODRep In oAsmCompDef.RepresentationsManager.LevelOfDetailRe presentations
'set the list of names to the array list
NameList.add(oLODRep.Name)
Next
'check for an iLogic LOD rep and create it if not found
If Not NameList.Contains("iLogic LOD") Then
'create iLogic LOD
oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRe presentations.Add("iLogic LOD")
oLODRep.Activate
Else
oLODRep.Activate
End If
'Toggle the selected component's active status
If Component.IsActive(oOccurrence.Name) = True Then
Component.IsActive(oOccurrence.Name) = False
Else
Component.IsActive(oOccurrence.Name) = True
End If
'Save File (set LOD changes)
ThisDoc.Save

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic set BOM via LOD
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I think it would be much more user friendly if we toggled the bom structure directly instead of using isactive. This way we needn't deal with any LOD headaches.
You can use these snippets to control the bom structure at the assembly level:
Component.InventorComponent("occurence").BOMStruct ure = BOMStructureEnum.kDefaultBOMStructure
Component.InventorComponent("occurence").BOMStruct ure = BOMStructureEnum.kReferenceBOMStructure
You could then use a loop to cycle through each occurence checking it's visibility setting per Curtis's suggestion and set it's bom structure accordingly.
Re: iLogic set BOM via LOD
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi mrattray,
I think you're spot on. And here's a snippet I had on hand, to iterate though the component occurrences of the assembly in case it helps someone.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' 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 'check for and skip virtual components '(in case a virtual component trips things up) If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then 'Show occurrence name In the message box body MessageBox.Show(oOccurrence.Name, "iLogic") Else End If Next

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
iLogic set BOM via Visibility
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Inventor users,
Here's the code snippets above combined into a rule that sets the BOM structure to Reference if the component is not visible.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' 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 'check for and skip virtual components If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then 'set BOM as default if the component is visible If Component.Visible(oOccurrence.Name) = True Then Component.InventorComponent(oOccurrence.Name).BOMStructure = _ BOMStructureEnum.kDefaultBOMStructure 'set BOM as reference if the component is not visible ElseIf Component.Visible(oOccurrence.Name) = False Then Component.InventorComponent(oOccurrence.Name).BOMS tructure = _ BOMStructureEnum.kReferenceBOMStructure End If Else End If Next

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Awesome! Thanks.
This rule needs to be added to the .idw or .iam?
Re: ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I guess assembly.
Re: ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Does not work for me, maybe because I also use in my parts list substitute and grouping option... Or I am just missing something.
Re: ILogic help needed!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
How does it not work? Is there an error message? Did you put it in the assembly?(it has no business being in the idw) Does it do something unexpected? We need more information than "it doesn't work" if we're going to be of any help to you. Can you post the files here?



