I am trying to use the beam-joints component within Python in order to auto-generate releases based upon a particular type of truss that is defined further upstream in the script. Essentially, every time the truss is changed the releases change with it.
However, when I try to assign releases using the appropriate element identifiers in Python, I get a runtime error saying that python expects an index value. Currently, I am passing the element identifiers into python as a list of strings. Which is exactly what I appear to be doing outside of the python component and it works just fine. Would you be able to assist?
Hello @jdonza ,
handing over a list to ‘At element identifiers’ is correct when working with the class ‘Component_CroSec_JointLine’ in namesoace ‘Karamba.GHopper.Joints’.
However as you write the call to ‘Beam_JointsKaramba3D’ works only in case of items (e.g., ‘0’ for the element with index 0).
I am not familar with the way the Grasshopper Python works with components. Where does ‘Beam_JointsKaramba3D’ comes from? There seems to be a problem in the wrapper.
– Clemens
The component “Beam_JointsKaramba3D” is imported from grasshopper into Python when I make the call “import ghpythonlib.components as ghcomp” on line 12 of my script. This allows me to use grasshopper components within Python. But what confuses me is that even when I try to index the value in the list, I get a type error exception saying, “expected index value, got str”. It seems like the component inside Python behaves differently than the component does in grasshopper. As you can see in my grasshopper script (not my python), I am able to pass a list of strings into the “Beam-Joints (Karamba3D)” component without any issues. It also seems like in Python that “At_element_identifiers” should accept a list based on its description (see below).
If you aren’t too familiar with Karamba3D inside Python, would you be able to recommend another solution for what I am trying to do? I am a bit confused with what you are referring too when you mentioned working with the class ‘Component_CroSec_JointLine’ in namespace ‘Karamba.GHopper.Joints’.