Grasshopper

algorithmic modeling for Rhino

Hi,

I have a list of numbers being output to a panel but they are large so they are viewed as E+... instead of the whole number. Is there a way to change the setting so that when I output the file into a .csv file they are in their actual number format?

example: 2.350600E+005 (scientific notation) would be viewed as 235060.0 instead.

Thanks!

Tags: E+, notation, number, scientific, view

Views: 3953

Attachments:

Reply to This

Replies to This Discussion

How do you fix the number of decimal places in this sort of formating statement?
Fixed number of decimals:

Format("{0:0.00000}", x) //exactly 5 decimals...

Format("{0:0.00###}", x) //at least 2 decimals, but we allow for 3 more if they're non-trivial.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Arhhhhh, it was the colon I was missing!

Thanks David.
very helpful

Hi David:

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?

Many Thanks!

Justin

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.

 

Thank you

Stan

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.

 

Any thoughts?

 

Stan

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.

 

Stan

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>

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hello David,

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.

 

Stan

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.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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.

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2014   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service