My Dynamo script is not working "ViewSection is not iterable"

Translated by moderator. See below the line for original post


Good morning all,
I’m trying to run a Dynamo that could create elevations of each face of a coin at once.
I used the tutorial at this link below but the last script does not work.

Learn Dynamo
Module 11 Room Elevation by Curve | Learn Dynamo

In this module, learn how to leverage Dynamo and Python to automate the creation of internal room elevations Autodesk Revit with a simple script.
I don’t get this error when I run it. File “String”, Line 41, what does it mean?

picture
Does anyone understand the error message?
Thank you in advance.


Original post below


Bonjour à tous,
J’essaie d’exécuter un Dynamo qui pourrait créer des élévations de chaque face d’une pièce d’un coup.
J’ai utilisé le tuto à ce lien ci-dessous mais le dernier script ne fonctionne pas.

Je ne comprends pas cette erreur lorsque je l’exécute. Fichier"String", Ligne 41, ça veut dire quoi ?

Est-ce que quelqu’un comprend le message d’erreur ?
Merci d’avance.

@etienne.dronval please use English to write posts here, I guess there is a french Dynamo forum somewhere;
Regarding the error, you are feeding an item (view) while the code requires a list of views;
Either bracket your input or turn it into a list using an if/else statement.
P.S.: I will change your post title to English.

2 Likes

@Elie.Trad makes a good suggestion. I use the below function for checking if items are lists or items, hopefully you find it useful.

#Given any input will return a list containing that item (if it is already a list it just outputs it without change)
def tolist(obj1):
	if hasattr(obj1, "__iter__"): return obj1
	else: return [obj1]
2 Likes