Ghpython Issues

I’m new to ghpython. I have two separate issues:

  1. I would like to do a simple written message with if statement:
  2. I’d like to add all volumes form the list and have one total number as a result from python.

Please can someone advise on these? Thanks!


to use GHPython correctly you need to set the values of inputs correctly in the component. Right-click on an x input on the component - and then you can set if you want to treat an input as a list, or the data type (for example float).

1 Like

perfect, that worked for the ‘sum’ example. However, for the ‘if’ statement it still does not work. Would know what might be an issue. Thank you in advance!

Did you switch “x” input to float there? If not - send the script, I’ll try it.

yeah, did that. something got changed and it worked now. thanks for your help!

You can also use “else” statement, so it will be more elegant than another “if”. This way it will also work for 50000, because right now if you have x = 50000, than it probably won’t print out anything.

1 Like

yep, good point, done it and worked thank you!