Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I have just started learning ghPython and have recently run into a problem. I was writing some set of rules to get a certain value as the output however, the result doesn't come out the way I wanted it.

As you can see above when the c = 90 and b is circle, the number should be 3, 4 or 5 but the result shows -0.2. Can someone explain to me why it doesn't work? Thank you. I really appreciate your help.

Views: 74

Reply to This

Replies to This Discussion

Hi Xavier,

first of all, it's probably a better idea to only use ASCII identifiers, because we are using Python 2.

https://stackoverflow.com/questions/2649544/unicode-identifiers-in-...

About the rest of the issue, it is difficult to tell because anything below the code screenshot you posted could modify the value of Cpe. An "if" does not exclude another.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi Giulio,

Thank you for your reply and thank you for telling me about the greek symbols. I've changed it to an ASCII identifier and it's currently working well.

Hi Xavier,

I second Giulio's suggestion on the identifiers. Greek characters might cause issues.

Furthermore you have a statement

if a==a:


I'm pretty sure that's not what you want to write there.

I've included an example to display that your ifs do not exclude each other.

Best,

M

Attachments:

Hi Marios,

Thank you for your reply and thank you so much for your advice. I've change the a == a bit and the component is working well. Thank you again for your help.

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service