String to Number


#1

I tried the sample "Import_Export CSV " and it has a problem with String to Number node. I tried to figure it out, and it seems as if this node have had a problem with decimal values. When I changed some of the coordinates in csv file into integer number it worked.

Is there a solution to this issue ?


#2

a workaround:

string

 

 

 

 

 

the python code:

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN[0]

#Assign your output to the OUT variable
OUT = float(IN[0])

 

 

 

 


#3

I tried your code and it didn’t work for me. Can you look at the picture and tell me what is wrong ?

Python


#4

strange!

what build are you using?

what error message do you get in the python node?


#5

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
unexpected token ‘’

I am using Dynamo 0.7.1, the latest build from tomorrow

fsd

 

 


#6

Hello Szymon Jan,

Can you please share your dyn file. I don’t see any problem with String to Number in 0.7.1.

Try running Sample from Help>Samples>ImportExport>ImportExportCSV to Stuff

Do let me know if yours data is different then what we have used in Helix.csv

Thanks,

Ritesh


#7

helix_smaller
ImportExport_CSV to Stuff

I used this sample data without changing anything in this files and this is what I get :

Error


#8

no changes and running!

maybe you reinstall your dynamo files.

i am using revit 15 dynamo daily from 09.07.2014

szymon


#9

I reinstalled dynamo and still it doesn’t work. Let’s face it, Dynamo hates me :stuck_out_tongue: I know it is hard for you to help me without having the same error, so I think maybe I will reinstall my Revit (??)

Belowe Example of problem with decimal values

Error2


#10

Strange thing happend. It seems as if my system was using the comma instead of dot (??) When I wrote 10,5 it worked. Is there a place where I could fix it ??

error3


#11

looooool!

cool, maybe you create an issue so developers may track it.

funny is, that my system accepted your dyn file.

i am working on a localized german version

@ least its some sort of working now.

congrats


#12

I’m from Poland. It is definitely Regional Settings
You can change it in two ways:

"1) Regional settings
Control Panel –> Clock, Language and Region –> Change the date, time, or number format
Click on Additional settings button.

2) Within Excel
Office Button (left hand corner) > Excel Options > Advanced > Editing Options > Uncheck ‘Use system separators’ > Define as per your needs"


#13

Szymon Jan: I am glad that you figured out the problem.

So after changing setting to English locale, are you able to run String To Number successfully?

Thanks,

Ritesh


#14

Yes it is working


#15

I have a similar question to Szymon using Peter’s work-around.

How can I convert a sublist of string(s) to numbers? As you can see it’s working on a basic string input, but what about a list?


#16

The “to number” node in 0.9.0 should work quite well, also try experimenting with the List.Map node.


#17

Thanks Timon - Too obvious! I was searching for “String to Number”. I also played with the List.Map node and ran into the same issue. I agree, I need to learn much more about the power of List.Map!!