Grasshopper

algorithmic modeling for Rhino

I know python pretty well but I haven't really used rhinoscript/common.

I use python often just to sort/juggle data, but I haven't been using it to create geometry. As I started to read about it, I keep finding different ways of doing it, but I am not sure I understand which/when I should use.

All 4 methods below work. 

I understand the ghpython would be the same as using a gh component, but what about the other 3. What is the advantage/disadvantage of using rc vs rs?

And which one is sc using?

Thank you in advance!

#rhino common

import Rhino as rc
a = rc.Geometry.Point3d(0,0,0)

#rhinoscript

import rhinoscriptsyntax as rs
b = rs.AddPoint(2,2,2)

#Uses GH Component

import ghpythonlib as ghlib
c = ghpythonlib.components.ConstructPoint(3,3,3)

#Uses(?) Looks like rhinoscript

import scriptcontext as sc
b = sc.doc.Objects.AddPoint(1,1,1)

Views: 785

Replies to This Discussion

Hi Gui

all options you mention are valid. They are just different modules for different levels of scripting. Each has some advantages or disadvantages, or should rather not be used in a scripting context.

Here you go:

# rhinoscriptsyntax

It is my favorite alternative for scripting. Procedural, with a shallower learning curve, and powerful, it is built on top of RhinoCommon.

# RhinoCommon

It is a valid scripting option. Does not use an implied document, but geometry is kept in variables.

#ghpythonlib

Useful for people who are very used to think in Grasshopper terms. Good to transition from GH to Python, but rather limited otherwise. Does not support datatrees.

The last option is just a way to access the rhinoscriptsyntax entry point for RhinoCommon, and I don't think it's very useful. It is used to manually move geometry from variables/memory to the current document.

I hope this helps

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

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service