how about the class?how could i use it?
This is seriously so useful! Didn't know you could do this, thanks for sharing!
Using a dummy binding then a script transform is awfully convenient but terrible for performance and maintainability. Use an expression binding with runScript()
that delegates to a project library script function. Avoid (most) script transforms.
Any other problems in your script aside, numpy doesn't work in a Jython environment, so this script will always fail on this line anyways.
Why is that, Phil? I'm just wondering happens under the hood? (Thank you for your education.)
I don't know precisely why (though I have vague suspicions), but it shows up clearly in the timing tests I did with my Integration Toolkit's debug and timing functions.
Thanks for the tips! I just recently started using more scripts (I had usually just stuck to expression bindings before) so this is all good information! Thank you!!
You should check out my Integration Toolkit module. Even if you don't end up using it, there are binding optimization discussions there, and linked, that will help you make performant, efficient systems. There are many things in Ignition that need jython scripts, but they can also be a crutch in other cases.
I'll do that! I'm currently looking for resources like this, so thank you!!
If your class has only one method (plus the init), there are chances it shouldn't be a class in the first place ;p
What is that class supposed to do, and how do you normally use it ?
Or, asked in a broader way: What are you trying to achieve with it ?
I want to calculate the cumulative downtime after the Stop signal is connected, and then call the Scirpt to pass in the Stop signal. Clear to zero every morning and evening at 8 o'clock