Grasshopper

algorithmic modeling for Rhino

My c# component uses custom parameters. And one of the parameters implements "Read" and "Write" methods to (de)serialize. In grasshopper when I use either that parameter, or a component that uses that parameter, it works normally. But when I delete that param or component, Rhino crashes.

After some trial and error, here is what I found out about this crash:

1) When I add my visualStudioProject/bin folder in the grasshopper developer settings, and load the plugin from there, Rhino does not crash and everything works just fine. But when I copy the gha file from the bin folder to grasshopper components folder and load the plugin from there, this error happens and rhino crashes. So I am not able to debug this error through Visual studio. But if I want to give this plugin to someone and have them use it, they would have this problem.

2) The Write method is what is causing the error. If I remove that and leave the Read method in the code, it once again works fine. But I need the write method.

My code is in multiple files and has several classes, so I would have to clean it up and separate the problematic parts to post it here (for readability). But I thought I would ask first whether this behavior is due to a known obvious issue that I am unaware of.

Thank you !

Views: 468

Replies to This Discussion

Nothing obvious springs to mind. There's probably an unhandled exception in your code. You can start by putting the entire Write method body in a try...catch block and see if you can get any information about the exception.

It was a FileNotFoundException and I was able to fix it. Thanks !

An unrelated question:

My components use custom parameters which are written as:

public class myParam:GH_Param<IGH_Goo>{...}

I see that users will be able to add these parameters to the document if they want to. I want the users to be able to use only the components (which use the parameters) but not the parameters themselves. Is there a way I can control what classes from my code show up in the GH toolbar ? thank you !

Override the Exposure of your parameter type and return the Hidden value.

People will still be able to extract your parameter type though if it's used as an input for any component, thus creating free-floating ones.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service