My solution isn't very eloquent, but it works in my small scale testing.
I can get the code to run at the part level and update the holes, but it errors out at the assembly level. The best solution I can find looks like this:
1. Create a rule at the assembly level to push the parameters to the part, open the part, run a rule called "Hole Master" and then close the part.
Parameter(A5 & "A.ipt.HOLE_QTY") = HOLE_QTY
Parameter(A5 & "A.ipt.HOLE1_A") = HOLE1_A
Parameter(A5 & "A.ipt.HOLE1_B") = HOLE1_B
Parameter(A5 & "A.ipt.HOLE1_TYP") = HOLE1_TYP
Parameter(A5 & "A.ipt.HOLE1_SZ") = HOLE1_SZ
A6 = ThisDoc.Path
A7 = ( A6 & "\" & A5 & "A.ipt")
kicker_part = A7
doc = ThisApplication.Documents.Open(kicker_part,True)
auto = iLogicVb.Automation
auto.RunRule(doc, "Hole Master")
doc.Close(True)
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
2. Hole Master unsuppresses the rule "Hole Control":
Auto = iLogicVb.Automation
Auto.GetRule(ThisDoc.Document, "Hole Control").IsActive = True
iLogicVb.RunRule("Hole Control")
It is important that this rule has no other way to be triggers. If it can run at any other time, it will error out.
3. Hole Control suppress/unsuppress the hole features and the rule that control the individual feature. I'm not going to show all this text because there is just too much due to the number of holes I'm trying to control. I will say it is mostly just standard IF statements
4. This leads to the code that controls the individual holes. I'm not going to show all of this either because there are just too many bits that are specific to my need, but I will share the important parts of the code:
'the opener
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHoleFeats As HoleFeatures = oPDef.Features.HoleFeatures
Dim oHole As HoleFeature = oHoleFeats.Item("Hole1")
<giant IF statement to sort based on options selected>
Dim oHCInfo As HoleClearanceInfo = oHoleFeats.CreateClearanceInfo(a1, a2, a3, FastenerFitType.kNormalFitType)
'a1 is the page name in the spreadsheet.
'a2 is the row for the size hole you need
'a3 is the column that controls the hole dimensions
oHole.ClearanceInfo = oHCInfo
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
Auto = iLogicVb.Automation
Auto.GetRule(ThisDoc.Document, "Hole Closer").IsActive = True
iLogicVb.RunRule("Hole Closer")
5. Hole Closer is a short bit of code that just suppresses all the other codes that control the holes so they don't run unless I make changes to the controlling form.
I think the last few lines can be removed from the code that actually controls the holes and just have "Hole Closer" set to run with traditional triggers.
I know I can shave it down, but I haven't gotten to the clean up stage yet.
If you have any suggestions on how I can clean this process up (because it is a process) and way more complex than it likely needs to be), I'm open to suggestions. Creating tools is a small part of my job so I know my understanding of i-logic is limited.