I have several part models that are very simple and are basically long cylinders. I want to create an external ilogic rule that i can run in each part file that can identify the largest sketch parameter dimension. So basically it will find the Length of the cylinder due to it being a larger dimension and then rename the parameter.
I could just name the cylinder length sketch parameter the same in each part file, but I wanted to attempt to make it more universal for all users. So if a new user forgets to properly label his part parameters, the ilogic program can identify what parameter it should be looking for and rename it properly.
Does anyone have any ideas/tricks to how this can be done?
Hope it is better and more reliable to have a rule that automatically finds the parameter which controls the length of the first extrusion in this model. In this case you do not have to know the exact parameter name and its value can be less than the diameter.
Sample iLogic code is similar to the following:
'reference to this part document
Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFeatures As ExtrudeFeatures = oDef.Features.ExtrudeFeatures
'reference to the first extrusion
Dim oExtr As ExtrudeFeature = oFeatures.Item(1)
If oExtr.Definition.ExtentType = PartFeatureExtentEnum.kDistanceExtent Then
'extrusion length is controlled by model parameter
Dim oPar As Inventor.Parameter = oExtr.Definition.Extent.Distance
'model parameter name
Dim ParName As String = oPar.Name
MsgBox( ParName & " (mm): " & FormatNumber(10 * oPar.Value, 2))
MsgBox( "Extrusion type is not Distance Extent")
Is it works for you?