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!

Views: 9502

Attachments:

Reply to This

Replies to This Discussion

Use this formula in an expression component: format("{0}",x)
Connect the point list to the 'x' input and the expression component should return the list of points without scientific notation.
Thanks Vicente...

Do you know,
Is there a way to easily remove the '{' and '}' so that the outFile just has #,#,#?
use this formula then: format("{0},{1},{2}",x.x,x.y,x.z)
I've also been wondering about this for some time.

Thank you Vincente for sharing and thank you Elizabeth for asking
There are a lot of formatting tricks for numbers available through the Format() function.

Standard formatting tags

Custom formatting tags

--
David Rutten
david@mcneel.com
Seattle, WA
Thanks!

why this is not working now?

I used this format issue for a long time but it is not working now on the last grasshopper...

Its a bit out of context and out of date, but is it possible to find the pathmapper component operators listed and explained in a page like the links which you gave above?

Thanks

Hi David,

Could you give an example of a formula that would include the CultureInfo.CreateSpecificCulture. E.g. in the Netherlands we use a . instead of a , between thousands and a , instead of a . before the decimals.

Grasshopper (like Rhino) only supports English numeric formatting by default. The confusion would be complete if we allowed variable notation like that.

If you must create Dutch floating point numbers for export or display purposes then I'm afraid you'll have to perform a string replace operation. And since you're swapping two characters, you'll need to perform a game of Three-card-Monty as well:

I could add a Culture input to the Format component, you could then specify a culture such as "nl-NL". Cultures are also used to modify the way strings are sorted so maybe the string sort component also needs a culture input.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David,

That is a solution. I found a way to do it in a VB component. Inside I put: A = String.Format(CultureInfo.CreateSpecificCulture("nl-NL"), "Net number of visitors: {0:N0}", x) and right clicking the component I added the assembly that imports the System.Globalization which I found in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0. It's called sysglobl.dll.

I added culture data to Grasshopper and now Sorting and Formatting can be made to use the rules of a specific culture/language:

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2018   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service