Grasshopper

algorithmic modeling for Rhino

Hey Guys, 

This has never happened to me before but maybe I am just missing something or doing something really stupid that I am not noticing and need your help. 

I am trying to combine a list of curves and a value (temperature associated) to each as a tuple and then append each tuple within a list. The list then goes to another python component that should read it as a curve and a value. 

The idea is to have multiple components of this sort (similar to the HB_ThermBoundary components) that then get combined into one single component. 

However, if you see the GH file attached, the second component reads the element number 1 as a GUID and is not able to process it as a curve. It works within the first component though. 

What am I missing / doing wrong? 

Views: 742

Attachments:

Replies to This Discussion

Try putting your tuple inside a GH_ObjectWrapper instance. This will (probably) prevent Grasshopper and/or the python component to try and interpret the tuples you're outputting in order to convert them into standard GH data types.

David, Thanks for you reply. Can you help me a little bit more to understand this. Also, do you think there is a better or simpler way to do this? 

I don't know enough about the Python language or the Python component to help further, I'm just assuming that the component is trying to convert your output to a native GH data type. I don't know why it comes up with Guids.

The GH_ObjectWrapper class was designed to transmit unknown data from one parameter to another. So, if you have data of some type which is supposed to 'survive' transfer without getting messed with, putting it inside a GH_ObjectWrapper is the simplest way. You can construct a GH_ObjectWrapper with whatever data you have, be it a single value or a collection of values.

Right click on the input and set the type to Curve. It's currently set to NoTypeHint.

Mostapha, I am passing a Tuple from the other component? If I change to "Curve", then the x input reads the input as "None" Type and gives me an error. 

I didn't check the code inside the component. In that case you probably want to use UserDictionary to attach the data to each curve. You can read them back in the next component. Here is an example:

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service