Function to Convert list of Strings to Length in feet/inches


#1

Anyone know of a way to convert a list of strings that are formatted as (#’#") to lengths? Non-python if possible…

The Length from String node only works on one string, not a list of strings.

string to length


#2

I don’t think there’s a built-in or custom node for that. You’ll probably need String.Split, String.Replace, String.ToNumber, Math.Sum, some list operations and either a code block or a Formula node to convert that list of strings to metric.

BTW: Length From String does not work with List.Map because it always contains a value (in your case 0’0").


#3

That’s what I was afraid of…having that node only work on a single value is very limiting.

I guess it’s Python-time…


#4

I was thinking exactly along Andreas’ line of thought:

str2ft


#5

Nice. I would probably add a whitespace as a third separator in order to make it a bit more robust in terms of user input error.


#6

Cool. Still might need to go with a script to account for potential user variations (decimal inches 5.25" or fractional inches 5 1/4").


#7

 

Fraction2Feet2016-03-04 22_52_49-Dynamo


#8

May not serve all scenarios, but there seems to be an OOTB node too

20160305-2