Grasshopper

algorithmic modeling for Rhino

Hey guys,

I want to know how to use the GH_Point method in python instead of using rs.AddPoint.

For example:

MyList=[]

for i in range(50):

    pts=rs.AddPoint(i,0,0)

    MyList.append(pts)

   

How can the rs.AddPoint and the append to MyList procedure  be replaced with the GH_Point method??

Thank you in advance!

Nicholas

Views: 494

Replies to This Discussion

Hi Tom,

Thank you very much, it worked perfectly.

Nicholas

Quick best practice/tip: I would advise against using the from foo import * style. This not only makes it difficult/impossible to trace the namespace/module a function/class comes from, it can also lead to name conflicts if two (or more) namespaces have an object with the same name etc. More to the point though, within the context of GHPython, you'll be robbing yourself of what little intellisense we do have ;)

The current style I (and I think most of us here) use would be something like (you could of course also import child namespaces):





 

I agree. That said, dynamically typed doesn't necessarily imply not being explicitly (as in not being ambiguous) typed (such as in the case here). I personally wouldn't use a statically typed language unless I will be compiling (for the benefits of speed, modularity and compilation errors), but I can certainly see why others would (again, personal preference does matter).

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service