How can I write an expression like r = sqrt(A/pi) on grasshopper?

I don’t get it,
can someone write me a simple script like r = sqrt(A/pi) in either ghpython or evaluate/expression?

I know a little bit of python, but I’m not even sure where to start with the grasshopper/rhino integration

eval

2 Likes

You’ll only need to know very basic Python to be able to do the math, so you’re probably good there. Here’s a couple screen clips of it in C# (I don’t know python):


The script will more or less be setup for you, you just type your code:
image
Not that you asked but one thing that really hung me up was that you have to zoom really close to see these “+” and “-” symbols, that’s how you add/delete in/out parameters.

Another thing that gets lots of people is that they have to right-click and select the correct “type hint”. In this case, your ‘r’ will simply be a double.

I figured what the hay and tried to set up the python module as well. I stumbled upon this PDF link:

https://web.arch.virginia.edu/sarc6710/Handouts/whshops2020/rhino/workshop15images/pythonScripts11_5_20.pdf

tempMathExample.gh (8.5 KB)

1 Like