[A] can not be cast to [B]

Hello @jurriaanfloor,
I thought the problem was solved.
What exactly are you trying to do and what problem do you face?
– Clemens

Hello @gl_karamba3d,

I am trying to make a .gha that reads the karamba model, collect specific data and write it to a json. But somehow after trying all the suggestions, like different .net framework, place the gha in different folders, naming the gha after karamba wrt alphabetical order, it keeps saying “Invalid cast: Model >> Model”.

  • Jurriaan

Hi @jurriaanfloor,
the problem that you report typically occurs when the karamba.gha or karamba.dll assembly are loaded twice. Normally this can be solved via the Rhino-command ‘GrasshopperDeveloperSettings’, unhooking ‘Memory load *.GHA…’ and restarting Rhino/Grasshopper.
The fact that the cast does not work shows that the assemblies are already loaded.
–Clemens

Hi @gl_karamba3d,

Unhooking the memory load doesn’t seem to make any difference. Also not when the .gha is placed in different locations.

  • Jurriaan

Hi @jurriaanfloor,
It could be that the ‘karamba.gha’- or ‘karamba.dll’-files which are referenced by Grasshopper are not the same as those you reference via VisualStudio or the GH C#-component.
In order to try that out: uninstall Karamba3D and remove all ‘karamba.gha’ and ‘karamba.dll’ files from your harddisk that still might lie around there. Then reinstall Karamba3D and update the references.
–Clemens