algorithmic modeling for Rhino
I'm struggling to reveal more numbers behind the decimal place on floats in definition. A sample number displays as "22.786307", but I know that there are are more numbers behind the decimal point. How can I set a custom resolution for viewing, say, 12 numbers behind the decimal point instead of six?
I am reading point coordinates from an excel file and using the data in GH. In excel the format of the numbers are not in scientific notation. When those numbers are represented in GH they are automatically transformed to scientific notation. Consequently, some of the digits are not shown. For example, 166466.9352 in excel becomes 1.6647e+5 in GH. I am concerned that some rounding has taken place and the point will be in the wrong place. Can anyone shed some light on whether the number actually got rounded when used in GH? Is there a way to set the number of digits before rounding. If it got rounded is there a way to ensure the proper number of digits are carried over to GH.
I answered my own question. Undesired rounding is occurring due to the automatic conversion to scientific notation.
I drew a point with the actual coordinates and compared it to the point baked in GH (scientific notation). The points were not in the same place. This is a concerning discrepancy. It seems if you put in the right coordinates, you should get the right point, not a rounded coordinate.
Does anyone know if there is a connection between the 'absolute tolerance' setting in 'Units' dialogue box in Rhino and the point that GH converts the number to scientific notation.
Thank you in advance for any information that might help me.
Nope, it's a constant defined inside Grasshopper. I'll put it into the settings xml file so you can change it, though I doubt I'll make a UI for it.
Starting from the next version, you'll be able to adjust the thresholds for scientific notation formatting in the grasshopper_kernel.xml file inside the Grasshopper Settings folder (accessible via the Grasshopper menu). If you do change this file, do so while Grasshopper is not running as the file gets overwritten on Rhino shutdown.
These are the values you can change:
<item name="Format:ScientificNotation_Lower" type_name="gh_double" type_code="6">0.001</item>
<item name="Format:ScientificNotation_Upper" type_name="gh_double" type_code="6">10000</item>
Thank you for the feed back. The ability to adjust the threshold will be a welcome addition, although changing constants in code is a bit scary.
In the meantime, can you think of an alternate method to avoid the undesirable scientific notation rounding challenge?
Thank you for all your hard work. GH is an amazing tool. I am so happy it came along during my lifetime. It allows me to get the edge on my competition.
Nope, at present the formatting is hard-coded, you can't change it.
And relax, you're not changing 'code'. It's just xml. And you can always rip out the entire line to revert to default, or even delete the entire xml file.
I did figure one way to work around the scientific notation issue. I offer it here in case it might help someone in the future. I was originally working on a coordinate system dictated by my client. The project location was a very far distance from the 0,0,0. Therefore, all my point coordinates were 7 or 8 digit numbers which was the reason the scientific notation kicked in. As a work around, I moved my model closer to 0,0,0 and will translate to owner coordinates when needed. Can it be that simple???? Yes it can... At least it was for me this time.
It never fails, I learn something every single day.