Grasshopper

algorithmic modeling for Rhino

hello,

I have a question about loops in gh.python.

The loop is supposed to do something until the input is y, in this case(print"why").however it doesn't do the tasks (print"why") until my input is "y".and then it will print all of them at once. I was wondering if there is a way to see the results each time I run the loop instead of waiting until it ends and then see them all together?!

  


while True:
x=rs.GetString("u happy?")
if x=='y':
break
if x=='n':
print("why")

Views: 3601

Replies to This Discussion

The ghpython component does not give the output, until the complete script is completed.

So my first guess is that it is not possible, but I'm not a specialist :).

Furthemore, it is perhaps better if you change the second if in an elif or else.

Best regards,

Bart

thanks for the reply,so far I am concluding that it's not possible either:(

Add a timer?

can you explain more?

apparently I shouldnt use the rhino command line with grasshopper,but is there any other way to write the code in a way to wait for an input each time it runs the loop(and also give me an output each time it runs it).

if I just get for example a number slider and connect it to my python component,it doesnt wait for me to change the parameter for each time it runs the loop(which in this case can cause into a crash)

Is that what you want?

Attachments:

oh this is really cool,I wish it could stop for the user to say ok,everytime that it would run the loop though.

The control of loop is "i<len(data)",You can replace it with anything you want.

You can't use rs.GetString() within the scope of the GHPython component, functions like these are developed for operating in the Rhino document or interface (or, you can, but you shouldn't have to). Instead, simply pass your string as an input parameter on your GHPython component.

hmmm,I want it to wait for my input each time,however if I just get for example a number slider and connect it to my python component,it doesnt wait for me to change the parameter for each time it runs the loop(which in this case can cause into a crash)

This has a parallel discussion on https://discourse.mcneel.com/t/loops-in-ghpython/42256/5

Please, Nazanin, refrain from contemporarily emailing me, and cross posting the same discussion on all forums. If you have to, please at least post a link.

I appologize, I did not now that these forums are related and the same people run them. I was trying to get as much feedback as possible. I keep that in mind.thank you for the suggestions

It seems that you are a novice like me, ha ha ha ha

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