Is there a python library with the components from Grasshopper?

Is there a python library, similar to rhinoscriptsyntax, that contains Grasshoper’s components?

For instance Grasshoper has a “4pt surface” (Srf4Pt) component. But I could not find any such function in the rhino python package.

Yes, it‘s called ghpythonlib and you can import it like this for example:

import ghpythonlib.components as ghcomp

You then have access to (almost) all components as functions :slight_smile:

3 Likes

Instead of wrestling with the near obsolete ghpythonlib, you could simply use Rhino.Geometry.NurbsSurface.CreateFromCorners (cf. docs).

In some cases, ‘CreateFromCorners’ appears to be less sensitive to point sequence than Srf4Pt


CreateFromCorners_2022Oct28a.gh (8.0 KB)

import Rhino

a = Rhino.Geometry.NurbsSurface.CreateFromCorners(V[0],V[1],V[2],V[3])
2 Likes

Ruled surface component replicates exactly the same behavior as Srf4Pt component:

Rhino.Geometry.NurbsSurface.CreateRuledSurface


CreateFromCorners_2022Oct28b.gh (18.3 KB)

1 Like

Or more sensitive?

Less sensitive in the sense that a correct result is less dependent on the sequence of points.