Error when running script for insulation

Hi,
Im trying create a scirpt that applies insulation to pipe & pipe fitting after selecting the system type to apply it to. This worked in a bare bones model (blank test model) but when I ran it in the large project it failed. I believe it is because it is looking for a var and I am giving it a string. the first node (List.AllIndicesOf) throws the error “Warning: List.AllIndicesOf operation failed.
Object reference not set to an instance of an object.” and the second “Warning: Null value cannot be cast to Int32”.
does anyone know what the issue is here and how i can resolve it?
any help much appreciated friends.
I tried to attach the script but it wont let me :frowning:

Youll need to provide a better screenshot for someone to help you with this.

  1. Zoom into the canvas as far as it will go and then use the camera in the top right.

  2. Show us the data in all the nodes.

1 Like

I hope it is clearer in the image below.
the other thing I have notice is it is adding several system types that are the same in the pipe & pipe fitting selection. what could be causing this?

Can you try set the all Indeces of node lacing to longest?

Try removing nulls from the flattened list by adding a List.Clean node afterwards
Does the OOTB Element.Name node or a code node elem.Name; work?

Thanks Mike, list.clean worked. I have the issue now however where the insulation is failing to be applied. could this be because some pipework already had insulation applied?
image

1 Like

We ran a similar script here.
Where the insulation cannot be applied your instrict is correct it can be because it already has insulation.

In these cases you will need to instead setparmetervalue of insulation to the revised number