New to Dynamo, very basic programing but I have managed to get it to do what i was aiming for (I’m sure the code could be a lot cleaner/better). However, everytime i open the code in a revit/dynamo project i need to remake the connections from List.GetItemAtIndex to my vairable r in my code block. Is there any way to aviod redo the connection? (There will end up being alot of these and be very time consuming redoing all connection!)
Thanks in advance for the help - also see image below
What does the error say? That should give you an idea of what’s going on.
This kind of issue, where a code block gets in an error state until it’s cleared or reset, usually means Dynamo is struggling to rectify a discrepancy somewhere. From what I’ve seen, it’s usually around an issue of Dynamo not having enough information to make a valid assumption until the node has been run with more context. It’s a weird state and you should try to avoid it.
That being said, if you just have a bunch of conditions you need to match then a dictionary would be way better. Even for a set of conditionals, you don’t need an imperative function since you can avoid the elseif loops by nesting another if.
Thanks for your reply and the information.
I think it said something like “variable has not been defined” or something to that effect. As soon as I dragged the wire connecting List.GetItemAtIndex to r in the code block and reconnected it the error would disappear.
I think i have been able to get rid of the error writing it as a python script instead of a code block.
I used elif statements but will try update to the nested if statement as you have suggested.