Warning: List.GetItemAtIndex expects argument type(s) (var[]..[], int), but was called with (var[], var[])

Hi everyone,

First time using dynamo so apologies.

I’m trying to modify a script that I was provided with to change civil 3d pipe styles based on ARCGIS property data.

The ARCGIS property data I’m trying to use to set the style is called subtype and is set as either 10, 11 12 or 15.

I’m getting an error at List.GetItemAtIndex

Warning: List.GetItemAtIndex expects argument type(s) (var[]…[], int), but was called with (var[], var[]).

Can anyone shed any light on the issue?

Thanks in advance.

Michael

Make sure that the Index of the node is getting Integer values and not string or any other data types. You can use the Object.Type node to check it.

Hi @SeanP it is string!

How do I change this to interger?

Thanks!

@SeanP

Just to add some additional info, part of script shown below.

The property name is subtype and I want to use the number from subtype to assign the pipe style.

image

Have you done some searching?

@M_c3d Try the node String to Number.

1 Like

What part to I add the node? Is it the code block for a property value that needs to be numeric? Thanks!

Into the input of the list.getitematindex node, however i dont see that node in your screenshot, could you maybe post that part with the error?

Hey @Daan I’ve attached the script (sorry wasn’t able to do it previously as new member).

Also attached error at list.getitematindex

DataStylization_ApplyStylesFromExcel.dyn (51.0 KB)

That Dynamo graph looks familiar, how did you get hold of it?

Ramesh at the Infraworks team provided it.

That’s ok then, I made it for him. It was designed to work only for Property Sets with string values.

1 Like

Apologies, I had no idea it was yours! I had queried with Ramesh how to assign civil 3d pipe styles based on a property set from ARCGIS and he suggested amending this script to suit.

Is it possible to amend it to work with property sets that have integer values?

Thanks,

Michael


You also need to change the values in the associated Excel that I assume you have

Add this just in case

1 Like

Hi @Paolo_Emilio_Serra1 yes I have updated the excel to include the subtype.

It has came up with an additional error. The index seems to have an empty list.

DataStylization_ApplyStylesFromExcel.dyn (3.7 MB)

The Excel file is returning strings or integers? can you use the Watch node where it says features = a[0]; >? Also in the same output can you use the node Object.Type? Also take a screen shot of the Excel

1 Like

Yes excel using integers

image

I cannot see the output of Object.Type

1 Like

Apologies