Rename the index of the List Create node

I need to ask a silly, simple question, but I don’t know and I looked on the forum and didn’t find anything, the question is so silly that I don’t even know if it actually exists.
How can I rename the index of the List Create node? In other words, how can I change Item0, item1 etc… for some name?
image

You can edit the graph in Notepad, there is no other solution yet.

I wrote a blog about it a while ago:

It is in Dutch but there is a translate button on top of the page.

2 Likes

Cool!! I have missed that post on your blog
Thanks @Anton_Huizinga

I do not recommend this. It’s stable today, but may break things in the future.

A lesson learned from hacking previous iterations of the Python node…
:face_with_head_bandage:

If you want to ‘know’ the order of things a dictionary is likely a better collection mechanism, and will usually process faster than a list for large items. You just have to remember that you can’t iterate over it.

2 Likes

Oh… good to know.

1 Like

Generally speaking any time you start to mess with the contents of a file in a way that the base application doesn’t you’re running a risk of corruption, data loss, and long term compatibility. Said another way: “this works today” doesn’t mean it will work tomorrow.

1 Like

That is true, of course, but the biggest risk here is that a user corrupts the file with invalid characters in a JSON file, not that Dynamo can’t read it anymore. The same mechanism for renaming Python node ports is already available in Dynamo with the right mouse button menu. I was surprised that this was missing on the List Create node ports, I’d expected that to be available as well.

So far it works in the current and all previous versions. If it for one reason does not work anymore in a newer version, then it just comes on the pile of other breaking changes caused by Dynamo :wink:

In any case, it’s at your own risk.

I may be misunderstanding the end game, but you could just use a code block instead of the list create node and you can label the inputs to whatever you want.

EDIT: changed the code block inputs… :smile:

5 Likes

I see it as the biggest risk being that Dynamo moves to a new format as happened when we went from Dynamo 1 to Dynamo 2, and as a result the only content in the previous graphs which was ported to the new version was content which the team officially supported. Might be an issue for 3.0 which is right around the corner, or it might not. I wouldn’t go changing the text manually either way. That said i was a bit caught off guard when List.Create didn’t have renamable ports. Then I thought about List.Join, Function.Compose, and unknown additional nodes in packages… it gets to be a big list which is hard to test. Add in that renamed Python ports break often (in my experience anyway), and the value of renamed ports starts to drop significantly.

None of this is to say “Don’t do it!”. This isn’t like ghostbusters crossing streams. However it is to say ‘use with caution’ and plan on some extra time upgrading your libraries when new versions come out.

The Code Block work-around is a good one and what I used in my Generative Design work, before I moved onto Dictionaries that is.

As usual you have better arguments than I do, I actually have to agree with you :slight_smile:

The Code Block work-around is very well found, I like that approach!

3 Likes

I am wrong as often as I am right. And when i am right it’s because I’ve already failed in a spectacular fashion… Such as that time I put some useful into into a XML formated .dyf (what we used in the 1.0 days) only to have it ruined two months later when the team switched to JSON formatting.

Or that time I put an entire .rft into a .dyn in an attempt to remove the need to provide a template path and ran face first into version issues causing nothing to work once the project team updated to the next build of Revit 6 months later…

Or that time I put a bunch of .dyns into an RVT in an attempt to ‘keep the graph with the file’ and ran face first into element binding issues…

Or that time time I put an exe into a .dyn…

Or…

Let’s just say I’ve had a lot of room to experiment over my years at Autodesk. They key part is to share what we learn when we can. :slight_smile:

3 Likes

Sounds my graph creation…… at least sometimes
Does this work → Click ”Run” → No :thinking:
Does this work → Click ”Run” → No :thinking:
Does this work → Click ”Run” → YES :partying_face:

1 Like

But I still don’t understand. See if that’s it, because it didn’t help.
Because what I want is for the list provided to be; List0 = Environments with their results
List1= Walls and their results. How to change this information?

I was just replicating the output that the List.Create node was providing. So if you want to separate your input list then just put brackets around each name ending with a semi-colon or you can just use a watch node on each list and rename the watch node accordingly.