To get COMPAS working in Grasshopper, you first have to follow the steps from Working in Rhino.
In Grasshopper, COMPAS is imported from within a GhPython component. Rhino for Mac and Rhino WIP+6 all come with their own GhPython interpreter, but if you use Rhino 5 in Windows, please download and install GhPython here.
To verify that everything is working properly, simply create a GhPython component on your Grasshopper canvas, paste the following script and hit OK.
import compas from compas.datastructures import Mesh from compas_ghpython.artists import MeshArtist mesh = Mesh.from_obj(compas.get('faces.obj')) artist = MeshArtist(mesh) a = artist.draw_mesh()
Reloading changed libraries
If you change a Python library during a running Rhino application, which is
imported in a GhPython component (e.g. via
it is necessary to reload the library so that the GhPython interpreter
recognizes the changes. To avoid restarting Rhino, you can use the function
unload_modules. The following example reloads the library
from compas_ghpython import unload_modules unload_modules('my_custom_library')