Grasshopper

algorithmic modeling for Rhino

I created a small vb node (as a user object) that converts degrees to radians. 

I hope you will find it as useful as I do. 

 

Enjoy.

Views: 5763

Attachments:

Reply to This

Replies to This Discussion

Hi Monique,

 

Thank you for sharing. Also be aware that there is a function that you can use in the expressions that allows you to do this as well. rad() will convert degrees to radians and deg() will convert radians to degrees.

Below I've shown the example using the Fx component but it can be put into any input's expression where you might want to have degrees as the input but GH needs radians.

Thanks for the reply. I was aware of numerous ways of converting degrees to radians. I  just wanted to provide a shorter-shortcut. ;)

You can even use the degree symbol to convert a number from degrees to radians. So:

 

45º

 

becomes

 

1.7671458676442586966352369030947

 

I find it more readable that way.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

cool

Hi David, how can I do this in a component? When I press Alt (to type Alt+0176) the dialog closes. Is there another way to enter it? Thanks.

Darn, I forgot to add the level-1 expression parsing to those input boxes when I rewrote the system a few months ago. You're supposed to be able to use placeholder codes for weird characters like the degree symbol or the pi symbol, but they don't work. I'm fixing it now.

 

Here's the total list of placeholders and what they convert into:

 

'Operators      

code.Replace("**", "┴")      

code.Replace("<cross>", "┴")      

code.Replace("<crossproduct>", "┴")      

code.Replace("<outer>", "┴")

code.Replace("<d>", "°")      

code.Replace("<deg>", "°")      

code.Replace("<degrees>", "°")

code.Replace("<2>", "²")      

code.Replace("<square>", "²")      

code.Replace("<3>", "³")      

code.Replace("<cube>", "³")

code.Replace("<project>", "↓")      

code.Replace("<pull>", "↓")      

code.Replace("<push>", "↑")    

code.Replace("<dist>", "↔")      

code.Replace("<distance>", "↔")

code.Replace("!=", "≠")      

code.Replace("<>", "≠")      

code.Replace("<=", "≤")      

code.Replace("=<", "≤")      

code.Replace(">=", "≥")      

code.Replace("=>", "≥")

code.Replace("<almost>", "≈")      

code.Replace("<almostequal>", "≈")      

code.Replace("<approx>", "≈", )      

code.Replace("<approximately>", "≈")      

code.Replace("<similar>", "≈")      

code.Replace("~", "≈")

'Functions      

code.Replace("<sum>", "∑")      

code.Replace("<sumtotal>", "∑")      

code.Replace("<summate>", "∑")

code.Replace("<prod>", "∏")      

code.Replace("<product>", "∏")

code.Replace("<average>", "Ā")      

code.Replace("<mean>", "Ā")

code.Replace("<hmean>", "Ū")      

code.Replace("<harmonic>", "Ū")      

code.Replace("<harmonicmean>", "Ū")

code.Replace("<gmean>", "Ġ")      

code.Replace("<geometric>", "Ġ")      

code.Replace("<geometricmean>", "Ġ")

'constants      

code.Replace("<pi>", "π")      

code.Replace("<phi>", "φ")      

code.Replace("<inf>", "∞")      

code.Replace("<infinity>", "∞")

code.Replace("<1/2>", "½")      

code.Replace("<0.5>", "½")      

code.Replace("<half>", "½")

code.Replace("<1/4>", "¼")      

code.Replace("<0.25>", "¼")      

code.Replace("<quarter>", "¼")

code.Replace("<3/4>", "¾")      

code.Replace("<0.75>", "¾")      

code.Replace("<threequarters>", "¾")

code.Replace("<1/3>", "⅓")      

code.Replace("<third>", "⅓")

code.Replace("<2/3>", "⅔")      

code.Replace("<twothirds>", "⅔")

 

So you should be able to write:



 

45<deg>

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ok, thanks!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service