How to use MeshMachine or Kangaroo from Grasshopper within Rhino Python scripts?


I need to remesh more or less uniformly a mesh from inside a Python scripts running in Rhino. I already installed Grasshopper and the Kangaroo0099 version of Kangaroo (I was not sure the version 2 and up had MeshMachine in them?)
I seem to be able to write this import:

import ghpythonlib.components.MeshMachine as ghmm

but I don’t know how to create the MeshMachine object or how to feed it its parameters. I saw people calling Rhino from GrassHopper but can we do the other way around? If so, how?



Maybe @DanielPiker can suggest ways for this. However, I do not think that they can only use ghpythonlib, as most Kangaroo components cannot be used as single functions, but need to hold a state. I will let Daniel see about this.


Giulio Piacentino
for Robert McNeel & Associates

Hello @piac ,

It’s not a problem if I need to import other components in order to remesh my surface. What I see in: Dynamic-remeshing

is sooooo what I need! I hope someone can give me some advice if it’s at all possible?



Hi @bmartin,

This version claims to work from the command line. It could be easier to script that in the short term

Hi Bruno,

I’ve been meaning for a while to clean up the MeshMachine code and turn it into something that is easier to call into from other scripts, but it still needs some work. The code for the GH version is all on GitHub now:
I’ll maybe also put the source up later for the rhp that wattzie just linked above if that would help.

1 Like

That would be great thanks!

That would be really great. I bet it will make a lot of noise if you release a version of MeshMachine that could be used directly from Rhino. Without trying to pressure you :wink: , do you have any idea when you think this might be done?

Also, I know I said it but I think the old MeshMachine only worked from a B-rep… I don’t have a B-Rep, just a scanned 3D surface. Will it also work?



Hi all, sorry it took a while to get around to this. Here’s the source for the remeshing rhino plugin:

(apart from the interface this is mostly identical to : the MeshMachine Grasshopper plugin:
It could use some cleanup, but hopefully it is still of some use.

Also if anyone is just looking for the rhp itself, not the source, you can download it from here:

1 Like

Hello Daniel,

Thanks fo doing this! I have some questions though.

  1. When I tried building the solution, I have error messages about a missing PlanktonMesh component. Could you add something like a small Readme.txt to show where to get this and how to install it so I could build your solution?

  2. When I found it was not building, I tried using the MeshMachine files from the .zip you posted at:
    Triangular meshing
    I have installed the following files

  • MeshMachine.rhp
  • PlanktonGh.dll
  • Plankton.dll
    in my “…\AppData\Roaming\Grasshopper\Libraries” and unlocked them.

I cannot seem to be able to call MMTriangles from the Rhino command line?

I must admit I’m quite confused about the exact relationship between the Rhino/GrassHopper ecosystem and I don’t know how to install Rhino Plugins (.rhp files?) to make them runnable by Rhino. I found the following link:

but I don’t really know what to make of it? Is it even relevant?



Hi Bruno,

To install an rhp it should be possible to simply drag the file onto the
rhino window.

I’m traveling now, but will put some instructions on how to build from the
source soon

OK, I can now call it from command line!

Do you know how I can call it from the Rhinoscript command like:

rs.Command("_-MMTriangles _Selid " + str(surface) + " _Enter 3 _Enter")

The interpreter seems to do fine up to and including the surface ID but I cannot find how to Specify a Target Edge Length in the string I’m building for the rs.Command execution?


Hi @bmartin,

This seems to work:

import rhinoscriptsyntax as rs

surface=rs.GetObject("Select Object")

cmd="_-MMTriangles _Selid " + str(surface) + " " + str(EdgeLength) + " _EnterEnd"

It seems like this function differs slightly from other rhino functions, you don’t need to press enter after selecting an object (or feeding in the GUID). Just adding a space after it seems to work.

It works!