How to hide interfaces in a component?

Hello,
In my component, sometimes I need 4 interfaces and other times I only need 3.
I would like to control this so that unused interfaces are hidden. Is it possible to hide an interface when it’s not needed?

Hey,
i managed to do this with the following code:

conv = comp.getProperty("Conveyor")
conv.OnChanged = change

def change(arg):
  if conv.Value == True:
    comp.findBehaviour("INInterface").Enabled = True
    comp.findBehaviour("OUTInterface").Enabled = True
    comp.findBehaviour("SensorInterface").Enabled = True
  else:
    comp.findBehaviour("INInterface").Enabled = False
    comp.findBehaviour("OUTInterface").Enabled = False
    comp.findBehaviour("SensorInterface").Enabled = False

I’m not sure if there is a better solution, but this works for me.

1 Like

I tried the same, but it’s not working for me

What exactly is not working?
I know that the yellow connection triangles are visually still there, but i can’t connect them in PnP-Mode.

1 Like

Thanks, it’s working now. The PnP connection cannot connect. Is it possible to hide the yellow connection triangles?