algorithmic modeling for Rhino

Hi all,

I was wondering if there is a way to access the karamba.gha via python? Is there an API for karamba? Or another way to get structured information about an assembled karamba-model. 

I'm currently trying to make a code where I store all my model-info in a .Json file, to then be able to interpret this in multiple FEM-packages, but I'm having trouble adding Mesh-loads. By disassembling a model in grasshopper, a structural line model is not a problem, the mesh-load however is not specific at all. It just gives:

"Mesh-load: Load(x/y/z) [kN/m2]; global; LC[x]; Area:xx[m2]; Resultant:(x/y/z)[kN]"

Nothing about where the load is applied. How would I go about extracting this information?

Kind regards,


Views: 597

Replies to This Discussion

Hi Merijn,

you can access the Karamba functionality via Python and IronPython. Both ways are described in the 'Karamba 1.1.0 Hacker's Essentials' (see The manual is not up to date, however you can use ILSpy to decompile 'karamba.gha' in order to see how it works. 

The MeshLoad-component is converted to point-loads on nodes and uniformly distributed loads on beams and trusses via the Assemble-component.

Using ILSpy you will see that there is a class 'Component_AssembleModel' and a class 'Component_AssembleModel_GUI'. The former performs the acutal task via the static method solve(), the latter provides the visual component. The easiest way to get the information from a MeshLoad would be to initiate the assemble process and then retrieve the load-data from the model.



Hi Clemens,

Thanks a lot! as always!



Hi Merijin,

I write here because I'd want to do your same process but passing from a .txt file.

I'm a very beginner of programming and I'm trying to use the GHPython component for write the model-info in a .txt file, but I don't understand how to do it.

I think the main problem is that I don't know how to get the informations. I downloaded the 'karamba_1_1_0_hackers_essentials' (linked above by Clemens) but in the Guide I don't find the python syntax.

For example I'd want to write in the GHPython component something that allow me to write for every node " 'Node' + str(ID) + str(XYZcoordinates)". I think I have to find a karamba function that gets the nodes coordinates, but I don't find it. I saw that there is a 'Displacement vector of the node' but I'm not able to call it.

I'm not sure, but I think that's the way that allow me to be able to get the informations and write it how I want.

I'm thinking wrong?

There is an easy way?



Hi Giovanni,

the 'Node'-class possesses the public property 'pos' which returns the initial position of a node. The property 'ind' gives you the index of the node.



Hi Clemens,

Thank you for the answer.

I searched 'pos' in the Guide and I find it in 'Fields' of 'Node Class'.

In the GHPyhton component after connecting 'Pt' from a 'Disassemble model' I write:

"import clr

clr.AddReferenceToFileAndPath("C:\Program Files (x86)\Rhinoceros 5\Plug-ins\Karamba.gha")

import Karamba.Nodes.Node as Node

print Node.pos"

but returns printed <field# pos on Node>.

How can I print that property correctly?

And an other question. I noticed that every class have 'Fields' and 'Properties'. They seems me quite similar, such as a kind of classes information.

What's the difference? I can get the information by 'Properties' like for the 'Fields'?

Sorry if the questions are too simple



Hi Giovanni,

in the above code-snippet you seem to forget to input a node object.

Maybe it helps if you take a look at the 'Karamba 1.1.0 Hacker's Essentials' (see above).

For a basic introduction into Python please consult a text book or on-line resources (e.g. sourceforge).



Hi Clemens,

you're right I forgot to input a node object, but however I don't understand how to use it. I tried in different ways.

As I said above I've already download the 'Karamba 1.1.0 Hacker's Essentials' but I don't find the python syntax in the 'Karamba110_HackersGuide' or samples of python scripting. There is only the example 'SimpleShellEso' but I can not figure out how to do it in my case.

I just asking how to get xyz coordinates of my model nodes.

So maybe I could understand how to use 'Fields' and 'Properties' of the classes for what I need.



ok I finally understood

for node in inModel.nodes:
      print node.pos

I understood that there are some words not defined that work, now I'm beginning to do what I want and to work with 'Field' and 'Properties'.

Thanks anyway








  • Add Photos
  • View All


  • Add Videos
  • View All

© 2020   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service