Grasshopper

algorithmic modeling for Rhino

Changing Rhino.UnitSystem in c#/Converting Rhino.UnitSystem in int32

Hi all,

saw a few days ago a thread about changing rhino units in GH.

Tried it by myself, just dont know how to adjust them

So far it is like this

The problem es how to set the units with an integer.

The first argument just accepts Rhino.UnitSystem and i cant feed it in like this so i used the values of the unitSystem enumerator and tried to feed them in as an interger.

Anybody an idea?


Thanks!

Views: 603

Attachments:

Replies to This Discussion

Rhino.UnitSystem is an enumeration, if you know for a fact that your integer value represents a valid value, you can just cast it:

UnitSystem us = (UnitSystem)units;

Similarly, you can also cast the unitsystem value to an int:

int units = (int)UnitSystem;

You don't want to use GetHashCode, that's just for storing data inside HashTables and quick comparison rejections.

Thanks David!

Thats perfect!

Hi all,

did you solve this problem? I am trying to run this code but it is not working. could you share with me the code.

Thanks.

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