Node Output & Design Script Output Inconsistent

I often work through more complex problems with codeblocks and then convert to DS once I have all the list levels figured out. Today I noticed that my converted DS wasn’t returning the same number of objects as the nodes. I finally narrowed it down to the last line, RemoveItemAtIndex. The first codeblock uses the t1 variable as the list of indices. The second codeblock uses the full function for defining t1. Those are the only differences.

Why are the codeblocks returning different lists? I’m mostly just curious and making sure it’s not a bug. I can use the defined variable as a workaround for now (assuming that output is actually the correct one.) Unfortunately I’m using a pretty complex dataset so I’m not sure if I’ll be able to create a representative example, but I can try if it becomes necessary.

Hi @Nick_Boyts

Have you tried using DS inside function? Below is an example:

@Kulkul, not sure if this is what you were getting at, but with both versions inside a function they still return different lists.

Hrm, that is odd behavior Nick … @Aparajit_Pratap any thoughts on this one?

I haven’t tested. Could you drop here dyn file with nodes and rvt file to test?

I think it is a bug, have encountered variations of this in the past and have sorted it by defining a variable. Long dotted or nested statements sometimes seem to cause trouble.

Have you tried enclosing the function in the second code block within parenthesis?

1 Like

@Kulkul I’ll get a sample file drawn up and share that.

@Vikram_Subbaiah I have tried parenthesis and that actually made it worse. Ended up roughly doubling the output list.

What type of data is T2?

T2 is a list of number ranges.

Example file and graph saved here.

Alternate Design Script. Hope this works for you

pc1 = pc.Intersect(pc<1><2>);
in1 = 0..(List.Count(pc)-1);
pc2 = List.RemoveItemAtIndex(pc1<1><2>,in1<1>);

Combining the same in a line…


I thought I had tried adjusting lacing but it must have been before I isolated the inconsistencies in the outputs.

The DS you posted has an extra level in it, but I can easily remove it with List.Flatten. However, trying to flatten it in the single line causes problems again.
Edit: Never mind. I missed the parenthesis around the number range when recreating the single line. Weird how that works here but not in my original code.

At this point I’m more just confirming that it is a bug. I can get everything else working.

1 Like

@Nick_Boyts could you confirm how you created the first and second code blocks? Did you type out the code, or did you use node-to-code and if you did one vs. the other, which is the code block with the manually written code vs. the node-to-code codeblock?

I honestly can’t remember exactly how I got to these specific codeblocks. Initially I manually rewrote the nodes into a codeblock, but once I noticed the discrepancies I used Node-to-Code to reaffirm that I translated everything correctly. There were no differences between either version when I checked.

Thank you @Nick_Boyts for pointing out this bug! This is a legacy issue that was found and fixed thanks to you and @dahlj! The fix should be available in 2.13 release!