Grasshopper

algorithmic modeling for Rhino

Hey there.

I am casting my custom type into an int in grasshopper, and everything is working, but very slowly. I'm getting 2 "invalid cast exception" for every cast, even though it's working. I'm suspecting this is why it's running slowly. 

It's outside of my code, so I don't know what's wrong? 

if (typeof(Q).IsAssignableFrom(typeof(int)))
{
object ptr = this.Value.Index;
target = (Q)ptr;
return true;
}

//Then, see if Q is similar to the GH_Integer type.
if (typeof(Q).IsAssignableFrom(typeof(GH_Integer)))
{
object ptr = new GH_Integer(this.Value.Index);
target = (Q)ptr;
return true;
}

Views: 503

Replies to This Discussion

Hi Gustav,

any chance of getting a complete class which can be compiled and shows the problem?

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