We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad Python API
About automating tasks in Archicad using the Python API.

Experimental Python add-on is available for Archicad 23

Akos Somorjai
Graphisoft
Graphisoft
Hi folks,

See the blog post on the developer site: https://archicadapi.Graphisoft.com/experimental-python-add-on-for-archicad23

Good luck!

Akos
86 REPLIES 86
Joe Putnam
Booster
Sure thing,

https://github.com/mcneel/rhino.inside/tree/master/CPython

The example shown in the readme seems to fail (dll import error on one of the rhino header files) when you call the curve command .In order to get it to work for the commands that I tried in the screencap you have to re-import os after almost every import statement. This appears to be an issue with the python interpreter running in archicad. The example runs fine on python outside of archicad so I am certain my PATH is correct and everything is properly installed. It would be great if this could run as well as it does in Revit.... That example is pretty amazing. Although I would still love to see .NET running in Archicad, maybe Core profile as it runs cross platform and is about to superseded all previous versions.....

https://github.com/mcneel/rhino.inside/tree/master/Autodesk/Revit

As far as other issues with the python interpreter in archicad I think it needs more work as it also runs, but times out out on the basic Tensor Flow example. Being python it would be a real shame if the top machine learning libraries where not working to their full benefit.

Joel
Laszlo Nagy
Community Admin
Community Admin
Thanks, I was wondering if you are in fact developing a Rhino Inside ARCHICAD solution, that is why I was asking.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
Joe Putnam
Booster
its something that interests me for sure but the library doesn't work properly in archicad..... I will continue to explore it as i think it is very valuable as our main design platform is rhino and anything that can save duplication of work is very much worth exploring.

EDIT:
To be fair I do not believe that the python version of RhinoInside is nearly as complete as the c# counterpart, but with McNeel this is simply a matter of asking them to flush out the functions you need and they generally will push something out in fairly short order.

joel
leceta
Expert
Well, to be correct, there is no such Python version of RhinoInside (I'm sure Joel Putnam is aware of this, but maybe it is misleading for other readers). Let me explain some points, based on what I know so far

McNeel is currently developing different technologies in parallel, all them have in common that they aim to offer Rhino3D's geometry capabilities to other contexts different to Rhino.:
  • Rhinoinside is directly associated with .net framework and it is being used as a technology to run Rhino and grasshopper literally as plugins in host applications. At github we can find some demos for BricsCAD, AutoCAD... and in particular they are developing (mainly by Kike Garcia from McNeel Barcelona) a connection for Revit. This development basically consist of creating GH components that mix rhinocommon and Revit API. The outcome is something similar to grasshopper connection, but much faster since Graphisoft's connection plugin is using, AFAIK, Rest for inter-application communication. With RhinoInside, virtually is like having Rhino (and GH) inside Revit, both running on the same thread. Its quite spectacular
    https://github.com/mcneel/rhino.inside
  • Rhino3dm: this is another technology that makes it possible to create and edit 3dm files without Rhino. They have different flavors of rhino3dm (.net, python, javascript).
    In their words: provides a geometry library with 3dm file import/export capabilities. Rhino3dmIO is a trimmed down version of RhinoCommon that wraps the OpenNURBS (C++) toolkit and works independently of Rhino.
    If I'm not wrong, Rhino3dm does not need a Rhino license to be used. It is for free. This is the library that Joel was using earlier in his post, and as hi said, it lacks lots of advanced functionalities (loft, sweep,...)
    McNeel also suggest that "Use [rhino3dm] as a client to make calls into the Rhino Compute cloud server for advanced manipulation of geometry objects", which take as to the next point
    https://stevebaer.wordpress.com/2018/10/15/rhino3dm-geometry-toolkits-for-net-python-and-javascript/
  • Rhino.Compute: This is not free (you need Rhino license and its only available for Rhino 7 WIP) and it has wraped many more Rhinocommon classes than rhino3dm, in particular, almost the entire Geometry Class is accessible, which happens to be the most interesting part of Rhinocommon.
    This technology uses rest api to talk with a remote server that offers rhinocommon as a service, so operation are executed remotely.
    Rhino.Compute can be used with .Net, python and Javascript. So, now that we have python inside Archicad,(well kinda) Rhino.Compute is also available for us Archicad community.
    https://developer.rhino3d.com/guides/rhinocommon/compute/compute-getting-started/
I hope that this has clarified things for people not familiar with current McNeel developments.

Please, take into account that I'm not a professional programmer nor related to McNeel or Graphisoft, so some technical aspects could not be exactly as I have understood.
leceta
Expert
Junichiro Horikawa has an excellent intro video for Rhino3dm and rhino.compute using Python
Laszlo Nagy
Community Admin
Community Admin
leceta wrote:
  • Rhinoinside is directly associated with .net framework and it is being used as a technology to run Rhino and grasshopper literally as plugins in host applications. At github we can find some demos for BricsCAD, AutoCAD... and in particular they are developing (mainly by [censored] Garcia from McNeel Barcelona) a connection for Revit. This development basically consist of creating GH components that mix rhinocommon and Revit API. The outcome is something similar to grasshopper connection, but much faster since Graphisoft's connection plugin is using, AFAIK, Rest for inter-application communication. With RhinoInside, virtually is like having Rhino (and GH) inside Revit, both running on the same thread. Its quite spectacular
    https://github.com/mcneel/rhino.inside


Thanks for the explanation.
I have a question. So RhinoInside is based on .NET? Does this mean that it can be used only by Windows applications? Or is it possible to make RhinoInside work with Mac applications as well?
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
Joe Putnam
Booster
From what I know it is a pure Cython implementation, at least this library in python. It should run on Windows, Linux and Mac. I suspect however that only a subset would work on linux but the full RhinoCommon API should be possible in Windows and Mac.

Edit: I believe that a C++ version might be possible or available but I have yet to see anything or ask.
Joe Putnam
Booster
leceta wrote:
Junichiro Horikawa has an excellent intro video for Rhino3dm and rhino.compute using Python
This is not the same as RhinoInside. But great non the less.
Rhino3dm is a wrapper for open nurbs and is used in the Blender Importer we have been working on. (Linux, windows, and mac).

https://github.com/jesterKing/import_3dm

Compute is great but it assumes that you have a network connection. What is promising about RhinoInisde is that it is a direct connection to the host application and the all of the Rhino API functions(including grasshopper)
leceta
Expert
I have a question. So RhinoInside is based on .NET? Does this mean that it can be used only by Windows applications? Or is it possible to make RhinoInside work with Mac applications as well?

well, there is Mono Project, thats port .NET application to other platforms (like unix/mac).

There are also "things" like USharp, a plugin for unreal (C++) that makes it possible to write C# code with .NET libraries inside Unreal. This way now there is a possibility to use RhinoInside from Unreal.

So, I really don't know, but it seems that "something" can be done for making RhinoInside usable in Archicad for windows (maybe even Mac?).

Someone could write a C# interpreter for Archicad, but this probably will never gonna happen.

https://github.com/pixeltris/USharp
https://www.mono-project.com/
leceta
Expert
"Compute is great but it assumes that you have a network connection. "

In the video it shows how to install rhinoinside as a service locally and then using localhost IP, so response times are better.