I can share the rules for it, however I don't think I can share the part which uses them, because I created it in a beta build of Inventor 2011 (whose files cannot be read by Inventor 2010). The part has three rules in it, two of which compute data about the center of gravity, mass, and volume of two of its three 3D features. I think I mentioned this before, but the part I'm trying to make is a camshaft, the reason I'm using iLogic to help make it is because I need to create a counter-weight with perfectly cancels out the offset in the camshaft's center of gravity induced by its cam-lobe. What iLogic tries, and at this point is successfully able to compute, is the length of the extrusion which defines the counter-weight's thickness. The third rule collects parameter data generated by the first two rules and computes what this extrusion length should be. Explaining what everything does with a screen-shot would be pretty easy to do, but my confidentiality agreements don't permit to post screen-shots until the 25th of March. But alas, here is a copy of my code with comment lines in it.
'First rule in the optimization process, it determines the current center of gravity of the counter-balance weight. CBWeight is the extrusion that defines the counter-balance weight, Shaft is the extrusion which defines the core shaft that both the cam-lobe and counter-weight are attached to. Inventor cannot (as far as I can tell) find the center of gravity/volume/mass of a specific feature in a part, so what this rule first does is suppress the extrusions which define the cam-lobe ('CamLobe') and the shaft.'
Parameter.UpdateAfterChange = True
If Feature.IsActive("CBWeight") = True Then
Feature.IsActive("Shaft") = False
Feature.IsActive("CamLobe") = False
End If
'Once the relevant features are disabled, the rule then evaluates the y-axis position of CBWeight's center of gravity and its mass (although the mass value of this feature is not used to determine its shape).'
centerPt = iProperties.CenterOfGravity
CBWeightCG = centerPt.y
CBWeightM = iProperties.Mass
'The next two lines unsuppress the CamLobe extrusion and load the second rule.'
Feature.IsActive("CamLobe") = True
iLogicVb.RunRule("CamLobe Center of Gravity Calculator")
'2nd Rule... This pretty much does the same thing as the last rule, it suppresses every feature except the CamLobe extrusion and finds both the y-axis position of the CamLobe's center of mass and the CamLobe's total mass (which also is not used, I just like having it in my parameters table for reference). It also finds the CamLobe's volume (parameter CamLobeV), this is used in the calculation to determine the magnitude of parameter CBWT (the magnitude of the extrusion CBWeight).'
If Feature.IsActive("CamLobe") = True Then
Feature.IsActive("Shaft") = False
Feature.IsActive("CBWeight") = False
End If
centerPt2 = iProperties.CenterOfGravity
CamLobeCG = centerPt2.y
CamLobeM = iProperties.Mass
CamLobeV = iProperties.Volume
'Re-enables all of the suppressed features so the model looks as it should normally,I probably should mention that running both rules 1 and 2 takes only a tiny fraction of a second, so you never actually get to see the suppression/unsuppression process happen.'
Feature.IsActive("Shaft") = True
Feature.IsActive("CBWeight") = True
'Loads rule 3, which calculates, given the data produced by rules 1 and 2, what CBWT should be.'
iLogicVb.RunRule("CBWeight Thickness and Mass Calculator")
'Rule 3, d0 is the diameter of the circle which defines the sketch used in the 'Shaft' extrusion, PI is just the number 3.14159265358979.... Adjusts the length of Extrusion CBWeight so that the mass of the feature said extrusion produces can offset the center of gravity of the Cam-Lobe'
CBWT = Abs(2*CamLobeV*CamLobeCG/(PI*CBWeightCG*((CBWW+d0/2)^2-(d0/2)^2)))
I'll post screen-shots of the part two days from now when my agreements expire, sorry if this doesn't make a whole lot of sense. Well, anyways enjoy.
Alan Campbell