Data loss in python component

Hi All,

I am using python to prepare the required data structure for a 3rd party component but it appears that part of the data is lost at the python component’s input. The attached .gh file contains 3rd party components, so I’ve also attached a screenshot of the same file for ease.

Th 3rd part component requires a ‘CrossSection’ as input, which is prepared in the attached file using the ‘AxCS_Par’ component, however, it loses its cross-section type when passing it through the python component. The python component has been simplified to just ‘output = input’ to rule out any other potential issues with the script.

In essence, the question is: how can the raw data be made available for the python component without any pre-processing by Grasshopper which obviously results in data loss despite the seemingly unchanged representation of the data on the output?

Thanks,


Data_conversion_python.gh (41.5 KB)

Hi @Poppy_West ,

Admittedly it’s hard to tell the issue without the plugins and being able to peak what kind of data they are outputting/inputting but it looks like the AxCS_Par output is using some kind of its own “data type” either strings or something else that is not immediately obvious.

But I believe what’s happening is your AxL wants that CS input to be a very specific “format” of however that data is structured on the AxCS_Par output and when you pass through the python component it’s looking at your data as a ghdoc object and saying “I see strings” and thus outputting the text to panel correctly giving you the illusion of the output being “the same” but as you pointed out you are losing whatever data is actually instead that AxCS_Par output and perhaps someone has a good work around for this but I don’t think it’s the python components fault.

Perhaps you can play with type hinting and see if “String” yields a better result:

Another suggestion would be to print input inside your python component and see what the terminal shows for the actual object type/data that is present.

If you could internalize the data output of the AxCS_Par component and reupload the .gh that would be helpful.

To summarize,

You need to see what actual data is outputting from that AxCS_Par output and then we can troubleshoot from there

Hi @michaelvollrath,

Thanks for the quick response. I have reattached the .gh with the AxCS_Par’s data output internalised in the python component. I’ve also changed to list access to eliminate the difficulties of dealing with trees. Printing the data and data types, everything seems to be in order and the ‘CrossSection’ data type appears to be correctly maintained.


Data_conversion_python.gh (38.2 KB)

Thanks Poppy,

I think this is the issue.

This is the object type:
GrassHopperToAxisVM.CrossSection

as far as gh python is concerned, it has no idea what this is is.

The receiving component of your plugin however, does know what this is and that’s why it’s not working when you pass it through the python component.

I think you need to deconstruct this object type into its individual components like “Circle/Curve” “Text/String” etc and either tupelize it or something within python so that the script can work with data it understands.

Now granted, I’m not a programmer so hopefully someone can give you more of a direct answer but I’m pretty sure this is your main issue in that it is its own “object type” that GH doesn’t have by default.

Is there any grasshopper/API documentation for this plugin that you are aware of? Could be helpful…

Thanks!