Message 1 of 13
iLogic to turn all components from reference to default

Not applicable
04-21-2017
09:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello internet friends.
I am trying to find an ilogic code that will search an assembly and if the component is reference BOM structure for it to then change to Default. I have tried a lot of different things from the information I could find but still havent been able to run properly. I think it's pretty simple code, I'm just not getting it. Heres the code I have so far for this operation.
SyntaxEditor Code Snippet
iLogicVb.RunRule("UPDATE") GUSSET_PLATES = Parameter("TC####-X-105-A02.ipt.GUSSET_PLATES") ENCLOSURE_PLATES = Parameter("TC####-X-105-A02.ipt.ENCLOSURE_PLATES") InventorVb.DocumentUpdate() Dim doc as AssemblyDocument = ThisDoc.Document Dim oLOD As LevelOfDetailRepresentation Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition InventorVb.DocumentUpdate() If GUSSET_PLATES="YES" AndAlso ENCLOSURE_PLATES = "YES" Then oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("MASTER").Activate(True) Component.IsActive("GUSSET:1")=True Component.IsActive("GUSSET:2")=True Component.IsActive("ENCLOSUREPL1:1")=True Component.IsActive("ENCLOSUREPL1:2")=True Component.IsActive("ENCLOSUREPL1:3")=True Component.IsActive("ENCLOSUREPL1:4")=True Component.IsActive("ENCLOSUREPL2:1")=True Component.IsActive("ENCLOSUREPL2:2")=True Component.IsActive("ENCLOSUREPL2:3")=True Component.IsActive("ENCLOSUREPL2:4")=True Component.IsActive("ENCLOSUREPL3:1")=True Component.IsActive("ENCLOSUREPL3:2")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:1")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:2")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:3")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:4")=True ElseIf GUSSET_PLATES="YES" AndAlso ENCLOSURE_PLATES = "NO" Then oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("ENCLOSURE PLATES SUPPRESSED").Activate(True) Component.IsActive("GUSSET:1")=True Component.IsActive("GUSSET:2")=True Component.IsActive("ENCLOSUREPL1:1")=False Component.IsActive("ENCLOSUREPL1:2")=False Component.IsActive("ENCLOSUREPL1:3")=False Component.IsActive("ENCLOSUREPL1:4")=False Component.IsActive("ENCLOSUREPL2:1")=False Component.IsActive("ENCLOSUREPL2:2")=False Component.IsActive("ENCLOSUREPL2:3")=False Component.IsActive("ENCLOSUREPL2:4")=False Component.IsActive("ENCLOSUREPL3:1")=False Component.IsActive("ENCLOSUREPL3:2")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:1")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:2")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:3")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:4")=False InventorVb.DocumentUpdate() iLogicVb.RunRule("SUPPRESSED TO REFERENCE") iLogicVb.RunRule("UPDATE") oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("MASTER").Activate(True) Else If GUSSET_PLATES="NO" AndAlso ENCLOSURE_PLATES = "YES" Then oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("GUSSETS SUPPRESSED").Activate(True) Component.IsActive("GUSSET:1")=False Component.IsActive("GUSSET:2")=False Component.IsActive("ENCLOSUREPL1:1")=True Component.IsActive("ENCLOSUREPL1:2")=True Component.IsActive("ENCLOSUREPL1:3")=True Component.IsActive("ENCLOSUREPL1:4")=True Component.IsActive("ENCLOSUREPL2:1")=True Component.IsActive("ENCLOSUREPL2:2")=True Component.IsActive("ENCLOSUREPL2:3")=True Component.IsActive("ENCLOSUREPL2:4")=True Component.IsActive("ENCLOSUREPL3:1")=True Component.IsActive("ENCLOSUREPL3:2")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:1")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:2")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:3")=True Component.IsActive("ENCLOSURE_STIFFENER_PL:4")=True InventorVb.DocumentUpdate() iLogicVb.RunRule("SUPPRESSED TO REFERENCE") iLogicVb.RunRule("UPDATE") oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("MASTER").Activate(True) Else If GUSSET_PLATES="NO" AndAlso ENCLOSURE_PLATES = "NO" Then oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("GUSSETS AND ENCLOSURE PLATES SUPPRESSED").Activate(True) Component.IsActive("GUSSET:1")=False Component.IsActive("GUSSET:2")=False Component.IsActive("ENCLOSUREPL1:1")=False Component.IsActive("ENCLOSUREPL1:2")=False Component.IsActive("ENCLOSUREPL1:3")=False Component.IsActive("ENCLOSUREPL1:4")=False Component.IsActive("ENCLOSUREPL2:1")=False Component.IsActive("ENCLOSUREPL2:2")=False Component.IsActive("ENCLOSUREPL2:3")=False Component.IsActive("ENCLOSUREPL2:4")=False Component.IsActive("ENCLOSUREPL3:1")=False Component.IsActive("ENCLOSUREPL3:2")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:1")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:2")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:3")=False Component.IsActive("ENCLOSURE_STIFFENER_PL:4")=False InventorVb.DocumentUpdate() iLogicVb.RunRule("SUPPRESSED TO REFERENCE") iLogicVb.RunRule("UPDATE") oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("MASTER").Activate(True) End If
I really appreciate any help :)