Grasshopper

algorithmic modeling for Rhino

hi

I'm beginer of rhino, gh and python.

I'm trying to tag a list of 80 surfaces, in to two groups, A-1 to A-40 and B-1 to B-40.

So I tryed to use ghPython.

I writed the script,

import rhinoscriptsyntax as rh

if (x<y):
    print "A-"+x
else:
    print "B-"+(x-y)

but it thousen't work.

could somebody teach me how to solve this problem, or teach me different way to get a same result.

thank you.

Views: 695

Replies to This Discussion

Hi zeem, I don't know anything about Python, but you could just use an Evaluate component (Math > Script tab), with the expression:

If(x<y, "A-" & x, "B-" & (x-y))


I really love your avatar b.t.w.:)

Thank you!

I knew the Evaluate component but, I didn't know that it can use the IF.

it worked correctly.

and also thanks for praising the avatar :)

I founded it somewhere in the internet, it's lovely.

Hi zeem There was an error, strings and numbers can not be added Please Check the attached files

Attachments:

I'm sorry for replying late.

Why is the answer for the script above is a tree and the script below is a list?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service