Array from String

There is a core node to turn an array into a string, but not one to do the inverse, converting the string back into a list. I am trying to save information customizing how a script is run back to a Revit parameter (as a string) then will pull that parameter data and turn it back into a list. I can get it to work with core nodes, but it seems like something that could be done in a more stable fashion either with design script or with python, I just don’t know enough python to make it happen. My node based method also creates a warning (since it produces nulls) and I’ve found the formula node is prone to breaking (but does get the result needed, which the if node doesn’t). Is there a way to convert a string back to an array better?

This is for Revit 22/Dyn 2.12 currently, but Dynamo with Revit '23 has a node to do this that would work too!

String from Object might be a better option

String.ToNumber(a) == null? a : String.ToNumber(a);

5 Likes

I would probably use the option that @Vikram_Subbaiah displayed, but here is an alternative for the original string structure.

6 Likes

@Vikram_Subbaiah Thank you. Using the last two nodes after I had reassembled the list did prevent the error on the String.ToNumber node. However, I do have to start with a single line string, since I intend to pull the configuration from a single parameter value.

@Ewan_Opie Thank you!! This is what I was looking to make happen, taking the single line string and turning it back into a useable list of the correct datatypes! I appreciate you explaining how the Python script is working too, since it helps increase my understanding of the language.