A little problem of convert from goo


i have a custom class (which is “customcommand” and it inherits from"robotcmd"),all is witten in c#.
if i use a c# component ,as the picture show, it show a Error:

and i try to add a convert code:
it seems wrong…
so. can anyone help?
Thank you very much

Do you have a wrapper type derived from GH_Goo for your custom class? How do the CastTo / CastFrom methods look like?

1 Like

As @dsonntag said, you need to provide CastFrom and CastTo methods rather than implicit convertors.

The SDK documentation I think provides an example of custom data types.

1 Like

Have you tried to deactivate the COFF byte arrays option in gh developer settings?

1 Like

I am also not well aware of the details but had the same thing with custom classes a while ago. If you debug it (by encapsulating the casting in a try/catch), it shows that it has to do something with the way the .dlls are loaded. I think one time the .dll is loaded directly from Grasshopper (in the parameter container) and the other time referenced when compiling the C# script. I guess the objects are then not recognized as being of the same type (as they technically come from different .dlls), thus the casting fails.

But I think @DavidRutten should be able to explain this better, I would also be interested :wink: