Autodesk Inventor Customization
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Is there a way to create a multi-value parameter with ilogic?
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Solved! Go to Solution.
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I use something like this ::
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 oAwesomeParameter As Parameter Try otester = oUserParams.Item("AwesomeParameter") Catch oInsulationType=oUserParams.AddByValue("AwesomeParameter", "Option1", kTextUnits) MultiValue.SetList("AwesomeParameter", "Option1", "Option2", "Option3", "Option4") End Try End If Parameter.Param("AwesomeParameter").ExposedAsPrope rty = False Parameter.Param("AwesomeParameter").IsKey = True
Also. A list of enums (for unit types) :
Public Enum UnitsTypeEnum kUnitlessUnits = 11265 kDefaultDisplayLengthUnits = 11266 kDatabaseLengthUnits = 11267 kCentimeterLengthUnits = 11268 kMillimeterLengthUnits = 11269 kMeterLengthUnits = 11270 kMicronLengthUnits = 11271 kInchLengthUnits = 11272 kFootLengthUnits = 11273 kYardLengthUnits = 11274 kMileLengthUnits = 11275 kDefaultDisplayAngleUnits = 11276 kDatabaseAngleUnits = 11277 kRadianAngleUnits = 11278 kDegreeAngleUnits = 11279 kGradAngleUnits = 11280 kDefaultDisplayMassUnits = 11281 kDatabaseMassUnits = 11282 kKilogramMassUnits = 11283 kGramMassUnits = 11284 kSlugMassUnits = 11285 kLbMassMassUnits = 11286 kOunceMassUnits = 11287 kDefaultDisplayTimeUnits = 11288 kDatabaseTimeUnits = 11289 kSecondTimeUnits = 11290 kMinuteTimeUnits = 11291 kHourTimeUnits = 11292 kDefaultDisplayTemperatureUnits = 11293 kDatabaseTemperatureUnits = 11294 kKelvinTemperatureUnits = 11295 kCelsiusTemperatureUnits = 11296 kFahrenheitTemperatureUnits = 11297 kMetersPerSecondSpeedUnits = 11298 kFeetPerSecondSpeedUnits = 11299 kMilesPerHourSpeedUnits = 11300 kAcreAreaUnits = 11301 kLiterVolumeUnits = 11302 kGallonVolumeUnits = 11303 kQuartVolumeUnits = 11304 kPintVolumeUnits = 11305 kCupVolumeUnits = 11306 kOunceVolumeUnits = 11307 kPascalPressureUnits = 11308 kPSIPressureUnits = 11309 kKSIPressureUnits = 11310 kNewtonForceUnits = 11311 kDyneForceUnits = 11312 kLbForceUnits = 11313 kOunceForceUnits = 11314 kWattPowerUnits = 11315 kHorsePowerPowerUnits = 11316 kJouleWorkUnits = 11317 kErgWorkUnits = 11318 kCalorieWorkUnits = 11319 kBTUWorkUnits = 11320 kRPMAngularVelocityUnits = 11321 kCompositeUnits = 11322 kNauticalMileLengthUnits = 11323 kMilLengthUnits = 11324 kSteradianAngleUnits = 11325 kCircularMilAreaUnits = 11326 kAmpElectricalCurrentUnits = 11327 kVoltElectricalVoltageUnits = 11328 kOhmElectricalResistanceUnits = 11329 kCoulombElectricalChargeUnits = 11330 kFaradElectricalCapacitanceUnits = 11331 kSiemensElectricalConductanceUnits = 11332 kmhoElectricalConductanceUnits = 11333 kWeberMagneticFluxUnits = 11334 kMaxwellMagneticFluxUnits = 11335 kTeslaMagneticInductionUnits = 11336 kGammaMagneticInductionUnits = 11337 kGaussMagneticInductionUnits = 11338 kHenryElectricalInductanceUnits = 11339 kOerstedMagneticInductionUnits = 11340 kHertzFrequencyUnits = 11341 kCandelaLuminousIntensityUnits = 11342 kLumenLuminousFluxUnits = 11343 kLuxIlluminationUnits = 11344 kMoleSubstanceUnits = 11345 kTextUnits = 11346 kBooleanUnits = 11347 End Enum
*Edit : Code formatting will seem a bit strange, but I wanted those lines to be full lines instead of broken!
If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.
Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Not sure if i would have a use for your rule, but i wanted to try it out.
I get a error on the line
oInsulationType
=oUserParams.AddByValue("AwesomeParameter", "Option1", kTextUnits)
it wants to convert Option1 from a string to a double..........any ideas?
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi swordmaster,
I noticed you stated you're using Inventor 2010. I'm guessing that is the issue, since Text parameters were not added until Inventor 2011.
As an alternative you might be able to use something like this:
oStringArray = new string(){"Pinched", "Drilled", "Milled (2 step)", "EDM"}
oList = InputListBox("Select a feature type", oStringArray, "Punched", "iLogic", "Available Feature Types")
MessageBox.Show(oList, "ilogic")
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello Curtis,
Yes i use inv 2009 (work) and 2010 (home) !
I should have remembered about not being able to create string parameters.
However the original question was "how to create multi-value parameters with ilogic" and I can create a
ilogic parameter from the ilogic parameter editor , this allows me to choose from types User, String or Boolean.
So i believe the code will work with a little "tweaking" so that it creates a ilogic not a user parameter
thanks for the reply ![]()
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks, that helps a lot. I knew how to make a text parameter and for some reason thought that it had to be a multi-value list at creation. it never occured to me to try just adding the list afterwards.
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi ![]()
this rule work really great in text unit but i try to put my new parameter in inch?
This is my try, sorry for my horrible english ![]()
but dont work ![]()
Thanks for your help ![]()
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 oAwesomeParameter As Parameter
Try
otester = oUserParams.Item("ÉPAISSEUR")
Catch
oInsulationType=oUserParams.AddByValue("ÉPAISSEUR"
MultiValue.SetList("ÉPAISSEUR", "1/32", "1/16", "1/8", "1/4", "3/8", "7/16", "1/2", "9/16", "5/8", "11/16", "3/4", "13/16", "7/8", "1", "1 1/4", "1 3/8", "1 1/2")
End Try
End If
Parameter.Param("ÉPAISSEUR").ExposedAsProperty = False
Parameter.Param("ÉPAISSEUR").IsKey = True
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
another question ![]()
it'S possible to add a <custom value> in MultiValue.SetList
ex.:
MultiValue.SetList("CHANTS", "AUCUN", "1C", "1L", "1L-1C", "1L-2C", "2L", "2L-1C", "2L-2C", <custom value>)
Thanks all ![]()
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
If you want to add an Inch based Multivalue list, then you can do so using this method :
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 oAwesomeParameter As Parameter
Try
otester = oUserParams.Item("InchParameter")
Catch
oInsulationType=oUserParams.AddByValue("InchParame ter", 1/16*2.54, kInchLengthUnits )
MultiValue.SetList("InchParameter", 1/16, 3/16, 5/16, 7/16, 9/16)
End Try
End If
Parameter.Param("InchParameter").ExposedAsProperty = False
Parameter.Param("InchParameter").IsKey = True
If you want to add custom values, you can, BUT they will not work correctly if the parameter itself is of a different unit type! A parameter with kInchLengthUnits, will not enjoy if you select text from the multivalue list (even though it will allow you to put it there).
If you need to add numbers and text, then I would suggest keeping kTextUnits and use a Select Case statement if there will only be a handful of selectable options.
Side note: when you put things in quotes (“11/16” or “400*2” or “Jimmy”) the compiler interprets that as text input. That is why you were having your problem above.
Side note Part 2 : Do you need to have the value show as “11/16” instead of .6875? If not, then you could just make it a MultivalueList text parameter (“.6875”, “.875”, “Some Text Here”) and use the
IsNumeric(Parameter) method to check if the selection is a valid number or not. Using IsNumeric on an expresion like “11/16” returns false, so if you pre-converted them out of fraction to decimal, it may help you in the long run.
If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.
Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Re: Create Multi-valu e parameter with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
ok i understand, but what is the right rule to tell in my multivalue parameter the <custom value>??



