Convert Double to String?

My goal is to take the “Offset” output from the Alignment.StationOffsetByPoint node which is double format and connect with the propertyValue input on the Object.UpdateProperty node. But I think that input only wants a string format. Is there a way to convert double to string? I’ve looked all over/googled but not finding solutions.

thank you!

image

You can use the String from Object node to convert double to string.

There is a possibility that the error might not be because of the input being a double but because of a blank/null/uncompatible input in the list. In that case try filtering out the unwanted inputs using the List.FilterByBoolMask node.

You can also use a simple code block

@david_licona Not sure if that would help! It didn’t work for me.

1 Like

@AmolShah you first post worked for me, but there is one thing perhaps you can help with. I’m getting trailing zeros once converted to string. any way to drop those ?

image

See if this helps

out=[]
for x in IN[0]:
	out.append(str(x)+"")
OUT= out

Or you can try either of the solutions discussed here:

@AmolShah thanks for all your help! I was able to get this working. I was able to use the string replace in this case. Appreciate it!

1 Like

You’re absolutely right, I rushed into it and did the wrong screenshot. Thanks for clearing up my mistake !

1 Like