Mantis Shrimp is a Dynamo (Revit) and Grasshopper (Rhino) interoperability project that allows you to read Rhino’s native *.3dm file type as well as export geometry from Grasshopper. It is written in Python in form of a user objects (on Grasshopper side for exporting) and custom Python nodes (on Dynamo side for importing). It’s an OPEN SOURCE project with all of the source code available on GitHub. At the moment it’s a collaboration project between myself and Mostapha Sadeghipour.
I decided to make this project an open source for multitude of reasons but most importantly because it was written on top of Dynamo (an open source project) using OpenNurbs (an open source project) and inspired by Rhynamo (an open source project since December 2014), and finally I was helped along the way by Mostapha who’s almost never written anything that he didn’t like to share. I think i got the “bug” – not Ladybug – for sharing from him.
This should be considered for those who sell online, especially when selling generic drugs online.
Here’s how to get started with Mantis Shrimp:
- Mantis Shrimp is written as custom Python nodes using OPENNurbs library provided by McNeal (Rhino makers) so you will need to make sure that RhinoCommon.dll is in the specified location as well as pickle.py for de-serializing geometry. By default if you have Rhino installed on your machine the RhinoCommon.dll will be located in C:\Program Files\Rhinoceros 5 (64-bit)\System so that should not be a problem. Pickle is part of Iron Python so adding a reference to default IronPython library folder should make it work. Sometimes Rhino can be installed in a different location if its an evaluation copy so I added few more paths that will be checked by default:
- C:\Program Files\Rhinoceros 5 (64-bit)\System\RhinoCommon.dll
- C:\Program Files\Rhinoceros 5.0 (64-bit)\System\RhinoCommon.dll
- C:\Program Files\McNeel\Rhinoceros 5.0\System\RhinoCommon.dll
- I am usually also referencing in System.Collections module for dealing with Arrays and Lists so that’s what you see in the code snippet below.
- PS. I am posting this so you can check your IronPython folder location and see if you have pickle in there otherwise you would have to download it. Also, check if your Rhino was installed at the provided location since its a default location I am assuming it is, but if you have specified a custom location for either IronPython/Rhino then make sure to update the following code in your nodes.
- Just like I mentioned above Mantis Shrimp is written in Python so you will need ghPython plugin for Grasshopper. You can get it from here:
- Once we have that part covered we can jump to Grasshopper. That part now consists of multiple user objects so the best way to get them all is to install Mantis Shrimp from a Dynamo Package Manager. They will be located in the “extra” folder of your package:
- C:\Users\yourUserName\AppData\Roaming\Dynamo\0.7\packages\Mantis Shrimp\extra
- You can either drag and drop those *.ghuser files onto Grasshopper canvas or copy and paste it into the following location:
- C:\Users\yourUserName\AppData\Roaming\Grasshopper\UserObjects. Remember to replace the username with YOUR username. You can also access it by going to Grasshopper’s File>Special Folders>User Object Folder:
- There is also one more file called mantisshrimp.py in that “extra” folder. Please do not move that file as all of the GH nodes will be reading from it for conversion methods.
- Once you do that, you will find a new tab in your Grasshopper UI named archi-lab under which there will be a component called Mantis Shrimp Export. Drop it on canvas. It takes three (3) inputs.
- _geometry – input any geometry that you wish to export to Dynamo
- _filePath – input a local file path with a file name and extension that you wish to save the exported geometry to (file extension is not important. i am using *.geo but it can be anything)
- _export – input a Boolean Toggle set to True to run an export
- All of the other Import components are pretty similar so you should have no trouble understanding how to use them.
- Now we need to make sure that our Dynamo import nodes are all available. There are three ways you can get all of the nodes into Dynamo:
- One is to download all of the custom nodes from GitHub and paste them into the Dynamo folder like so:
- Another is to download/install them through Package Manager: Search for “Mantis Shrimp”. This is the easiest and preferred method. It will also download all of the Grasshopper components as mentioned above.
- Finally you can simply copy and paste code from GitHub into a custom Python node. I do that quite frequently for testing purposes as you can’t see errors for a Python node that is wrapped inside of custom node.
This should be all you need to make sure/do to get started with Mantis Shrimp. In next post i will explain in greater detail how to export/import your first geometry samples.
Amazing.
Need to try.
Thx.
Conrad, Great to see your work here. keep it up!
Hello Konrad,
I am trying to get some geometry across from GH to Dynamo; Mantis Shrimp looks very promising.
I have a smaller issue with it: with every import I get the units used in rhino as the first element in my lists.
Could you please have a look into how this could be avoided?
Thank you.
Attachment: Capture1.jpg
I believe you can just download the latest mantis shrimp from package manager and that will not be there. I think i fixed that a while ago.
Thanks for your prompt reply Konrad.
I have been working with the very latest version. I also did a complete reinstall of Dynamo and Mantis but the problem remained.
There is another problem I would need your help with as well:
If I import the same curve through grasshopper and Rhino I get two different curve types in dynamo. The one via grasshopper gives a polycurve which seems less usable for generating revit geometries.
Thank you,
Gergely
Attachment: Capture2.jpg
In the meanwhile I found the solution for the first problem:
I used the grasshopper user objects I downloaded from github. Once I replaced those with the ones from the dynamo folder the units are no longer in the list.
But the second problem is still there.
Hello!
I am trying to install Mantis Shrimp from the Package Manager in Dynamo but it doesn`t install the .ghuser files. the EXTRA folder only has mantisshrimp.py and rhPath files.
I tried this on two different computers and its the same. However in Dynamo the components seem to be there.
Then in Grasshopper I tried to manualy install them from Github but the components are red and i get the error message that mantis shrimp module doesnt exist
Ok i think i fixed it. I checked the script inside a GS component and it was looking for the wrong filepath of Dynamo 0.7.
I just changed the name to : \Dynamo\0.8\packages\Mantis Shrimp\extra and apparently th error is gone.
However, Package Manager install option still doesn`t download the GS components anymore so i could only get it from github
Sorry, but that doesn’t exactly fixes the issue. This post is quite old. There were changes to Mantis Shrimp that this post doesn’t talk about. Anyways, you install it from Package Manager. That takes care of Dynamo portion. Then in \Dynamo\0.8\packages\Mantis Shrimp\extra there are Grasshopper user objects that need to be moved to UserObjects folder for Grasshopper. That should do it.
Thanks for the reply! The problem is that i dont get any grasshopper user objects in the extra folder after installing with the Package Manager. I only get mantisshrimp.py and rhPath files. Do you know what could be the reason of this?
Hang in there Constantin, I am planning on doing an update to Mantis Shrimp for 0.9 version today and those Grasshopper objects should be back. I might have removed them by accident and didn’t even realize until now. My bad.
Ok Konrad! Looking forward. Thanks!
check out package manager for latest mantis shrimp. it should work with 0.9 as well as all grasshopper user objects are back. good luck!
Yeah they are back now but when i installed it told me that it can only work with 0.9 version of Dynamo . I know that this not yet released but can be downloaded as a final beta. I guess i can try it like this for now.
I thought that was the idea – that it works with 0.9. Besides, its not like they will roll Dynamo back. 0.9 is here to stay and its probably the last stable release before Autodesk decides to release it as a full fledged application in version 1.0. It’s just a matter of time.
I think that Mantis Shrimp has a huge potential and is the fastest and easiest plugin i have seen so far that creates this connection. It can increase the productivity alot. I am a Rhino user but i want to learn Revit and I hope this tool can help me using the best of them. You are doing an amazing job!
Thanks!
Hello its me again. I noticed a problem with the Read GH file when i try to send a circle.
On the component list i see Rhino.Geometry.Circle but i cannot use it further and nothing appears in the preview. Then In GS i created a surface by the circle boundary and send it again.
On Dynamo it appears as a rectangle surface instead of circular.
Thanks for reporting i will check it out.
Hello, I have a probelm when I first time use mantis shrimp export in GH. I drag the node onto the canvas, but it shows error which is ‘1. Solution exception:No module named mantisshrimp’. I dont know if it is the problem with installation or the version of those plug-in.
My GH version is 0.9.0076
My dynamo version is 1.2 (whihc means my user objects follow that updated version?)
Have no idea about how to fix that,
Thanks