I’d like to build my script in a way it can work in both milimeters and inches. So it can match the Rhino units when using milimeters or inches. I could think a way how to do it, as shown below, but I’m wondering if there’s a better solution. Having two input numbers, one in milimeters and other in inches, it’s not very practical.
Well, Grasshopper doesn’t support units. That means you should make sure to compute things in one unit system and only modify the input and output boundaries of your definition. Mixing units inside your logic is always risky. I would prefer SI units for scientific computation, freedom units for users located in the wild west But your example does it already like this. Unless you script it there is no better way. You could wrap it into a cluster which has only the purpose of unit conversion. Even if unit conversion is just about multiplying a factor and adding an offset (for some units), wrapping it into unit conversion component/cluster increases readability. Another advice is to clearly use a param component to separate the in- and output from your computation. Then you name it $what_$unit e.g. depth_mm.