Grasshopper

algorithmic modeling for Rhino

hi guys, I am a newbie in python, trying to get a basic understanding how Python works in GH. I tried to simply create a point and then loop in in Python. I tested the result, it says "execution completed successfully " however I cannot see the points I made in Rhino Viewport. did I miss something here?

Please see attached, thank you

Views: 368

Attachments:

Replies to This Discussion

Hi Runnie,

I guess you have been scripting with RhinoPython Editor before moving over to ghpython components?
This is pretty common rhinoscriptsyntax issue people face when moving over from the first to the second one.
Check this reply for answer.

Basically you need to add your points to a list, then reference that list to ghpython's output parameter ("a" in this case):

import rhinoscriptsyntax as rs

pts = []
for i in range(0,100):
    pt = rs.AddPoint(i,0,0)
    pts.append(pt)

a = pts

hi djordje, thanks for your quick reply.

actually it is my first time trying to learn python, I have never used Python before so I only follow some tutorials on youtube, however, the beginner tutorial I could find is only python for RHino. which is why I have lack of understanding how it works in GH. thank you bro, any suggestion where to start to learn pyton for GH (beginner)?

also, I was thinking of trying python because I thought managing data (like data tree in GH) would be easier. and I can have more control over the data inside python. is python data tree more complicated than GH data tree? is it something that a person like me (I am an architect, have no basic of computerlanguage whatsoever) really needs to learn python from the very basic or learning how to manipulate data tree inside python would be just enough?

thank you

Well, there are far more sources for learning RhinoPython than ghpython, so in most cases people start with RhinoPyhon.
As for ghpython, to my knowledge, there's no written material. There are some video tutorials though:

- last three videos in Plethora project.
- all videos in Nature of Code for python.

There's no specific python data tree. Python has an access to Grasshopper SDK. So python uses the same methods VB.NET and C# use to create data trees. This topic pretty much summarizes creation of data trees in python. Still I would recommend to get a good understanding of python itself first, then check data treas. After all they are not that important for beginners.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service