Error: Asked to convert non-convertible types

I’m writing a script that goes through and tags all the pitch fork hangers in my active view.

When I run it in my little test project, you can see it runs fine.


However, when I try running it on an active project we’re working on I get an error.

Test%20in%20Active%20Project
image

I’ve made no changes to the script and the only thing that should have changed between them is the size of the file it’s looking at.

Has anyone seen this before and knows how to fix it?

Edit: Didn’t notice at time of post that the names of the important cells aren’t showing up:
image

Hi,

Take a look to the node just before that one, and try to see if there is not an out of place element. Try to check the types of all your elements, this might help.

I did. As I said in the post, it works fine in my test project, just not in the much bigger active project.

I think you did not quite understand me :sweat_smile:

While running the script on the “much bigger project”, try to see if there is not an unexpected output before the error ; i.e. check in the last screenshot all the output (all the 3494 family elements) of the Element.SetParameterValueByName node. (Are all the objects of this output elements ? Or is there some unusual object there ? )

The error may be caused by some other node outputting a null or by a ill-defined element in your project.

Oh. I see what you’re getting at. Yeah, going through that I found a few empty cells.

Do you think something like this would fix it?

You could try filtering those elements by there type, with List.FilterByBoolMask and Object.Type.

You’re a genius. Next rounds on me :beers:

1 Like

In case anyone in the future has this issue, this is what the fixed script looks like: