Weaverbird from Python


Hi Giulio @piac

I’d like to use Weaverbird directly from Python. Is there an example how to use it?
Or a documentation with functions, arguments etc.?

(Giulio Piacentino) #2

Hi @Jess

thanks for the question here :slight_smile:

If you are aiming for a simple interaction, you can use the method shown on the GH forum. It has access to all components:

You can use ghpythonlib.components.

import ghpythonlib.components as ghc
ghc.WeaverBird. #... will show Wb commands

There are also other methods, but this is the simplest one. Does it help?


Giulio Piacentino
for Robert McNeel & Associates

(Giulio Piacentino) #4

You can install it by running the installer. Then you will need to add the Weaverbird installation folder to the V6 Grasshopper settings, using the _GrasshopperDeveloperSettings command. You should add “C:\Program Files\Weaverbird” there. ghpythonlib should also work in V5, provided the latest GhPython is installed.

If you still have problems in V5, check that you do not have a lot of other add-ons (I know one that makes loading other add-ons impossible in V5).

I hope this helps,


Giulio Piacentino
for Robert McNeel & Associates


Hi Giulio,

Thanks that helps. I’ll try to make a simple Python example with some WB functions and post it here.



Fine, here a simple example with Weaverbird via Python:

import Rhino
import ghpythonlib.components as ghc
import scriptcontext as sc

def wbTest():
    plane = Rhino.Geometry.Plane.WorldXY
    width = 5.0
    sides = 3
    top = Rhino.Geometry.Point3d(0,0,10)
    mesh = ghc.WeaverBird.WeaverbirdsMeshPrism(plane,width,sides,top)
    cc = ghc.WeaverBird.WeaverbirdsCatmull_ClarkSubdivision(mesh,2)
    rc = sc.doc.Objects.AddMesh(cc)
if __name__ == "__main__":

enjoy :wink:

CreateRefinedLoopMesh, CreateRefinedCatmullClarkMesh bugs

I remember looking into accessing the Weaverbird core .dll a while back (similar to how we’ve been implementing Kangaroo2, Plankton etc), would this be one such approach?


(Giulio Piacentino) #8

Yes, exactly, but they are not so straighforward, because they were not written with Python in mind (nor third-parties in mind).