I’ve searched the forum to make sure this isn’t a repeat topic. Close! But doesn’t appear anyone has encountered the same issue.
List.ReplaceItemAtIndex node whether from OOB, Orchid, or Clockwork gives an error relating to the expected data format. Warning expects (var, int, var) but called with (System.Collections.ArrayList, System.Collections.ArrayList, var).
I have lists of lists with indexes and values to replace in an original list of lists. I’ve tried lacing options, varrying levels and even a python script version created from ChatGPT to no avail. Has anyone encountered this error and if so, what the heck did you do to get it to work?
Some background, the script worked fine for me in previous versions of Dynamo. I’m using the version packaged with Revit 2024 and understand it’s utilizing Cpython3 rather than Ironpython2 for scripting.
Any advice or help here would be greatly appreciated!
The list
input is cut off in that image. A simplified example would probably be best, along with an image of the specific outcome you’re after.
The nodes you have shown all appear to be for a singular index within a singular list. Assuming all three warnings are the same, the inputs are also expecting a singular index which could be why there’s some confusion with the input structures.
The specific outcome would be to have the sublists from the original lists show the replaced values at the indexes specified.
Unfortunately that’s not a specific result as you have many list levels with many inputs. Just so there’s no misunderstanding, it’s best for you to show exactly how you want the lists to look based on the given values. A simplified example is usually best here.
Thanks for the reply Nick. I did have it working in previous versions of Dynamo with same list structures.
From looking at the structure and values it seems like a conditional might be easier. Can you explain what it is exactly that you’re trying to do by replacing values in a list?
I was, however, at least able to get an Archilab node to accept the list structure.
This graph will go through a directory of families, gather all unique parameters found, index those parameters and create a list of blank values for each family type within a family, then replace those blank, or in this case “-NA-” values with the values found in each family type.
Very frustrating to have it work just fine in Revit 2022 then completely break in 2024. I’ve attached a screenshot of it working in previous version.
I looked at your errors again and realized you’re getting the ArrayList
error, not just a general structure error. This means you likely have an issue with one of your installed packages. You can find a little more context here:
I was thinking it was more related to either a package or corrupt .net install. I do use quite a few of the Orchid nodes in my graphs. I’m going to be hard pressed to find alternate nodes to use in their place, but I’ve also been very successful getting ChatGPT to code Python for me.
I appreciate you looking into this and finding the problem. I’ll test on my machine later today and follow up here.
Thanks again Nick. I was able to swap out the Orchid package for Dynamo 2.19 with the version I used in Revit 2022 and Dynamo 2.12. Everything seems to be working just fine now.