Grasshopper

algorithmic modeling for Rhino

I saw other posts about similar errors but could not solve the problem.

When I use a custom parameter class in my c# component, I get an error saying IO has generated 5 messages. When I open them I see this.

Plugin version: 0.9.0076

Parameter type is unknown

Input parameter chunk is missing. Archive is corrupt.

Output parameter chunk is missing. Archive is corrupt.

Object list read 


This happens only when I use my custom parameter class, which is in the attached file. What is wrong with this class that is causing this error ? Thank you.

Views: 781

Attachments:

Replies to This Discussion

Ok, It keeps happening when I use the IGH_VariableParameterComponent. Can I not use my custom parameter class and implement that interface ? am I missing something ?

I cannot repeat that. If I stick your parameter code into a project it reads out just fine. I think the problem may be in your component instead. Care to post that code?

Hi ! thanks, I just saw the reply... here is the component in which I am using. Everything works fine if I don't implement the IGH_VariableParameter. But I need to implement that interface. Thanks again !!

Attachments:

I don't have the geomObject, memberInput and memberSelect classes needed to compile that. Maybe it's a good idea to simplify this as much as possible. If it starts working start adding complexity back until it fails, if it still doesn't work in the simplest form then it should at least be easy to pinpoint the problem.

Looking at the code there's a lot of stuff I wouldn't do, but that doesn't mean it's wrong. It just makes it difficult for me to parse the code without running it.

I did simplify it and then added things one by one, It breaks exactly when I implement IGH_VariableParameterComponent Interface. Until that point everything works as expected. Is there anything special that is making IGH_VariableParameterComponent and my parameter class not work together ? 

The error only happens when I open saved files, but otherwise the component works as expected. And attached files all the classes. Thanks for the help !

Attachments:

memberInput is the parameter class and I am trying to use it in the ObjectifyComponent, which also implements IGH_VariableParameterComponent.

Hi,

In this file (attached) I am using this parameter in a basic component without using any other classes, it still shows the same error whenever I open a saved file which uses this component. The error occurs as soon as I use my custom parameter class along with the IGH_VariableParameterComponent interface.

I am not able to figure out what is causing that error, can you help ? Thank you very much !

Attachments:

Sorry I missed your previous response. Don't know what happened.

I'll try and have a look at your latest code tomorrow morning.

The problem (well, the one that jumps out at me) is that your parameter class doesn't have a constructor without arguments. The only constructor you provide requires a string. Because of this Grasshopper doesn't understand how to instantiate this parameter when it needs one during file reading.

Thank you so much ! the constructor totally fixed it !!

See the attached code and file. I implemented proper deserialization for your parameter type, type instantiation and also removed everything that wasn't essential to this example.

Attachments:

Oops, line 154 should be:

sb.AppendLine(string.Format("  {0}: {1}", k, list[k].ToString()));

instead of:

sb.AppendLine(string.Format("  {0}: {1}", k, list[i].ToString()));

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service