algorithmic modeling for Rhino
Hey all -
While working on a project I came upon the need to do some unit conversion within GH, so I decided to write a script to handle this. I've attached it as a user object. It takes two strings, defining the input and output unit systems, in the form of "mm" or "in^2" or "yd^3" etc. It will then output the necessary conversion factor. It also optionally accepts a list of values, and will convert them for you if they are present.
A word of caution: I have not tested this thoroughly, so it may produce some weird results - but so far it seems to work for me. If you catch a bug, please let me know! Also, please pay attention to the "out" stream - it will alert you to an error if there is a problem with your input. Even if there are errors, the component will produce numerical output, so if you blindly trust the results without checking the error output you may be working with erroneous values.
Finally, if you take a look at the code, please don't judge too harshly! I am an entirely self-taught programmer, so I am sure my code is inefficient and messy and misses a lot of best practices. If you do see something that could be improved upon, let me know; I am always eager to learn.
Download it here: Unit%20Conversion.ghuser (or here: UnitConversion.gh)
cross posted at my blog: http://heumanndesigntech.wordpress.com
Comment
It wasn't my intention to create a heated discussion...but everytime I see people spending their time converting numbers I get mad.
Anyway really nice effort and plugin to GH. Without this kind of tools would be really complicate understand other people designs.
Best Regards.
Thanks Andrew,
Guess I missed this whole thread with the user object:
http://www.grasshopper3d.com/forum/topics/grasshopper-070030-available
Thanks Andrew,
It's the first time I hear about a .ghuser file! It's great thoguh, how did you save it as such?
The unit conversion script is a very political one ! A little English/French flag might be necessary as logo :) http://www.youtube.com/watch?v=9V7zbWNznbs
Could you post a print screen of how to use it?
Cheers,
Arthur
Danny you're so very English blaming Liberia ;)
I think the expression "Imperial Unit" says it all !
@Arthur, I would say it's not the Anglo-Saxons holding the metric system back. As you can see from the image below its Liberia in West Africa.
Countries by date of metrication. Colours red to green show the pattern of metrication from 1795 to 1998. Black identifies countries that have not adopted the metric system as the primary measurement system. White identifies countries that already used the metric system at the time they gained their independence.
Hi Andrew, Thanks so much for this very helpful tool which would deserve a plugin ! I changed the extension to ghx and opened it with GH 0050 but got the following error:
@Angel, I really agree with you and would love one currency too... But the metric system has one problem for the anglo-saxon: they believe it is french and moreover, imposed by Napoleon like being on the right side of the road...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by
You need to be a member of Grasshopper to add comments!