Changing rhino unitsystem

Hi all,
I am having troubles trying to convert one script from python to c#. I realized that I have to change all of the structure. The code is about units. I would like to have one tool that notify me which units I am using in Rhino. here there are the scripts that I made. Also, I would like to know what the syntax for units in rhino is.


and here is the python script that I want to achieve in c#

thanks in advance for your help.

Hi @santi.canorestrepo,

Let me know if the attached helps.

UnitSystem.gh (4.4 KB)

– Dale

1 Like

Hi @dale
thank you very much. It was very helpful. Also, I would like to know if there is any way to change the units from Grasshopper to Rhino? and alert me whenever I am not using feet or inches.
thank you Dale!

Santiago.

Hi @santi.canorestrepo,

To modify the Rhino document’s model unit system, use RhinoDoc.AdjustModelUnitSystem.

To be notified when the Rhino document’s model unit system has change, you will need to handle the RhinoDoc.DocumentPropertiesChanged event.

– Dale

Dear Dale, how can I do this from a c++ plug-in? I don’t see AdjustModelUnitSystem as declaration. Is it under a different name?

Here is an example.

https://github.com/mcneel/rhino-developer-samples/blob/6/cpp/SampleCommands/cmdSampleChangeUnitSystem.cpp

– Dale