Bug with Item Index


I would appreciate some


I’ve used grasshopper for years, but this is the first time I have been stumped so hard, as I’d have to back-track a huge script to get things to work the way they should. Somewhere along the way in my script the Item Index managed to break and no matter what sort of information I feed into it, it will give a -1 value.

Before posting: Item Index always returns -1 - I’ve looked at the forum and found different answers, but they involve not using the node…

Problem is, I’ve used Item index a number of times till now, and it works. The output is still there, unless I try to create a new one and connect it to the same things - it will give only -1 values. (see screenshot)

Secondly, I can’t use member index. I’m comparing 2 lists of breps from which I need to isolate a number of them.

Question is, is there a way to scan the entire memory for these values? How does this sort of error even happen?

And if there would be a workaround - using python or C# - how would that look? Anyone got some advice?

The script itself is big, but if needed I can attach it, if someone wants to troubleshoot it.

That’s because 99 times out of a hundred people don’t want to compare memory addresses, but value states. So the answer is almost always; “use Member Index”. However if you’re trying to find Breps in a list, then Item Index actually is the correct approach.

However this will only work if the Breps you’re searching for are still the original instances.

No. At any rate, the Item Index component doesn’t compare values, it only compares memory addresses, so there’d be no point looking anywhere else.

Without seeing your file I can give you some advice on workarounds. You can try and convert each brep into text, then compare the text using Member Index. But for this to work you’d have to format each brep in such a way that it results in a unique description. For example “{FaceCount}, {EdgeCount}, {BoundingBoxMinPoint}, {BoundingBoxMaxPoint}”, or some other scheme that works for you.

And yes, you can also write some C# or python code to compare two breps and see if they are equal within your requirements.

But if you can upload a file shows this issue we can talk specifics.

I’ll first try to do with converting the Breps and see how it goes. If not, I’ll go about removing and trimming down the script so I’ll only have the existing issues and post it here - the clutter is a bit unbearable. I do appreciate the feedback and I will keep you updated.

And the breps, original or not, the issue comes with certain indexes that work, and when I remake them from scratch (not copy paste), reconnecting them to the original geometry nodes, they no longer work.

It does seem to be some sort of memory issue, as connecting the very same nodes the same way, gives me -1 values.