Grasshopper

algorithmic modeling for Rhino

Hi everybody, 

I am trying to add UserData to Geometry Objects using C#. I got this helpful example (http://frasergreenroyd.com/how-to-add-custom-user-data-to-rhino-obj...) but its just not working out for me :(

The Error-Message is saying: "Object reference not set to an instance of an object"

The Class which is storing the UserData looks like this. Its built in VS and referenced as .dll into the scripting component:

namespace UserDataTest

{
     public class MeshUserData : Rhino.DocObjects.Custom.UserData
     {
          public List<double> meshResults; 

          public MeshUserData()
          {
               meshResults = new List<double>();
          }

          public void AddResults(List<double> results)
          {
               meshResults = results;
          }

          public void ClearResults()
          {
               meshResults.Clear();
          }
     }
}

Many thanks for any help or hints I could get on understanding the problem and reason behind this Error and making it work!!
Phil

Views: 1262

Replies to This Discussion

I can't see the mistake, but are you sure you want to use UserData? UserDictionary is more easily accessible.

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