View Single Post
  #6  
Old 09-10-2014, 06:29 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Multi language mass table

Quote:
Originally Posted by papadam View Post
Kudos to Andy! Thanks to your help I got it to work! For the record I created a minimal example:
Good to know -- glad it's working for you!

Quote:
Originally Posted by papadam View Post
Although technically possible, I would not recommend this. Most metric users have kg as their mass unit. So if you convert the units you get 0.00000... kg/mm'3 which is confusing.

I could imagine to improve the above sample with a hard coded division by 1000. So in the above example you would enter
Code:
(list (sd-multi-lang-string "Aluminum" :german "Aluminium") 9.8)
and you would still get the correct mass. Is that possible?
Well, since Modeling internally stores density as g/mm^3, if you're going to use the conversion function, your starting value should be in the correct units.

I'm curious why you removed the sd-sys-to-user-units functions, as I believe they will answer your question and solve your problem. As long as you specify the value in the code correctly, the user will see it displayed in their current units.

For example, you could easily do this:
Code:
 :contents  (list
     (list (sd-multi-lang-string "Aluminum"  :german "Aluminium") (sd-sys-to-user-units :density 0.0027))
     (list (sd-multi-lang-string "Steel" :german "Stahl") (sd-sys-to-user-units :density .007861))
      )
In this case, your table would display "2700" if the user's units were kg/m^3, which is a nice clean number.

On the other hand, if you want to display the values using a fixed set of units independent of the units the user is using (such as always displaying kg/m^3 regardless of user units), you can just do the conversion using a fixed factor as well rather than the sd-sys-to-user-units function. Perhaps that's what you were doing by not using the function.

Finally, you can certainly scale the values that you're adding to the table if you want to do that. Just be sure when you use the value that you scale it in the opposite direction before using it.

It's also a good idea (especially if you use units that may be different from the user's units) to make sure your column is titled appropriately to show the user what units are being used. For example, in our Volume and Mass tool, we update the titles based on the user selections (they can change the displayed unit type as part of the dialog):



I hope this makes sense. Please let me know if you have more questions.

Thanks!

andy
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!
Reply With Quote