Mesh Manipulation with Weaverbird and Cocoon

Installing the Weaverbird Plugin

You might not need this step if you are using an IDeATe laptop. To check whether Weaverbird is installed, run Grasshopper and see if you have a tab labeled "Wb".
  1. Weaverbird is a Grasshopper plugin. It is not installed by default.
  2. Download the following file to your Downloads folder: wb-0.9.0.1-yak-and-mac-install-def.gh.
  3. Open the file in Grasshopper (do not double click on it in the file explorer). This will install the plugin.
  4. Do File > New in Grasshopper to open a new canvas, and likewise in Rhino.

Installing Cocoon Plugin

You need this step on both the Andrew cluster machines and the IDeATe laptops. Coccoon will appear as an extra palette in the Mesh tab.
  1. Cocoon is another Grasshopper plugin. It is not installed by default.
  2. Download Cocoon.zip from BespokeGeometry.com.
  3. Extract the contents of the zip file. You should end up with a Cocoon folder containing four Grashopper definition (.gh) files whose names start with "coc", and one Grasshopper assembly (.gha) file called "Cocoon".
  4. Start Rhino and Grasshopper.
  5. In Grasshopper, go to File > Special Folders > Components Folder. This will open a file browser and take you to a folder whose path ends in "Grasshopper\Libraries".
  6. Move the extracted Cocoon folder containing the five files into this Libraries folder.
  7. Go into the Libraries\Coccoon folder.
  8. Right click on the Cocoon.gha file and select Properties. In the General tab, if there is an "Unblock" checkbox at the bottom (due to Windows security paranoia), check the box to unblock the file.
  9. Exit Rhino and run it and Grasshopper again.
  10. When you look in the Mesh tab, you should see a new palette named "Cocoon".

Creating an Organic Mesh in Weaverbird:

  1. In Rhino, go to Solid > Box > "Corner to Corner, Height" and create a rectangular box about 10x10x20 mm in size.
  2. In Grasshopper, insert at Parameter > Geometry component and set it to the solid box in Rhino.
  3. Insert a Parameter > Mesh component and connect the Geometry component to its input.
  4. In the Weaverbird (Wb) tab, insert a Wb > Transform > Picture Frame (wbFrame) component and connect the Mesh component to its M input.
  5. Create a Number Slider as 1 < 10 < 40 and connect it to the Picture Frame's D input. Try moving the slider to observe the effects.
  6. In order to better see the effects of later operators in Rhino, we're going to shift the result away from the input mesh. Create a Move component.
  7. Connect the output of the Picture Frame component to the G input of Move.
  8. Right click on the T input of Move and choose Set One Vector. In Rhino, click on a point a couple of lengths away from the result object.
  9. Create a Wb > Transform > Mesh Thicken component and connect the G output of the Move to the M input of Thicken.
  10. Create a Number Slider with 0.1 < 1.0 < 2.0 and connect its output to the D input of Thicken.
  11. Create a number slider with 0 < 0 < 2 and connect its output to the T input of Thicken. Play with the sliders to see what happens.
  12. Create a Wb > Subdivision > Catmull-Clark Subdivision (smoothing) component and connect the output of Thicken to its M input.
  13. Create a Number Slider with 1 < 3 < 4 and connects its output to the L input of CatmullClark.
  14. Create a Wb > Smoothen > Laplacian Smoothing component and connect the output of CatmullClark to its M input.
  15. Create a Number Slider with 1 < 2 < 4 and connect its output to Laplace's L input.
  16. Create a Boolean Toggle component (just type "tog" in the search box) and connects its output to Laplace's T input. Set the toggle to True.
  17. Bake the Laplace output and move it away from the Grasshopper output.
  18. In Rhino, use the View menu to select a Rendering view and admire your results.
  19. Save your Grasshopper program for use with the bunny in the next section.

