Pipe Scripting issue

Hello Everyone,

I started creating a HMI on perspective and started using pipes, specifically the P&ID type. I encountered an issue and was wondering if I was just doing things wrong or anyone has a workaround for it.

So when you create pipes, it appears under screen>root.pipes on the project browser. It is arranged based on the order it appears on the page/view (top is farthest back, bottom is the front most). No issue there.

In order to change the pipe colors to indicate flow or product type in my case, I went to props window and put in a script on the item under pipes.

The issue:

The scripts are bound to the items on the pipes menu on props window and not the actual lines/pipes.

What happens is when I reorder my pipes on the page, the scripting gets messed up.

So lets say...

I have

pipe

pipe_0

pipe_1

on the project browser.

Then i have a script on pipe_1.

if I change the order to

pipe_1

pipe

pipe_0

the script I made will be bound to pipe_0.

I hope I explained this enough.

Appreciate all the feedback

Welcome to the forum.

Are you saying that you're layering copies of an identical pipe pattern and using a script to determine what's visible to change color?

If so, I would recommend a different approach.

Change the pipe color with a binding instead of a script. You should see a "stroke" property if you drill down into the pipe definition. You can have that change color by using a binding with a map transform to send a different color code based on state. Note, set your map transform to "Output Type" color.

I prefer to add a custom property to the object for state to handle this kind of binding and then map transform off of that custom property because it allows me to test my map transform by plugging numbers into the custom property (overriding their value) in the designer without manipulating the source value for the binding (such as a tag in the plc). Granted, it's a little awkward to do that with pipes because they will show blue when you have them selected so you have to deselect the pipe to see the color change based on your override.

Anyway, hopefully I said enough here to dial in a better understanding of what you're trying to. I made an animated GIF to hopefully illustrate what I'm trying to explain.

Pipe Color Animation