Moving Component Position with a Tag

Hi everyone,

I’m trying to move a component to fixed coordinates (x=100, y=100) when a tag (or property) named Vendor becomes True.

I know that it is a simple code, but I don't know why it's not working.

The script you’ve shown is only checking that the property which changed is Vendor. Not that its value changed to True.

Thank you for the help! What would be the correct command or approach to recognize when the property becomes true?

if event.propertyName == 'Vendor':
    if event.newValue:
        system.gui.transform(event.source, 100, 100)

Thanks! It is still not working.

I tried to print the event.newValue, but I don't see anything in the console, so the command is not being executed.

To give a little bit more context, the object that I am trying to move is a Valve template. I don't know if this information is needed.

Add a line to print what property changes are firing. If you don't see Vendor print then that is your problem.

print event.propertyName
if event.propertyName == 'Vendor':
    ...

It is not printing anything, so maybe I'm doing other things wrong.

I have the custom property "Vendor", and a few template properties, so it should print at least something right?

I am looking at the Output Console, but maybe I need to look somewhere else?

I am sorry, I am just getting expertise in scripting in Ignition.

It should definitely print something in the output console.

Show us how you have set up your template, and how you set up your custom property.

Also, if you're testing property change events in the Designer, you must activate 'preview mode' -- property change events are not fired while in design mode.

1 Like

Thanks Everyone for the help! It worked.

I had another script that was causing the problem, so this script never executed.

And indeed, I didn't know that I needed to activate the preview mode.

1 Like