Hi all,
I am getting stuck with the String.Replace Node and not really sure why.
I am trying to use Dynamo to convert an Imperial Template to a Metric one.
There are some name in the View Template I would like to change, for example : Architectural Plan_1/4" to be Architectural Plan_1/50. At the same time, I also want to round up the Scale from 48 to 50.
I am pull out the view templates using Archilab packages, then use String.Replace to replace 1/4" to 1/50 then use Element.Setname from Clockworks, but somehow it did not work.
Also not sure how to change the scale to match the View Template ?
def toList(item):
if isinstance(item, list):
return item
else:
return [item]
out = []
strings = toList(IN[0])
searchList = toList(IN[1])
replaceList = toList(IN[2])
if len(searchList) == len(replaceList):
for string in strings:
flag = True
for search,replace in zip(searchList,replaceList):
if search in string:
newString = string.replace(search,replace)
flag = False
out.append(newString)
break
if flag:
out.append(string)
else:
out = "Search & Replace List lengths don't match"
OUT = out
hey Amol thanks for your help. I tried the Phython too. Turned out the input with String doesnt work, I have to use Code Block node. A bit weird. Any way it working now.