Open Source Generative Design Plug-In

Topology Optimization and the like. Preferably in Python, is their a good one available?


Not exactly a plug-in, but maybe have a look at COMPAS, an open framework for computational design.
It’s open-source, completely in python and has some neat extensions. It can also be used via Rhino and Grasshopper but also from other software or from the command line.

1 Like

Cool. I was under the impression that all plugins for grasshopper are written in c#? Are the standard libraries available for rhino available in python? The python editor in grasshopper is annoying to say the least…

Yes and no :smile: Most “real” plug-ins are written in C# or VB. Reasons are probably that it’s faster than python, that Grasshopper components can update themselves to the new plug-in version if the new .gha is installed, you can work in Visual Studio, yadda yadda.

But there are also a few things to note here:

  • There are Grasshopper plug-ins written in python and distributed as UserObjects. This is not quite so comfortable as distributing/shipping a C# compiled .gha assembly but it is possible. An example would be the legacy ladybug tools.
  • It’s now also possible to compile ghpython components in to a .ghpy assembly. This is basically a .gha but using python. With this, python plug-ins can be shipped as an assembly rather than UserObjects.

I hope I understand your question right.
If you mean “Can I use RhinoCommon in a regular Python script?” Yes, but only using the new Rhino.Inside CPython feature.

COMPAS gets around that because it actually defines its own datastructures/classes/types for geometry. When compas is used in Rhino, it can convert between its own formats and the Rhino formats. That’s the reason why COMPAS also works completely without Rhino.

Yes, you’re probably right. I’m already so used to the editor that I somehow found my peace with it. If you absolutely hate it, this guide about debugging ghpython in VS might be helpful.

Finally, here is some more ghpython goodness. I think it depends on how you define the term “plug-in” but these are at least very useful UserObjects written in ghpython:

Very cool. When I go to github how do I access the source code if only .gha files exist? I noticed that before also.

If only a .gha file exists, it’s probably closed source. In most other cases you will probably find a src folder with a Visual Studio Project (.sln) and the actual C# files in it (.cs).

Not sure exactly what might work for you. Using a non-python Topo plugins and surrounding those with your components may work too. There is more opensource links at the bottom:

  1. Ameba Topology Optimization Software
  2. Topological Optimization with Millipede
  3. More Millipede
  4. tOpos is a 3D Topology Optimisation for CUDA
  5. Here is a cool study done with RHino 5 and Python

You could contact Arjen, who has a lot of experience with TOpo and Grasshopper Open source:

TopOpt also comes with Open Source and Python 2.7:

ToOptix is Python using ToOptix Core

Vault Optimizatio with Iron Python and Grasshopper

All very cool! Having a hard time finding the source file for those, non gha that is. Also is there a way to simulate geometry in python? I have been using matplotlib mainly, 3D graphing.

Short of using rhino directly I want to simulate basic geometry in spyder ide and such

It depends on what you mean by simulate?

If you have Rhino 7 on your desktop, you can load all of RhinoCommon inside a CPython process: . This gives you all of Rhino and Grasshopper functionality within that process. This includes a completely headless operation.

If you are trying to serialize and deserialize Geometry objects that you allready have, you can use Rhino3DM libraries without Rhino present: . But, this does not have a lot of Geometry generation through interpolations or fitting.

Another way to to use Compute on the cloud to make calculations using HTTP requests:

Might any of those work?

Very cool thanks. So if I use cp python Rhino3dm library, can I visualize or render objects/geometry straight from my ide? I am using spyder/anaconda right now. Also the library really has all the functionality of rhino python?

For example where is the Rhinoscriptsyntax library? Basically I want the 3D modeling capabilities of rhino, the flexibility and packages of my python ide, and the full Rhinoscriptsyntax geometry library, before I eventually switch over to developing in c#

I’m pretty sure rhinoscriptsyntax is not available in Rhino.Inside CPython. You most likely have to use the RhinoCommon API.
If you want to get started with C# plug-in development, I strongly would suggest familiarizing with RhinoCommon anyway. Because that’s what you will have to use (and it is also a lot more powerful than rhinoscriptsyntax).

C# it is! A pain to switch over but oh well. I can’t see investing a lot of time in python with gh.

Rhino script syntax library is just an open source python library on top of rhino common. It is meant to emulate the old rhinoscript VB interface:

It is a good study on calling into rhino common.

1 Like

Of you want all the capabilities of rhino, then rhino.inside is the way to go.

Visualizing and rendering can be done with rhino.inside. Other methods require your own display framework.

This is where the decision becomes interesting. If you want rendering and display. And I expect you will want navigation and picking. Then the question is, why not write a plug-in for rhino. Or you can use rhino. Inside and bring up the whole rhino interface within you application. Of course you have control on whether toolbars show etc…

Rhino3dm does not create geometry, it allows you to access objects and save them.

Do you have an example? Again I am mainly trying to avoid moving to c# if possible. Thanks

But then again if the community uses c# then that is probably the way to go

Thank you Scott for clarifying. That means it would also be usable with Rhino.Inside if I’m correct?

It would really help if you would give an example of what you are actually trying to do. It’s not meant as an offence but without that it’s really hard to help you. There’s already a ton of links and examples in this thread - so what’s missing?
I am avoiding C# successfully since 5 years and up until now I always could do the things I wanted with python, too (slower, of course).

1 Like

Epic, what a savage comment! :raised_hands:

I’ve been avoiding it for about 2 to 3 years. I’m relatively “new” to coding in the regard to computer graphics, but pretty fluent in Python. About half a year ago I started learning/dabbling in C++. It’s complex, but far superior to .Net, Swift, or any of these semi-proprietary languages really, and fully compiled.
Pssst, you can extend Python with C++ to make it snappier. That’s why libraries like Numpy are so fast and beloved in ML. :wink: