Change list of Type Names to a list of provided strings

Hi, I’ve been trying to insert a string as a prefix to a list of Types of one family.
I did find this solution by Konrad but it doesn’t work with lists.
I’ve been trying to modify it so it does work kinda zipping these types with list of string (lists are of equal lenght) but I am rusty with python usage (again) so I need a quick fix - it seems like the answer is very obvious and close :slight_smile:

@filip.kabelis ,

mybe codeblock is suffucient

whats your input ?

KR

Andreas

Something along these lines:

elems = IN[0]
names = IN[1]

for pair in zip(elems, names):
    pair[0].Name = pair[1]

The key is to ensure you have an association between the element and the desired name, in this case achieved by the zip method.

1 Like

You are trying to assign a list to the variable(which should be a string), so your for loop should also iterate the list from IN[1]

This is exactly what I needed, just couldn’t nail down the zip syntax. Thank you!

1 Like