A question about custom component parameter type

i am programming with kuka robot,using kuka prc.
The problem is :When I retrive a item of kuka command from kuka robot command list by C# compnent,the result is different with the native component"retrive item from list".
as following:

C# component code :
private void RunScript(List<System.Object> x, ref object A)
A = x[0];

The hard point is KuKa command is from KuKa|PRC ,this parameter is customize,it is different with native data type…
how can i use C# component to get the same result?
Thank you!

It might be because of different behaviors of implicit conversion from IGH_Goo to ‘object’ (here).

I would recommend to use some technique to probe what are happening in the parameters. Try using Param info from Metahopper. Or a IL debugger :smile:


Difficult to say what happened here since I don’t have access to Kuka|prc, nor a Kuka robot :wink:

Script component actually does much more than your code. You will also be suprised when you read the implementation of List item component.

1 Like

That would be my guess too. When data goes into a script component, the data type is allowed to convert itself into a ‘safe’ format. This means that from within a script component you cannot get the actual GH_Point, GH_Line, GH_Brep data, as they have already been converted into Rhino.Geometry.Point3d, Rhino.Geometry.Line and Rhino.Geometry.Brep respectively. Kuka may be doing a similar conversion.

If you really need the original data, you’re going to have to get it yourself from the inputs. But that means collecting the entire tree, so no more per-item calls to RunScript().

thank you,David and GankeYu,i have understand a littel.

My guess here is that the Kuka library defined a custom IGH_Goo wrapper for their underlying data type with an overridden ToString() method for pretty output.
See what happens if you plug the output of scripting component into one of those param components:


More info:

One of the param is GH_PRC_CommandData, which inherits GH_Goo<PRC_CommandData>, and the other is PRC_CommandData. The former one has a ToString overload. I think scripting component unwraps the GH_Goo automatically.

I try it,but failed…

Late answer. You can use Component.Param.Input to access the ‘raw’ version of parameter