I am trying to create multi-value user parameters with iLogic, my rule works but when ran it sets the initial value to an arbitrary (or it seems so to me) value that is not in my list. In this instance it sets the value to 4.03543307. Once I manually go in and change it to a value that is in my set list the 4.03543307 goes away but I'm wondering why it sets the value to something I haven't assigned.
Any help is greatly appreciated! Thanks!
Imports Inventor.UnitsTypeEnum
Dim oPartDoc As Document
oPartDoc = ThisDoc.Document
If oPartDoc.DocumentType = kPartDocumentObject Then
Dim oPartCompDef As PartComponentDefinition
oPartCompDef = oPartDoc.ComponentDefinition
Dim oParams As Parameters
oParams=oPartCompDef.Parameters
Dim oUserParams As UserParameters
oUserParams=oParams.UserParameters
Dim Width As Parameter
Try
otester = oUserParams.Item("Width")
Catch
oInsulationType=oUserParams.AddByValue("Width", 10.25, kInchLengthUnits)
MultiValue.SetList("Width", 12.25, 14.25, 16.25, 18.25)
End Try
End If
Parameter.Param("Width").ExposedAsProperty = False
Parameter.Param("Width").IsKey = True
Solved! Go to Solution.
Solved by mcgyvr. Go to Solution.
I'll give you a hint... 😉
convert 10.25 cm to inches = ??
Ahh yes, but why if I tell it inch units would it default to centimeters?
I thought I remember reading that iLogic does all its calculations in the background in metric, but I thought it would automatically convert it back to the units specified.
Is there an easy way to convert it without manually putting in the conversion?
You can use AddByExpressions instead and put your number in quotations
oUserParams.AddByExpression("Width", "10.25", kInchLengthUnits)
oInsulationType=oUserParams.AddByValue("Width", 10.25*2.54, UnitsTypeEnum.kInchLengthUnits)
Can't find what you're looking for? Ask the community or share your knowledge.