Reducing a Mesh to Simplify It

  1. Download the StanfordBunny.stl file.
  2. In Rhino, do File > Import and import the bunny.
  3. Set the view mode to Shaded.
  4. Look at the underside of the bunny: there are holes in it.
  5. In Rhino's top ribbon, just below the Command line, select the "Mesh Tools" tab.
  6. Within Mesh Tools, find the leftmost icon of a person holding a shovel. Hover over that; it should say "Fill Holes". right click to select Fill All Holes in Mesh, select the bunny, and hit Enter.
  7. In the Rhino command line box, type ReduceMesh and hit Enter. Select the bunny. Reduce the mesh by 98 percent.
  8. Reduce it again, this time by 90 percent.
  9. Now feed the reduced mesh into the Weaverbird program you created earlier.
  10. Bake the result.

Exporting a 3D-Printable File

  1. In Rhino, select your baked mesh. Be sure to deselect the original imported mesh.
  2. Do Mesh Tools > Check Selected (the checkmark icon). Make sure Rhino tells you "this is a valid mesh". Otherwise, repair it.
  3. Do File > Export Selected > Save as type > STL.

Cleaning Up Meshes in Rhino

Sometimes a mesh has awkward triangles (very small, or extremely acute angles) that can cause problems for the Weaverbird code. Here is how to clean up problem triangles:
  1. Go to the Mesh Tools tab in Rhino.
  2. Find the Collapse Mesh toolbar (it's about in the middle), and examine its items by hovering over them.
  3. Select Collapse Faces by Aspect Ratio, which gives an interactive view of which mesh faces you will choose to erase from the mesh without opening up a new hole. Typically, any triangles with an aspect ratio greater than 7.0 should be collapsed. Hit Enter.
  4. Select Collapse Faces by Area. Play with the values to see which tiny mesh faces should be collapsed, if any. Hit Enter.
  5. Select Collapse Faces by Edge Length and, as above, play with the parameters to remove any tiny faces that shouldn't be there. Hit Enter.

Generating a Clean Mesh in Cocoon

Some meshes have bad triangulations, and you want to redo them to get a nicer mesh for input to Weaverbird. You can use the Cocoon plugin to resample a mesh.
  1. Download the airplane.stl file.
  2. In Rhino do File > Import and import the airplane.
  3. Create a Mesh parameter component in Grasshopper and do "set one mesh" to assign the airplane to it.
  4. Create a slider as 100 < 1000 < 5000.
  5. Create a Vector > Grid > Populate Geometry component.
  6. Feed the mesh to the G input of the PopGeo component, and the slider to the N input.
  7. Create a slider as 0.5 < 2.5 < 6.0.
  8. Create another slider as 0.5 < 5.0 < 10.0.
  9. Create a Mesh > Cocoon > Point Charge component.
  10. Connect the P output of the PopGeo component to the P input of the Point Charge component. Connect the two sliders to the R and S inputs to Point Charge.
  11. Create two more sliders as 0.5 < 0.5 < 5.0 and 0.5 < 1.0 < 5.0.
  12. Create a Parameters > Input > Toggle component and set it to True.
  13. Create a Mesh > Cocoon > Cocoon component
  14. Connect the output of the Point Charge component to the C input of the Cocoon component. Connect the two sliders to the I and CS inputs, and the Toggle to the E input.
  15. Verify that the M output of the Coccoon component contains two meshes, one much larger than the other.
  16. Create a Dispatch component to extract the larger of the two meshes to a Mesh parameter.
  17. Add a Transforms > Euclidean > Move component to move the selected mesh off to the side so it doesn't overlap the original mesh.
  18. Right click on the T input to Move and do "set one vector" to set the translation vector in Rhino.
  19. Bake the translated mesh.
  20. Try running the output through a Weaverbird smoothing operator (Catmull-Clark or Laplacian) and bake that.
  21. Now feed this mesh into the Weaverbird computation you created earlier to get an organic airplane mesh.
  22. In the Weaverbird computation, try changing the Offset Type slider from 0 to 1 and see what you get.

Tutorials on Weaverbird


Dave Touretzky