Hi all,
Its my first python script and I think its like a basic question, It makes me realize that I’m probably missing something fundamental about how to write python scripts for dynamo.
I’m trying to write a script that will make a list of numbers describing the vector angles that I want to convert the angles with the help of IF/ELSE condition as below:
Kindly advise, What am I missing here?
Try changing the last line to y.append(“Nil”)
.
You are converting the list to a string as soon as you hit a value > 180, rather than appending the error message.
You’re also missing a list level. Your python is set to iterate through each item in the supplied list, but you’re supplying a list with sublists. You could also do this with a nested If
statement using DesignScript and not have to worry about the list structure.
1 Like
OUT = []
for i in IN[0]:
if i <= 1:
OUT.append(i)
elif i <= 90:
OUT.append(90-i)
elif i < 180:
OUT.append(180-i)
else:
OUT.append("Nil")
hmmmmmm…
1 Like