I just discovered a nifty trick for accessing extension methods in (Iron)Python scripts. Namely, clr.ImportExtensions(). The example below leverages the extension methods that add Rhino/GH interoperability to Plankton.
"""Provides a scripting component.
Inputs:
m: an input Rhino.Geometry.Mesh
Output:
a: a bunch of face polylines"""
import clr
clr.AddReferenceToFile("Plankton.dll")
clr.AddReferenceToFile("Plankton.gha")
import Plankton
import PlanktonGh
# import class containing extension methods
clr.ImportExtensions(PlanktonGh.RhinoSupport)
# import mesh via Rhino.Geometry.Mesh extension method
pmesh = m.ToPlanktonMesh()
# TODO: do something exciting with our new halfedge mesh
# export polylines via Plankton.PlanktonMesh extension method
a = pmesh.ToPolylines()
Off the top of my head I had added the GH libraries folder to the Python
path in Rhino to make loading these assemblies less painful.
In Rhino 5, bring up the Python script editor (“EditPythonScript”), then go
to Tools > Options… and add %APPDATA%\Grasshopper\Libraries to the list
under the Files tab.