Revit and "space planning" | List.GetItemAtIndex fails

List.GetItemAtIndex fails

We are trying to rebuild the space planning script of "@kyle_martin_Gensler ". However, we run into the below 1st warning? Does anyone have a solution for this?

The problem seems to be in the input value “null” (see fig. 1 and fig. 2). Is there a solution to convert this? The “null” value comes from the attached Excel file (see also fig. 3).


Fig. 1


Fig. 2


Fig. 3

Source data attached.
Goal is wider dissemination of space planning scripts.

Source data:
202101_BGD_XX_ZZ_M3_A_0037_Space-planning.dyn (299.9 KB)
(v27 version Autodesk Construction Cloud)
Space Planning_sample program.xlsx (21.3 KB)
202101_BGD_XX_ZZ_M3_A_0036_Huis.rvt (5.2 MB)

Thanks in advance.

That’s actually column J which is reading incorrectly. Somehow someone put a value in that column and so the overall extents of the workbook include an additional column. Use a List.Clean method to resolve.

@JacobSmall

I don’t quite understand, can you give a little more info?

Thanks in advance

Index 9 is reading null.

A = 0. B = 1… G = 6. H = 7, I = 8 (the colors) J = 9.

Looking at the excel spreadsheet, there shouldn’t be any data in column J, and as such using a List.Clean with preserve indices set to false should get you going again.

@JacobSmall

Great (see fig. 1)
But is is there also a solution for e.g. an entire list 9 or entire range (see fig. 2 and fig. 3)?


Fig. 1


Fig. 2


Fig. 3

Thanks in advance

List.Clean should remove those too. Just make sure the entire excel spreadsheet has data in every cell you care about (ie don’t skip a department entry).

@j.boonen additionally you can select the entire Column J in Excel & delete. OR multiple columns from J > Right, as well as Rows at the end of your data to make extra sure you’re only capturing cells containing values. Then save Excel & re-run Dynamo to see if those Nulls have disappeared.

1 Like

The one thing to keep in mind here is that end users rarely keep work clean the way we’d like, and so those values further than the last column or row tend to come back and haunt us. List management becomes key to future proofing in such cases.

1 Like

@JacobSmall @kyle_martin_Gensler

I do indeed get rid of the 1st “Null” by cleaning up the Excel file (or Jacob’s method).

However, a little further into the script it still goes wrong, even after cleaning up the script here (see fig. 1 and fig. 2). The other input from the node you can see in fig. 3.

Do you also have a solution for that?


Fig. 1


Fig. 2


Fig. 3

Thanks in advance.

@j.boonen I cracked open your .DYN & figured out the problem… Firstly, @JacobSmall’s advice is wise to insert your List.Clean node as early on in the script to eliminate any Nulls that may occur from easy mistakes in the Excel file down the road:

Looking at the original script hi-res image I notice that the Excel output is feeding into List.Transpose (green arrow) while List.GetItemAtIndex feeds into the List.Combine (red arrow) in BOTH the Width & Length groups:

However in the Length group you accidentally mixed these up – likely because my screenshot is an overlapping mess of wires – in the Length group only (green & red Xs mean wrong):

So, if you switch these in your script should look like this:

Then the yellow warning on the List.GetItemAtIndex node goes away & the output is successful!

1 Like

@kyle_martin_Gensler @JacobSmall

Thanks a lot, problem solved!
This issue is off the table.

Fig-1
Fig. 1


Fig. 2

1 Like