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
Thanks for the tool!...I hope some day everybody forgets their traditions and the units system become universal...
Humanity have lost important effort and money using international and imperial units system in the same works (spaceship lost, time in architectural projects...).
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!