Grasshopper

algorithmic modeling for Rhino

registerInputParams and registerOutputParams in Visual Studio for my component

My C# script has a number of inputs and outputs.

There are eight inputs in total:

  1. Heatmap is list access. The type hint is Color.
  2. Legend is list access. The type hint is Color.
  3. Dates is list access. The type hint is System.Object (with-in the script, I have the code snippet int datesCount = Dates.Count();)
  4. Times is list access. The type hint is System.Object (with-in the script, I have the code snippet int timesCount = Times.Count();)
  5. Height is item access. The type hint is int.
  6. Width is item access. The type hint is int.
  7. Path is item access. The type hint is string.
  8. Save is item access. The type hint is boolean.

There are also two outputs:

  1. A is an output of a bitmap called "heatmap", which draws onto the canvas using this snippet of code:
  2. B is also an output of a bitmap called "legend", which draws onto the canvas using a similar snippet of code above.

My question is - what are my registerInputParams and registerOutputParams in regards to my data structure above? The first two Color list accesses, would .AddColourParameter be the right method to use? Also, for my output, what should I register them as, since I am actually displaying an image onto the canvas? Should I just leave it blank?

Thank you.

Views: 634

Replies to This Discussion

I wouldn't use Generic unless you want to support multiple types of data. Grasshopper has specific parameters for Strings, Integers, Dates, Colours etc. etc. so you should use the most exact one you can find. I.e. AddTextParameter instead of AddGenericParameter.

--

David Rutten

david@mcneel.com

Yup.

--

David Rutten

david@mcneel.com

Registering input and output parameters is something you need to do when you write a component in Visual Studio, it is already taken care of for you when you use a VB/C# script component.

--

David Rutten

david@mcneel.com

Ignore this reply, I thought you were using a script component.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service