Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Phantom math - values changing without reason

3 REPLIES 3
Reply
Message 1 of 4
Electrik
214 Views, 3 Replies

Phantom math - values changing without reason

I'm posting a simplified version of my problem. Basically, I'm creating a multi-value list for a parameter. The multi-value parameter was pre-existing in the IAM (its only values are 1, 2, and 3.) When the program is run, it sets the list (again this is a simplified version), and allows the user to choose a value. However: when the program is finished, the value of that parameter (in the Parameters box) is 1/6 of what was selected. If I choose one of the three legitimate values from the Parameters box, and then run the program, it will automatically multiply it by 6. In my real program, all comparisons and calculations work properly, other than this issue. I've pasted this simple logic to a new file, and get the same results.

This is it:

MessageBox.Show("RPM: " & Rotation, "First Line")
MultiValue.SetList("Rotation", 1, 2, 3)
MessageBox.Show("RPM: " & Rotation, "List populated")
'User enters RPM
	Rotation = InputListBox("Select max rotation speed", MultiValue.List("Rotation"), Rotation, Title := "Max Speed", ListName := "")
MessageBox.Show("RPM: " & Rotation, "Choice made")
InventorVb.DocumentUpdate()

Here's a screenshot of me selecting "2" from the list", it's acknowledging the "2", then the value in the Parameters box being 1/3. What am I missing????

This is Inventor Pro 2021.

 

Electrik_0-1684253234716.png

 

 

 

Inventor Professional 2021
Vault Professional 2021
3 REPLIES 3
Message 2 of 4
WCrihfield
in reply to: Electrik

Hi @Electrik.  I could be wrong here, because I haven't checked the math yet, but I think it is understanding the raw numerical value in your rule as 'database units', instead of document or parameter units.  And since RPM's is a unit of Velocity, and the only metric variation of Velocity units is Meters Per Second (mps), I assume that is the units your raw numerical value is being understood as.  If not, then since centimeters is the database units for length, it may be based on centimeters instead of meters.  Never dealt with RPM units in Inventor before though.

I can replicate this behavior in 2024 version too.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4
Electrik
in reply to: Electrik

Well, look at that! I think you're on the right track, because if I change the parameter Unit/Type to be unitless (ul), everything stabilizes, and there's no more automatic conversions. Thanks for the direction!

Inventor Professional 2021
Vault Professional 2021
Message 4 of 4
WCrihfield
in reply to: Electrik

This is certainly an interesting find.  I still haven't figured out what units it believes you are entering in the iLogic rule to get to that value in the Parameters dialog.  One thing you can do though if you want to keep the RPM units in the Parameters dialog, is use the parameter's Expression, instead of its Value.  When supplying something to the Expression as a String, it is taken literally, with no units conversions, just like you typed it directly into the equation cell of the Parameter in the Parameters dialog.  I use that quite a bit to avoid the confusion where possible.  But that would require getting the actual Parameter API object, not just a blue local parameter name or with the MultiValue snippets.  There is a snippet close to that though:

Parameter.Param("Rotation").Expression = "5 rpm"

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report