Plankton is a free and open library implementing the half-edge data structure for polygon meshes.
This way of storing the mesh connectivity information allows easier adjacency queries and supports mesh faces with any number of sides (Ngons), not just quads and triangles.
The plankton library is intended primarily to be referenced and used from scripts, but basic GH components for conversion and topology extraction are provided, and more may be added at a future date.
Plankton is still very much a work in progress. This is a first release, and methods/features will change in future versions.
Currently most of the methods relate to extracting topology information from existing meshes, and converting between Rhino meshes and Plankton meshes, but the intent is to over time add more ways of actually modifying and building meshes.
Please share your thoughts and ideas in the forum...
download the latest release here:
https://github.com/meshmash/Plankton/releases/latest
This library is distributed under the terms of the GNU Lesser General Public License (LGPL).
(The source is available on GitHub here)
Copyright 2013 Daniel Piker and Will Pearson
For more on half-edges, see:
http://www.flipcode.com/archives/The_Half-Edge_Data_Structure.shtml
http://openmesh.org/Documentation/OpenMesh-2.0-Documentation/mesh_hds.html
http://www.graphics.rwth-aachen.de/media/papers/directed.pdf
Thanks to the people I have had many conversations about meshes with over the last few years that have really helped inspire and inform this work: including: Daniel Hambleton, John Harding, Kristoffer Josefsson, Harri Lewis, Giulio Piacentino, and especially Dave Stasiuk, who also shared code that helped get this working.
Anders Holden Deleuran
Hehe, you've got it :)
Sep 17, 2013
Benjamin Felbrich
Hi Hi,
is it just me? I don't get it working in GH. The "CreatePlankton" turns red and says it couldn't find "Plankton, Version 0.2.0.0....." though I have copied the Plankton.dll and .gha in the components folder
Cheers
Nov 2, 2013
Daniel Piker
Have you checked that both the dll and gha are unblocked ?
Nov 2, 2013
Benjamin Felbrich
Oh dear,
now it works
Thanks a lot Daniel
Nov 2, 2013
Simon
Hi I get this message when I try to run Plankto, can anyone help
I have checked the permissions I think they're ok
1. Solution exception:Could not load file or assembly 'Plankton, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Mar 7, 2014
Simon
solved it, just put all the .gha and .dll files into the special components folder
Mar 7, 2014
Mathias Gmachl
The python plankton example Anders posted broke with v3. Would someone be able to update them to help me get started?
Mar 31, 2014
Anders Holden Deleuran
Hi Mathias,
Yes it looks one cannot simple pass a Rhino mesh when instantiating a Plankton mesh in the latest version. I have attached an updated example in which we access vertex/face list and add them to the Plankton mesh "manually". This seems to work. Hope that helps.
Best,
Anders
140401_PlanktonDemoPython.ghx
Apr 1, 2014
Mathias Gmachl
Hi Anders, thanks for the quick response. It works perfectly and you've taught me more Python. Hope you are well! Mathias
Apr 1, 2014
Daniel Piker
Hi Mathias, hi Anders, thanks for updating this.
It should be possible though to use Mesh.ToPlanktonMesh() in the latest Plankton
Apr 1, 2014
Anders Holden Deleuran
Hi Daniel,
Do you mean that a Rhino.Geometry.Mesh now has a method for converting it to a PlanktonMesh? If so, I'm not able to call it I'm afraid. I'm Running Rhino 5 SR8 64-bit (5.8.40305.11495, 03/05/2014), GH 0.9.0072 with the latest Plankton.dll and Plankton.gha installed. I'm doing good Mathias, likewise :)
Apr 1, 2014
Daniel Piker
Hi Anders - yes, but it needs both the Plankton.dll and Plankton.gha referenced (thanks to Will, there is now a clearer distinction between the mesh library itself, and the parts which interface with Rhino/Grasshopper). It works fine in C#, but I'm always getting mixed up with right way of importing references in Python
Apr 1, 2014
Daniel Piker
ok - this seems to work:
import clr
clr.AddReferenceToFileAndPath("C:\Users\Daniel\AppData\Roaming\Grasshopper\Libraries\Plankton.gha")
import PlanktonGh as pl
pMesh = pl.RhinoSupport.ToPlanktonMesh(mesh)
Apr 1, 2014
Anders Holden Deleuran
Thanks Daniel,
This does seem to make Plankton more tricky for Python implementation. In order to reference the Plankton.gha I renamed it PlanktonGh.dll and imported in the same way as Plankton.dll. This provides access to the RhinoSupport class which contains the ToPlanktonMesh() method, allowing us to call it in a procedural manor. This is not exactly pretty, but does seem to work. Attached the example from before.
Perhaps this is something for Giulio/Steve to have a closer look at. I have already suggested that the Grasshopper library folder be add..., but it seems that this could use some deeper thinking/planning in general (should we be able to import .gha files etc.).
Best,
Anders
140401_PlanktonDemoPython_Update02.gh
Apr 1, 2014
Anders Holden Deleuran
Edit: I see you already figured it out Daniel. I attached another version which assumes that the GH library folder is read by RhinoPython, but offers the perhaps least "ugly" method :)
140401_PlanktonDemoPython_Update03.gh
Apr 1, 2014
Giulio Piacentino
Hi guys,
right now clr.AddReferenceToFileAndPath is I think the correct method to use here. That .dll has to ultimately be added to the Python context. More in general, McNeel might want to add a new registration to AssemblyResolve for .gha files. Let's see also what Steve thinks.
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Apr 1, 2014
Mathias Gmachl
Thanks everyone for looking into this. I did see the ToPlanktonMesh command in the C# examples, but couldn't get it to work without the references.
In order to script Kangaroo functions like in the remeshing examples, I assume I need to reference the kangaroo .dll and .gha aswell?
Apr 1, 2014
Daniel Piker
Hi Mathias,
Yes - that's correct, the remeshing example uses some functions from GhKangaroo.MeshPhysics, so you'll need those libraries referenced. (I'm looking though at whether it might be better to keep all these functions in the .dll in future)
Apr 1, 2014
Will Pearson
It's all personal preference but here's how I do things (off the top of my head):
(Note that Plankton.dll and PlanktonGh.gha are in my Libraries folder.)
Apr 1, 2014
Anders Holden Deleuran
Thanks Will. That's certainly true. In your example "PlanktonGh" refers to the "old" .dll correct? The one which is now simply called "Plankton.gha"? In which case one has to use "AddReferenceToFile" as there are now two files with the same name, but different extensions (which I think I prefer actually). Anywho, just tried out the following which seems to work for importing all the dependencies for both Plankton and Kangaroo:
Let the digging begin :)
Apr 2, 2014
Will Pearson
Oh gosh, you're right. I've just realised I've got both Plankton.gha and the PlanktonGh.dll that Daniel packaged with Kangaroo... Sorry for muddying the waters!
Apr 2, 2014
Anders Holden Deleuran
Hehe, no worries. One of my main headaches with assemblies was always trying to figure out their actual name (as in, not the file name) and their actual content (available types), I just spent a little time looking into assembly introspection. Seems pretty straight forward, attached a small example. I suspect this could be useful for you Mathias. Best, Anders
140402_AssemblyIntrospection.gh
Apr 3, 2014
Mathias Gmachl
Thanks, Anders, you have been reading my mind. I've got some sleepless nights ahead.
Apr 3, 2014
Will Pearson
All, just pushed some documentation to pearswj.co.uk/plankton.
I'm deliberately trying something different (rather than the usual Sandcastle docs as used by Rhinocommon and Grasshopper) in an attempt to bring users closer to the code.
Sep 20, 2014
Lionel
Hello Will,
I've seen a little bit of what you do on Plankton ... and I'm interesting about the documentation you've pushed on your website !
I'm developing rhino & gh tools in my research lab right now and I'm seeking a way to document it in a "friendly" way for others.
How did you manage to make the doc on your website ? Is it auto-generated from a XML doc file (from VS) ?
Thanks in advance for your advice ...
Lionel
Nov 6, 2014
Will Pearson
Lionel, I added the XML comment parsing to an existing Python documentation program. It's a bit hacky. It runs on the .cs files themselves. Check it out below, instructions in the README.
https://github.com/pearswj/pycco/tree/csharp-xml-docs
Nov 7, 2014
Lionel
Tks Will !
I've manage to install pycco and it's dependencies. But I can't get it work properly ...
Is it working with python 3.4 or 2.7 ?
I get this error (see below) when launching the script from the consol on the Compass.cs file in a \src folder in the C:\Python34\Scripts\pycco folder
Any idea where it comes from ??
Thanks again,
Lionel
C:\Python34\Scripts\pycco>python pycco/main.py src/Compass.cs
File "pycco/main.py", line 484
print "pycco = %s -> %s" % (s, dest)
^
SyntaxError: invalid syntax
Nov 7, 2014
Lionel
I also tried to launch pycco on the pycco/main.py and got the same kind of error :
C:\Python34\Scripts\pycco\pycco>pycco main.py -p
lionel
Traceback (most recent call last):
File "C:\Python34\Scripts\pycco-script.py", line 10, in <module>
load_entry_point('Pycco==0.3.0', 'console_scripts', 'pycco')()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 353, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2302, in load_entr
y_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "C:\Python34\lib\site-packages\pycco-0.3.0-py3.4.egg\pycco\__init__.py",
line 1, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2164, in _find_spec
File "<frozen importlib._bootstrap>", line 1940, in find_spec
File "<frozen importlib._bootstrap>", line 1916, in _get_spec
File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
File "C:\Python34\lib\site-packages\pycco-0.3.0-py3.4.egg\pycco\main.py", line
484
print "pycco = %s -> %s" % (s, dest)
^
SyntaxError: invalid syntax
Nov 7, 2014
Will Pearson
Try Python 2.7. If you have any more questions can we discuss them elsewhere? Perhaps http://discourse.mcneel.com/c/uncategorized would be appropriate, or open a github issue :)
Nov 7, 2014
Lionel
Ok, I finally manage to make it work. Some thing was wrong with my python Install. Now it's working for both 2.7 and 3.4.
Tks,
Lionel
Nov 14, 2014
spiral
how to use the Plankton in order to build net (mesh) Chebyshev on the surface?
Apr 7, 2015
Daniel Piker
Hi Spiral - generating Chebyshev nets can be done in Kangaroo by fixing or equalizing the edge lengths, and draping over or pulling to some target surface.
Apr 7, 2015
spiral
Thanks Daniel, it is possible to make the edges of equal length? changing only the angle between them.
Apr 7, 2015
Daniel Piker
Hi Spiral, could you post this as a question on the Kangaroo group? It's easier than having a conversation in these comments.
Apr 7, 2015
Brendan
ScreenShot022.jpg
I cannot get plankton installed. I downloaded the shown files and placed them in my AppData>Roaming>Grasshopper>Libraries folder. I then restarted Rhino and opened Grasshopper and there is no Plankton tab.
May 4, 2015
Will Pearson
May 4, 2015
Brendan
Thanks, I found the components. What I'm trying to do is remesh the attached surface or other surfaces like it (it's a mesh) in hopes of flattening it using Rhino's Squish command. If there are any other, better methods using other Grasshopper components or Rhino tools or (free) plugins, I'm open to that as well.
sample%20surface.3dm
May 5, 2015
Dekani Fisher
The latest version from the link below is downloading the 0.3.0 instead...? i can't get the 0.3.4 version...
https://github.com/meshmash/Plankton/releases
plankton.PNG
Sep 7, 2015
Will Pearson
Dekani, you've got the right one. We just forgot to bump the assembly release number...
Sep 7, 2015
Dekani Fisher
Sep 7, 2015
Will Pearson
What problems are you having?
Sep 7, 2015
Dekani Fisher
HI thanks for your replies, i just had to unblock the dlls and they worked.
Sep 7, 2015
Will Pearson
Glad it's working for you now :)
Sep 7, 2015
josh lopez-binder
Hi all, Is anyone is using plankton for scripting on mac?
more specifically, for rhino python scripting?
I am considering trying it out, and curious if there are any tips/tricks known already.
Apr 13, 2016
Will Pearson
Apr 13, 2016
johnnyUtah05
Hi,
I am wondering how to draw hexagons/circles around clothed vertices by using their neighboring vertices distances. I have some confusion... Can this be achieved with 'Deconstruct Plankton'? (I assume yes, by getting the proper half edges).
Also, I have looked inside the 'Tangent Circle' component and see that it only measures the distance from two neighboring vertices. I believe this is why my result is imperfect. See below.
How can I tweak the tangentCircles component to achieve a more accurate result, or how can I use 'deconstructPlankton' to achieve this?
Thank you in advance. EriktangentCirclePLANKTON.gh
Aug 27, 2016
Gene Kao
Hi all,
We created an open source plugin "Leopard" using Plankton for internal mesh processing. We hope that this can be a good example to demonstrate the advantage using Plankton and help improve it.
More feedback and insights are welcome to discuss in Leopard forum.
Source code can be downloaded on GitHub.
Cheers,
Gene
Jan 30, 2017
Jay
This may be a really dumb question but how do I install the plankton 0.4.0 gha file. I've used grasshopper for a couple years now and normally just drag and drop. I have tried that, restarting grasshopper, restarting my computer and it never seems to load...??
Feb 10, 2017
Farah
1. Solution exception:Could not load file or assembly 'Plankton, Version=0.3.4.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
why does this happen? I have it download in pluggin folder, all 3 parts :(
Feb 26, 2017
Will Pearson
Farah – When/where are you seeing this error? Have you unblocked all the .dll/.gha files? (right-click, properties, unblock)
Jay – Plankton doesn't have very many components as it's mostly used for scripting. I wonder if this is why it seems not to be loading... There are a few components which can be found in the "Mesh" tab, under "Triangulation". Are these present?
Gene – Thanks for sharing! I'm really glad that you've been able to build something so cool on top of Plankton! I'll keep an eye on the Leopard forum/github in case there are any cross-over support topics that I can help with :)
Feb 27, 2017