Coff and Grasshoppper

I would like to ask what is Coff Settings GrasshopperDeveloperSettings.

By default it is on.

But the problem I have is that I cannot run native C++ wrapper on .NET environment.
Only when I turn off Coff settings grasshopper components finds the .dll and it works.

So my question is why Grasshopper does not find native dll when Coff are on?

Because grasshopper will copy the files in memory. And if the assembly (the .net assembly) tries to look up “Where am I?”, it finds itself the Grasshopper Matrix, rather than somewhere on the filesystem, and can’t find the non-.net dll’s its looking for.

You can easily solve this by only turning on COFF loading for specific plugins, by selecting Load From Disk, in the grasshopper “Solver” Settings.

It’s not supposed to be on by default though.

Really? It was on by default for me, and I turned in off to make Petras’ last plug-in work: OpenNest | Food4Rhino
As you can see in the comment thread many people have the same issue.

Are you saying that particular plugin defaults to COFF loading, or that every one of your plugins does?

I am not familiar at all with this setting, so I might I have said something wrong.
The checkbox highlighted in the image above was ON for me by default, and I guess that particular default setting is the same for everyone. I think it applies to the library folder, therefore to all plug-ins. After unchecking the box, I could make Opennest work without any trouble.

Dear David Rutten,

Is there any possibility to add some bit of code inside my visual studio project, that Coff-on and Coff-off property would not make any difference? It is needed to turn off to find native C++ library. If it is a must to turn off Coff settings then I will just add instructions how to install this add-on correctly.

Yes, that is the application wide setting, it is however settable from code and by changing the grasshopper settings xml files, which a plugin installer may choose to do.

These days there is an override setting per plugin as well, and plugins may request a specific option, but those are a fairly recent addition.

The more time goes by the harder I wish I never added COFF loading. The troubles it has caused far outweigh the benefits.

Oops sorry to hear. Thanks for the details though

Thank you for a reply. Is it possible to get example how to tweak this settings?:slight_smile: Would it also work on Rhino 5.14.505…?

Hi Petras,
If I am not mistaken, you should be able to tweak this setting here, by accessing %appdata%\Grasshopper\grasshopper_kernel.xml and overwriting the file.

You can manually tweak the setting per plugin via the Grasshopper preferences UI.
You can set the application default via the _GrasshopperDeveloperSettings command.
You can specify a preference for your own plugin by assigning an assembly attribute which looks like:

[assembly: Grasshopper.Kernel.GH_Loading(Grasshopper.Kernel.GH_LoadingDemand.Default)]

Thank you for a reply. Can I tweak in whatever component class? Or in which csharp file I should change it?

A normal place for it is in Properties/AssemblyInfo.cs: See the example here https://bitbucket.org/andheum/humanui/src/c679022a34c18cd0b421025fcbf45861e3c757dd/HumanUI/HumanUI/Properties/AssemblyInfo.cs?at=master&fileviewer=file-view-default

2 Likes

@DavidRutten and @andheum thank you very much for replies now it works whether coff are on or off:

4 Likes