![background image](http://html1.mh-extra.com/html/omron/cx-supervisor/cx-supervisor_user-manual_744211269.webp)
Scripts
SECTION 20 Best Practices
268
To make Workspace navigation of objects easy, reduce the number of top
level objects by collecting objects together into Groups. Grouped objects
can be nested on other groups in a natural hierarchy e.g. a machine has
several panels that have keypads that have buttons.
•
Create object libraries
Keep a common look and feel between pages and speed up development
by creating libraries of commonly used objects e.g. displays or buttons.
These can also be reused in later projects.
•
Use Copy and Paste
Making good use of Copy and Paste to duplicate similar objects can
reduce development time.
•
Use Alignment functions
Create professional looking applications by prevent unsightly errors
quickly using 'Align Top/Left' and 'Make Same Width/Height'.
•
Draw perfect circles
Quickly draw perfect circles by holding <Ctrl> while drawing an Ellipse.
•
Use meaningful object names
Instead of accepting the default object and group names rename them to
something more helpful e.g. Conveyor1, InstrumentPanel, StartButton etc
20-5
Scripts
This section covers some good practices for writing scripts.
•
Never use ‘On Regular Interval’ scripts
You should (almost!) never need to use 'On Regular Interval' scripts.
Always question:
•
If it is used for logging - use the logging facilities instead
•
If it is used for timing - use PLC ladder instead as this is much more
reliable.
•
When they start with (or contain) "IF <condition> THEN …" you
should probably be using an "On Condition" script using <condition>
from the IF statement.
•
When they perform calculations on PLC or memory points (e.g. "Z =
X * Y), use "On Condition" to recalculate when the source data
changes e.g. with a condition X || Y || TRUE (which forces execution
even if value changes to value 0). This will guarantee the calculated
is up to date with the latest source information, plus stress the
system much less while the value doesn't change.
•
Never use the Sleep() command
You should (almost!) never need to use the Sleep command. It can also
create confusing applications as it can create re-entrant scripts and
asynchronous PLC communications. Always question:
•
If it is used for timing - use PLC ladder instead as this is much more
reliable.
•
Consider if the code following the Sleep should in fact be executed
on an event e.g. after completion flag returned from PLC instruction
or new data value etc
•
Use Animations if possible
Always choose direct object animations in preference to page/object
scripts: blink, colour, disable, height, width, horizontal%fill, vertical%fill,
move, rotate, display and close. These are both quicker and clearer.
Summary of Contents for CX-Supervisor
Page 1: ...CX Supervisor Software Cat No W10E EN 01 User Manual Software Release 3 1...
Page 3: ...Copyright Notice 2...
Page 16: ...15...
Page 17: ...16...
Page 27: ...Tip of the Day SECTION 1 Graphics Editor 26...
Page 35: ...CX Supervisor Preferences SECTION 2 Pages 34...
Page 79: ...Responding to Events SECTION 5 ActiveX Objects 78...
Page 115: ...Printing the Graphics Library SECTION 7 Graphics Library 114...
Page 181: ...Data Logging SECTION 11 Data Logging 180...
Page 201: ...Examples SECTION 12 Databases 200...
Page 243: ...Performance Monitor SECTION 16 Application Analysis Performance Monitor 242...
Page 253: ...Using with Omron s CX Server OPC SECTION 17 Using CX Supervisor as an OPC Cli 252...
Page 259: ...Creating a CX Supervisor Client application SECTION 18 Connecting to a remote CX 258...
Page 263: ...Adding a Point Linked to a Parameter SECTION 19 Connecting to Omron Industrial 262...
Page 271: ...Data Logging SECTION 20 Best Practices 270...
Page 275: ...Configuring a Server PC running Windows NT or 2000 Appendix A Configuring a PC 274...
Page 277: ...Appendix B Frequently Asked Questions 276...
Page 296: ...Appendix B Frequently Asked Questions 295...
Page 297: ...Appendix B Frequently Asked Questions 296...
Page 298: ...Appendix B Frequently Asked Questions 297...
Page 299: ...Appendix B Frequently Asked Questions 298...
Page 333: ...Revision history 332...