iLogic Subassembly (rule) doesn't update unless you open and re-run rule

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly compossed of several subassemblies.
- "A" --> top level assembly
- "C1" -->subassembly
- "C2" -->subassembly
- "C3" -->subassembly
These subassemblies (C1, C2, C3,.. etc) have iLogic code in a rule that performs component replaces (Component.Replace) based on certain user parameter(s). These parameter(s) are referenced in my top "A" level assembly. I know that the parameter(s) are linked properly because if I change the parameter(s) in the "A" level assembly it automatically updates the linked parameter(s) in the "C" level subassemblies.
My problem is that updating the parameter(s) in my "A" level top assembly does not update the assembly meaning it does not perform the component replace as it should. The parameter(s) are updated but the rule either didn't run or didn't run correctly. However if open up that "C" level subassembly and run the rule which contains the replace component code then it updates. I have noticed that if I open up the form in the "A" level top assembly that I use to drive my parameter(s) and click over to the "C" level subassembly and change the form (parameters) then the subassembly updates correctly as it should. So it seems like the subassembly doesn't update because it isn't the active window or whatever you call the current model you're looking at.
I tried document updates (InventorVb.DocumentUpdate()) and Rebuilding (ThisApplication.ActiveDocument.Rebuild2 (True)) and neither seem to make a difference. I tried adding event triggers that run the rule when "Any Model Parameter Change" with no luck.
I came across this post which sounds very similar to my problem but I don't think my problem has anything to do with LOD. 😕
This is the error that I get when I update the parameter(s) in the "A" level top assembly:
Error in rule: LAYOUT, in document: 10 FT.iam
Component: The component named "Nothing" was not found.
The "C" level subassembly is called "10 FT"
The rule in my "C" level subassmbly is called "LAYOUT"
'ROPE COMPENSATION HITCH component replace Dim zAsmCompDef As AssemblyComponentDefinition zAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition Dim zOccurrence As ComponentOccurrence Dim zName As String For Each zOccurrence In zAsmCompDef.Occurrences zName = zOccurrence.Name If Left(zName,6)="C54598" Or Left(zname,6)="C54599" Then Existing_HITCH=zName End If Next Dim COMP_HITCH As String Select Case ROPES Case "7": COMP_HITCH="C54598" Case "9": COMP_HITCH="C54599" End Select Select Case WRG Case "36 IN" COMP_HITCH=COMP_HITCH+"001" Case "42 IN" COMP_HITCH=COMP_HITCH+"002" Case "48 IN" COMP_HITCH=COMP_HITCH+"003" Case "60 IN" COMP_HITCH=COMP_HITCH+"004" End Select If Left(Existing_HITCH,9) <> COMP_HITCH Then Component.Replace(Existing_HITCH, COMP_HITCH+".iam",True) End If ThisApplication.ActiveDocument.Rebuild2 (True) InventorVb.DocumentUpdate()
I'm not sure where component named "Nothing" is coming from. Maybe since there is an error in the rule it at least means that its attempting to run the rule but an error keeps occuring.
Help a young inexperienced engineer out here. Any help would be awesome and very welcome.