Advertisement
Advertisement
FactoryLink 6.6.0
Application Editor Guide
FactoryLink 6.6.0 / September/ 1998 / 000A*DOC-APE*000*660
©Copyright 1984 - 1998 United States Data Corporation. All rights reserved.
- NOTICE -
The information contained herein is confidential information of United States Data Corporation, a Delaware corporation, and is protected by United States copyright and trade secret law and international treaties. This document may refer to United States
Data Corporation as “USDATA.”
Information in this document is subject to change without notice and does not represent a commitment on the part of United
States Data Corporation (“USDATA”). Although the software programs described in this document (the “Software Programs”) are intended to operate substantially in accordance with the descriptions herein, USDATA does not represent or warrant that
(a) the Software Programs will operate in any way other than in accordance with the most current operating instructions available from USDATA, (b) the functions performed by the Software Programs will meet the user's requirements or will operate in the combinations that may be selected for use by the user or any third person, (c) the operation of the Software
Programs will be error free in all circumstances, (d) any defect in a Software Program that is not material with respect to the functionality thereof as set forth herein will be corrected, (e) the operation of a Software Program will not be interrupted for short periods of time by reason of a defect therein or by reason of fault on the part of USDATA, or (f) the Software Programs will achieve the results desired by the user or any third person.
U.S. GOVERNMENT RESTRICTED RIGHTS. The Software is provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the government of the United States is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or in subparagraphs (c)(1) and (2) of the
Commercial Computer Software—Restricted Rights clause at 48 CFR 52.227-19, as applicable. Contractor/Manufacturer is
United States Data Corporation, 2435 North Central Expressway, Suite 100, Richardson, TX 75080-2759. To the extent
Customer transfers Software to any federal, state or local government agency, Customer shall take all acts necessary to protect the rights of USDATA in Software, including without limitation all acts described in the regulations referenced above.
The Software Programs are furnished under a software license or other software agreement and may be used or copied only in accordance with the terms of the applicable agreement. It is against the law to copy the software on any medium except as specifically allowed in the applicable agreement. No part of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose without the express written permission of USDATA.
Trademarks. USDATA and FactoryLink are registered trademarks of United States Data Corporation.
Open Software Bus is a registered trademark licensed to United States Data Corporation.
All other brand or product names are trademarks or registered trademarks of their respective holders.
Application Editor in this book
Table of Contents
Application Editor
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Structure of the Application Editor Guide . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Application Editor at a Glance
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Part I Application Editor Basics
1 The Application Editor Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Referencing Objects in your Drawings . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Object Attributes and Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Power Packs and Power DragOns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Using an Icon for Windows NT and Windows 95 Platforms . . . . . . . . . . 34
Using the Start Menu on Windows 95 Platform . . . . . . . . . . . . . . . . . . . 34
Using the Configuration Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Using the Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2 Working With Drawing Files
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Working With Multiple Drawing Files Simultaneously . . . . . . . . . . . . . . . . 38
Opening an Existing Drawing File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
FactoryLink 6.6.0 / Application Editor / 3
•
•
•
•
Application Editor
3
4
5
6
Saving with the Original Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Saving with a New Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Sharing Drawings Between Applications
. . . . . . . . . . . . . . . . . . . . 45
Controlling Your View of the Drawing
. . . . . . . . . . . . . . . . . . . . . . . 51
Selecting Whole Drawing Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Viewing Actual Run-time Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Toggling Between Display Scales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Setting the Default Actual Size Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Configuring Run-time Windows
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Defining Window Size and Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Tag Definition Dialog
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
The Tag Definition Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
System Added Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4 / FactoryLink 6.6.0 / Application Editor
Application Editor
Defining Element Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Working with Element Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Simple Template Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7 Drawing Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
FactoryLink 6.6.0 / Application Editor / 5
•
•
•
•
Application Editor
8 Editing Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Cutting, Copying, Pasting, and Deleting Objects . . . . . . . . . . . . . . . . . . . . . 127
Moving and Object Front or Back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Renaming an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Searching for an Object in a Drawing . . . . . . . . . . . . . . . . . . . . . . . . . 137
9 Animating Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Testing the Animation of a Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6 / FactoryLink 6.6.0 / Application Editor
Application Editor
10
11
12
13
14
15
Animating Input/Output Fields
. . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Animating Text as an Output Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Animating a Chart
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Animating a Real-Time Only Chart Object . . . . . . . . . . . . . . . . . . . . . . . . . 164
Animating an Object as a Button
. . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Paint and Bar Animation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Animating an Object as a Symbol
. . . . . . . . . . . . . . . . . . . . . . . . . . 189
Animating Symbol Object to Represent a Value . . . . . . . . . . . . . . . . . . . . . . 190
Working With Power Packs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Guidelines for Using Template Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Displaying the Template Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Attaching Power DragOns to I/O Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Adding Security to Power DragOns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
FactoryLink Supplied PowerPacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Frames1, Frames2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
FactoryLink 6.6.0 / Application Editor / 7
•
•
•
•
Application Editor
16
Motors1, Motors2, Motors3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Pumps1, Pumps2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Drawing-Level Animation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
17 PowerVB Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
When to Use PowerVB vs.IML and CML . . . . . . . . . . . . . . . . . . . . . . . 236
Differences Between PowerVB and Microsoft Visual Basic . . . . . . . . . . . . . 236
Opening PowerVB from the Application Editor . . . . . . . . . . . . . . . . . . . . . . 237
Power VB Symbol Name memory Limitation . . . . . . . . . . . . . . . . . . . . . . . . 237
18 PowerVB Editor
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8 / FactoryLink 6.6.0 / Application Editor
Application Editor
19
20
21
Attaching a Script to an Object
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Adding Comments to a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Calculating Graphic Object Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Using Document PowerVB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Pasting to the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Object Names and Object IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
PowerVB Events
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Drawing Routines menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Mouse Routine Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Mouse Routines Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Troubleshooting – Overlapping Objects . . . . . . . . . . . . . . . . . . . . . . . . 268
Text Input Routines Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Adding a New Tag Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Modifying an Existing Tag Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Deleting an Existing Tag Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Using Variables to Declare PowerVB Objects
. . . . . . . . . . . . . . . . 275
Troubleshooting – Implicit Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Arrays as Implicit Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
RTDBObjectValue Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Arrays as Explicit Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
FactoryLink 6.6.0 / Application Editor / 9
•
•
•
•
Application Editor
22
Parent and Child Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Troubleshooting – Explicit Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Rules for Naming Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Using Properties and Methods in PowerVB
. . . . . . . . . . . . . . . . . 289
RTDBObject.Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
RTDBObject.Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
RedrawOn and RedrawOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
GraphicObject.Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
GraphicObject.Bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
GraphicObject.Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
GraphicObject.Height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
GraphicObject.Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
GraphicObject.Bold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
GraphicObject.Underline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
GraphicObject.LineColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
GraphicObject.FillColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
GraphicObject.BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
GraphicObject.TextColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
GraphicObject.Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
GraphicObject.Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
GraphicObject.BackgroundUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
GraphicObject.ActionValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
10 / FactoryLink 6.6.0 / Application Editor
Application Editor
23
24
25
GraphicObject.Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
GraphicObject.HasAnimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Drawing/Window Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Drawing Object Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Window Object Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Critical/EndCritical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
LockRTDB/UnlockRTDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
PowerVB Variables and FactoryLink Tag Types . . . . . . . . . . . . . . . . . . 310
Rotating Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Implementing Rotation in PowerVB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Composite Object Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
RedrawOn/RedrawOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
PowerVB User-Defined Sub Procedures and Functions
. . . . . . 319
Creating PowerVB Libraries and Templates
. . . . . . . . . . . . . . . . 323
Creating a PowerVB Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Using the PowerVB Library Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Calling a Library Function or Subroutine . . . . . . . . . . . . . . . . . . . . . . 326
FactoryLink 6.6.0 / Application Editor / 11
•
•
•
•
Application Editor
26
27
Hierarchical Graphic Object Naming
. . . . . . . . . . . . . . . . . . . . . . . 329
Naming Objects in the Application Editor . . . . . . . . . . . . . . . . . . . . . . 330
Referencing Graphic Objects in PowerVB Scripts . . . . . . . . . . . . . . . . . . . . 331
Debugging a PowerVB Script
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Reviewing Printed PowerVB Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Printing a Single Script or Part of a Single Script . . . . . . . . . . . . . . . . . . . . 340
On Error Statement at Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Using the BASIC Print Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Examples of Print Statements and the Output Generated . . . . . . . . . . 345
Print Statements with Multiple Running Events . . . . . . . . . . . . . . . . . 347
Header Information In Debug Output File . . . . . . . . . . . . . . . . . . . . . . 350
Location of Debug Output File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Disabling Debug Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Using LogView to Display Debug Output . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Using the Full Path Names Option When Viewing File Icons . . . . . . . 356
Refresh Rate and Updating Viewer Window’s File Contents Area . . . . 358
12 / FactoryLink 6.6.0 / Application Editor
Application Editor
PowerVB Code Attached to Sub-Objects . . . . . . . . . . . . . . . . . . . . . . . . 359
Execution Order at Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
28 Graphic Object Security Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . 363
Application Administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Planning Security for your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Deciding How Authorized Users Will Log in and Out . . . . . . . . . . . . . 369
Determining Object Security Requirements . . . . . . . . . . . . . . . . . . . . . 370
Implementing Security in your Application . . . . . . . . . . . . . . . . . . . . . . . . . 371
29
30
Configuring Security Using FLADMIN
. . . . . . . . . . . . . . . . . . . . . 375
Setting the Administrator Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Setting up Security Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
FactoryLink 6.6.0 / Application Editor / 13
•
•
•
•
Application Editor
31 Converting and Importing DXF Files
. . . . . . . . . . . . . . . . . . . . . . . 401
Installing the FactoryLink DXF Converter in Windows . . . . . . . . . . . . 402
Using the Default Conversion Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Customizing the Conversion Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Creating a Translate File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Using the Translate File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
32 Application Editor Messages
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
14 / FactoryLink 6.6.0 / Application Editor
Preface
P URPOSE
The FactoryLink 6.6.0 Application Editor Guide is an object-oriented drawing package with tools, such as straight and curved lines, circles, polygons, and text lines, used to graphically illustrate user interface screens in FactoryLink applications.
This guide is prepared to present the technical information programmers need to complete their applications.
The following guidelines help focus our purpose and goals to meet customer requirements:
• Accuracy is paramount—This FactoryLink documentation must provide accurate and reliable information and procedures.
• Time is valuable—This FactoryLink documentation must guide the programmer through what he needs to know quickly and efficiently.
A UDIENCE
The major audience of this manual is programmers who design and develop
FactoryLink applications.
In addition, FactoryLink Customer Support Services personnel use the procedures and examples included here to help you develop and troubleshoot your applications.
S TRUCTURE OF THE
A PPLICATION E DITOR G UIDE
The Application Editor Guide is part of the Core set of manuals in the overall
FactoryLink Documentation Set. Refer to the Preface in Fundamentals for the structure of the entire Documentation Set.
This manual is divided into seven major parts:
• Application Editor Basics
• Screen Construction
• Object Animation
• Power VB Animation
• Security
• DXF Converter
• Error Messages
FactoryLink 6.6.0 / Application Editor Guide / 15
•
•
•
• How To Use This Manual
H OW T O U SE T HIS M ANUAL
The material in this manual is presented sequentially in performance order. We recommend you read the entire manual to familiarize yourself with the complete procedure before you proceed to develop your application.
… at a Glance
Located within each part of this manual is a section named … at a Glance. This section provides a quick key to locations to find information to perform the procedures detailed in that part with hypertext links to those locations.
C ONVENTIONS
The material in the Documentation Set adheres to the guidelines published in The
Digital Technical Documentation Handbook by Schultz, Darrow, Kavanagh, and
Morse; Developing International User Information by Jones, Kennelly, Mueller,
Sweezy, Thomas, and Velez; and corporate style guidelines.
This manual uses the following conventions:
.
.
.
Convention
… italic type monospace type bold monospace type
Description
Horizontal ellipsis points indicate the omission of material from an example. The information is omitted because it is not important to the topic being discussed.
Vertical ellipsis points indicate the omission of information from an example or command format.
The information is omitted because it is not important to the topic being discussed.
Italic type is used to denote user-supplied variables in command examples.
Italic type also sets off references to specific documents.
Monospace type is used to denote command names and code examples or example output.
Bold monospace type is used in command examples to indicate words that must be typed literally.
16 / FactoryLink 6.6.0 / Application Editor Guide
Conventions
Convention sans serif type press nnnnn click on
Shift+F1
F1 F2 F3 nnnnn
File>Open
FLAPP\user\drw\mydrw.g
Description
Sans Serif type is used to set off field names, button names, and keys on the keyboard.
Press is used to denote a key on the keyboard. The key name will appear in a sans serif type.
Click on is used to denote a button on the screen.
The button name will appear in a sans serif type.
The + indicates the keys must be pressed simultaneously.
Shift+F1 indicates you hold down the Shift key while you press another key or mouse button
(indicated here by F1).
Other key combinations are presented in the same manner.
The space between the key callouts indicates press and release.
The key sequence F1 F2 F3 indicates you press and release F1, then F2, and then F3.
Other key combinations are presented in the same manner.
The > indicates a progression through a menu sequence.
File>Open indicates you choose Open from the File menu to perform the required action.
Other menu sequences are presented in the same manner.
The \ indicates the directory structure for the listed file.
FLAPP\user\drw\mydrw.g
indicates the drawing file mydrw.g
is located in the drw sub-directory of the user sub-directory to the FLAPP directory.
Other directory structures are presented in the same manner.
FactoryLink 6.6.0 / Application Editor Guide / 17
•
•
•
• Getting Help
Convention
[ ]
{ } and |
Description
Brackets indicate an optional argument. You can choose none, one, or all of the options.
Braces indicate a choice. You must choose one of the elements. The vertical bar separates choices within braces.
Example Syntax
Example syntax using these conventions is provided below: command input_file [input_file…] {a|b} output_file where command is typed as it is displayed in the syntax.
input_file indicates a variable the user supplies.
[input_file…] indicates the user can optionally supply multiple input file names, each name separated by a space.
{a|b} indicates either the a or b must be specified as an argument.
output_fil e indicates the user must specify an output file.
G ETTING H ELP
Contact your Sales or Customer Support Representative for help troubleshooting problems.
Also, help files are included for each configuration panel. These are accessed by clicking on Help on the panel menu bar.
18 / FactoryLink 6.6.0 / Application Editor Guide
Application Editor at a Glance
Using Application Editor
For details on performing the following steps...
1. Read what the Application Editor does, including
Graphic Elements as Objects (Referencing
Objects in your Drawings and Objects Attributes and Animation)
Power Packs and Power DragOns
Starting the Application Editor (Using an Icon for Windows NT and Windows 95 Platform,
Using the Start Menu on Windows 95 Platform,
Using the Configuration Manager, and Using the
Command Line)
The Application Editor Window
Exiting the Application Editor
2. Read about Working with Drawing Files, including Working with Multiple Drawing Files
Simultaneously
Opening Drawing Files (Opening an Existing
Drawing)
Creating a New Drawing File
Saving a Drawing File (Saving with the Original
Name and Saving with a New Name)
Deleting a Drawing File
Printing a Drawing File
Closing a Drawing File
3. Read about Sharing Drawing Between
Applications, including Exporting Files and
Importing Files.
Go to...
Chapter 2, “Working
With Drawing Files”
FactoryLink 6.6.0 / Application Editor Guide / 19
•
•
•
•
APPLICATION EDITOR AT A GLANCE
Using Application Editor
4. Read about Controlling your View of the
Drawing, including
Controlling the Grid
Using the Grid and Snap Options
Zooming On Object or Area (Zooming on
Object, Zooming on Area, and Zoom Out 100%)
Changing the Display Scale (Selecting Whole
Drawing Scale, Viewing Actual Run-time Size, and Toggling Between Display Scales)
Setting the Default Actual Size Window
5. Read about Configuring Run-time Windows, including Creating Run-time Windows, Defining
Window Size and Placement, and Setting the
Top Window.
6. Read about Tag Definition Dialog, including
Creating or Editing a Tag (The Tag Definition
Dialog, Creating a Tag, and Editing a Tag)
Tag Parameters
Tags Referencing Arrays (Defining Element
Arrays and Working with Element Arrays)
Working with Templates (Full Template Items and
Simple Template Items)
The Tag Dictionary
Basic Tag Definitions
Tag Persistence Definitions
General Alarm Definitions
Advanced Alarm Definitions
Group Alarm Definitions
Data-Point Logging Definitions
Scaling/Deadbanding Definitions
Device Interface
Chapter 4, “Controlling
Your View of the
Drawing”
20 / FactoryLink 6.6.0 / Application Editor Guide
APPLICATION EDITOR AT A GLANCE
Using Application Editor
7. Read about Drawing Objects, including
The Drawing Tools (Selecting Objects and
Undo)
Drawing Simple Objects
Drawing a Straight Line
Drawing a Spline (curved line)
Drawing a Square or Rectangle
Drawing a Polygon
Drawing an Ellipse (Circle or Oval)
Drawing an Arc
Drawing a Parabola
Drawing a Legend
Adding Text to a Drawing
Creating Composite Objects (Combining
Objects, Connecting Method, and Separating
Objects)
FactoryLink 6.6.0 / Application Editor Guide / 21
•
•
•
•
APPLICATION EDITOR AT A GLANCE
Using Application Editor
8. Read about Editing Objects, including
The Editing Tools
Setting Object Attributes
Setting Line Attributes
Setting Object Fill Attributes
Setting Text Attributes
Cutting, Copying, Pasting, and Deleting
Objects (Cutting an Object, Copying an Object,
Pasting a Object, and Deleting an Object)
Moving and Aligning Objects (Moving an
Object and Aligning Objects)
Rotating an Object
Snapping an Object to the Grid
Reshaping and Resizing (Reshaping an
Object, Resizing an Object, and Resizing Test)
Object Placement (Moving and Object Front or
Back)
Working with Object Names (Renaming an
Object and Searching for an Object in a Drawing)
9. Read about Animating Objects, including The
Animation Tools, Static and Animated Objects,
Dynamic and Static Attributes, Object Level
Animation, Testing the Animation of a Drawing,
Color/analog Value Table, and Blink Rate.
10. Read about Animating Input/Output Fields, including Animating Text as an Input Field and
Animating Test as an Output Field.
11. Read about Creating a Real-time Trend Chart, including Animating a Real-Time Only Chart
Object, Assigning a Pen for the Chart, and
Animating a Legend.
12. Read about Animating an Object as a Button.
Chapter 12, “Animating an Object as a Button”
22 / FactoryLink 6.6.0 / Application Editor Guide
APPLICATION EDITOR AT A GLANCE
Using Application Editor
13. Read about Paint and Bar Animation, including
Animating a Paint Object and Animating an
Object as a Bar.
14. Read about Animating an Object as a Symbol, including Animating Symbol Object to Represent a Value and Simulate Object Rotation.
15. Read about Working with Power Packs, including Guidelines for Using Template
Variables, Creating a Template Object, Using a
Template Object, Displaying the Template
Configuration, Combining Template Objects,
Unresolved Template Variables, Attaching Power
DragOns to I/O Devices, and Adding Security to
Power DragOns.
16. Read about Drawing-Level Animation, including
Print Screen Animation, Beep Animation, and
Function Key Animation.
17. Read about PowerVB Overview, including Opening
PowerVB from the Application Editor.
18. Read about PowerVB Editor, including
File Menu (Using the Import and Export Dialog)
Edit Menu
Search Menu
Event Menu
Help Menu
19. Read about Attaching a Script to an Object, including
Creating a Script
Calculating Graphic Object Movement
Chapter 14, “Animating an Object as a Symbol”
FactoryLink 6.6.0 / Application Editor Guide / 23
•
•
•
•
APPLICATION EDITOR AT A GLANCE
Using Application Editor
20. Read about PowerVB Events, including
Drawing/Window Events (Drawing Routines
Menu)
Mouse Events (Mouse Routine Arguments,
Mouse Routines Menu, and Troubleshooting -
Overlapping Objects)
Text Events (Text Input Routines Menu)
RTDB Events (Tag Routines Menu)
Defining Tag Events (Adding a New Tag Event,
Modifying an Existing Tag Event, and Deleting an
Existing Tag Event)
Declaring Events (Adding Comments to a Script and Removing an Event from a Script)
21. Read about Using Variables to Declare
PowerVB Objects, including
Implicit Variables (Troubleshooting and Arrays as Implicit Variables)
Explicit Variables (RTDBObject Value Function and Parent and Child Methods)
Troubleshooting-Explicit Variables (When to
Use Set and Meaningless Values)
24 / FactoryLink 6.6.0 / Application Editor Guide
APPLICATION EDITOR AT A GLANCE
Using Application Editor
22. Read about Using Properties and Methods in
PowerVB, including
RTDB Object Properties (RTDBObject.Value,
RTDBObject.Type, RTDBObject.Active, and
RTDBObject.Force)
Graphic Object Properties (“This” Object
Variable, RedrawOn and RedrawOff,
GraphicObject.Type, GraphicObject. Left,
GraphicObject.Bottom, GraphicObject.Width,
GraphicObject.Height, GraphicObject.Text,
GraphicObject.Font, GraphicObject.Bold,
GraphicObject.Italic, GraphicObject.Underline,
GraphicObject.LineColor,
GraphicObject.FillColor,
GraphicObject.BackColor,
GraphicObject.TextColor, GraphicObject.Name,
GraphicObject.BackgroundUpdate, and
GraphicObject.ActionValue)
Graphic Object Methods
(GraphicObject.Rotate, GraphicObject.Reset, and GraphicObject.HasAnimation)
Drawing/Window Object Properties (Drawing
Object Variable, Drawing.BackColor, Window
Object Variable, and Window.Title)
Miscellaneous Statements (Critical/EndCritical and LockRTDB/UnlockRTDB)
Public Variables (PowerVB Variables and
FactoryLink Tag Types)
Private Variables
23. Read about Rotating Objects, including
Overview (Definitions)
GraphicObject.Rotate
Implementing Rotation in PowerVB
(Composite Object Rotation, Sub-object
Rotation, and RedrawOn/RedrawOff
Development Rotation
Properties and Methods in PowerVB”
FactoryLink 6.6.0 / Application Editor Guide / 25
•
•
•
•
APPLICATION EDITOR AT A GLANCE
Using Application Editor
24. Read about Creating PowerVB Libraries and
Templates, including
PowerVB Libraries (Creating a PowerVB
Library, Using the PowerVB Library Editor, and
Calling a Library Function or sub-routine)
PowerVB Templates (Template Variables)
25. Read about Hierarchical Graphic Object
Naming, including
Overview
Object Names
Naming Objects in the Application Editor
Referencing Graphic Objects in PowerVB
Scripts (Implicit Referencing and Explicit
Referencing)
Performance Considerations
Object IDs (Finding an Object)
26 / FactoryLink 6.6.0 / Application Editor Guide
APPLICATION EDITOR AT A GLANCE
Using Application Editor
26. Read about Debugging a PowerVB Script, including
Printing PowerVB Code
Document PowerVB
Printing a Single Script or Part of a Single
Script
Other Debugging Methods
Error Message Box
On Error Statement at Run Time
Using Print Statements (Overview, Using the
BASIC Print Statement, Examples of Print
Statements and the Output Generated, Print
Statements with Multiple Running Events,
Header Information in Debug Output File,
Location of Debug Output File, and Disabling
Debug Output)
Using LogView to Display Debug Output
(Overview, Starting LogView, Selecting a File to
View, Using the Full Path Names Option When
Viewing File Icons, Viewing a File, and Refresh
Rate and Updating Viewer Window’s File
Contents Area)
Troubleshooting (Case Sensitivity Issues,
Reserved Words, PowerVB Code Attached to
Sub-Objects, Multi-threading, Endless Loops, and Execution Order at Run Time)
Chapter 27, “Debugging a PowerVB Script
FactoryLink 6.6.0 / Application Editor Guide / 27
•
•
•
•
APPLICATION EDITOR AT A GLANCE
Using Application Editor
27. Read about Security, including
Key Concepts (Application Administrator,
Application User, and Security Class)
FLADMIN
Security Options
Planning Security for your Application
(Deciding How Authorized Users Will Log In and
Out and Determining Object Security
Requirements)
Implementing Security in your Application
Security and Stacked Buttons
28. Read about Configuring Security Using
FLADMIN, including Accessing FLADMIN,
Defining a Security Class, Defining a User,
Setting the Password Type, and Setting the
Administrator Password.
29. Read about Setting up Security Options, including Setting Security Login Options,
Defining Error Messages, Defining Login
Messages, and Logging Security Events.
30. Read about Converting and Importing DXF Files, including
Conversion Considerations (Installing the
FactoryLink DXF Converter in Windows and
Installing the DXF Converter in OS/2)
Converting a Drawing
Using the Default Conversion Settings
(Conversion defaults)
Customizing the Conversion Settings
(Creating a Translate File and Using the
Translate File)
Troubleshooting (Conversion Errors and Error
Messages)
31. Read about Error Messages.
Chapter 31, “Converting and Importing DXF
28 / FactoryLink 6.6.0 / Application Editor Guide
Data Reporting Configuration Guide
Part I
Application Editor
Basics
29
Application Editor Guide
Chapter 1
The Application Editor
Overview
1
Operators access data in the real-time database through graphical user interface screens. You illustrate a graphical user interface screen by using the Application
Editor (APPEDIT) drawing tools—working with objects, such as straight and curved lines, circles, polygons, and text lines.
Each screen is represented by a file. These files are stored under
{FLAPP}>domain>drw , with the default domain, USER. A .g extension identifies the files as FactoryLink application screens. A base set of graphic files is delivered with FactoryLink to be used to build custom screens for your application. See the
FactoryLink On-line Release Notes for a list of the files shipped with this version of FactoryLink.
The Application Editor is an object-oriented drawing package. This means each graphic element, such as a line, a circle, or a piece of text is seen as an individual object. Each object can have assigned attributes and animation characteristics.
• Attributes control the look of the object, such as its color or text size.
• Animation controls the action of the object, such as a color change when a limit is met.
This chapter describes the concepts you must understand to use the Application
Editor. The topics included are
• Graphic elements as objects
• How to open and exit the Application Editor
• Managing your drawing files
• Controlling how your screens work during run time
FactoryLink 6.6.0 / Application Editor Guide / 31
•
•
•
•
THE APPLICATION EDITOR OVERVIEW
Graphic Elements as Objects
G RAPHIC E LEMENTS AS O BJECTS
A screen usually includes several components or objects. Some objects, such as the straight lines in the following illustration, stand alone. Others are combined into more complex shapes.
Text lines, such as the one in the illustration, are separate objects. Each object is either a simple object, a composite object, or a subobject.
• Simple objects are single objects, such as lines, circles, and text, that are not composed of any other objects. They are the basic building blocks of a graphics display. The top and bottom lines as well as the text are simple objects in the illustration above.
• Composite objects are collections of objects. That is, two or more objects grouped together to form a single object. The button in the illustration is a composite object.
• Subobjects are the components of the composite object. Subobjects contain either simple objects, composite objects, or both. The button is composed of one simple object, the octagon, and one composite object, the two rectangles.
Referencing Objects in your Drawings
The Application Editor uses object names to reference each simple, composite, or subobject. When an object is created, the Application Editor generates and assigns a number, such as #00137, to the object. To help you identify the objects later, we recommend renaming them with text based references, such as Stop App Button.
Refer to “Renaming an Object” on page 134 for details on how to do this.
Object Attributes and Animation
You assign attributes and animation to an object. Attributes control how it is displayed, such as its color, fill pattern, or text style. Refer to
“Setting Object Attributes” on page 117 for details on defining object attributes.
Animation controls the action of the object, such as a color change when a limit is met. Refer to “Object Animation” in this guide for details on defining object animation.
32 / FactoryLink 6.6.0 / Application Editor Guide
THE APPLICATION EDITOR OVERVIEW
Power Packs and Power DragOns
P OWER P ACKS AND P OWER D RAG O NS
Drawings containing objects animated as templates and placed in a library of drawings are collectively known as Power Packs. You create and animate the objects once and place them in Power Packs for repeated use. These drawings, known as Power DragOns, are then used to create applications quickly and easily.
The also help standardize the appearance of the application.
Power Pack files work like any drawing file, except that when you open a Power
Pack file, the Application Editor is automatically in the copy/paste mode. When you select an object from a Power Pack drawing, the Application Editor immediately copies it into the buffer so it can be pasted into an open drawing file.
All Power Pack files have a .gp
extension.
A basic set of Power Packs are included with FactoryLink. These Power Packs include an assortment of buttons, sliders, gauges, valves, pumps, motors, and
vessels. Refer to Chapter 15, “FactoryLink Supplied PowerPacks” for a complete
description of the supplied Power Packs and their associated Power DragOns.
The template animation allows you to animate an object with variables. When you duplicate an object in normal graphics drawing, you must edit the animation for the new object after it is duplicated. With template animation, you can define which animation features are constant or variable for each duplicated object.
When the object is duplicated, you are prompted to provide definitions for variable animation features.
Objects defined using variables are template objects, and the variables defined in the object are template variables. Any object, whether simple or composite, becomes a template object when you define one or more template variables.
Refer to “Working with Power Packs” on page 195 for details on how to create your own Power Packs and Power DragOns.
1
FactoryLink 6.6.0 / Application Editor Guide / 33
•
•
•
•
THE APPLICATION EDITOR OVERVIEW
Starting the Application Editor
S TARTING THE A PPLICATION E DITOR
The Application Editor can be started using up to four different methods, depending on the platform you are developing your application on.
Using an Icon for Windows NT and Windows 95 Platforms
If you are running FactoryLink on a Windows NT or Windows 95 platform, you can start the Application Editor from the FactoryLink Program Group.
Double-click here to open the Application
Editor
To start, double-click on the Application Editor icon for the application you would like to work on. If you have more than one application, you may have more than one program group. Be sure to select the program group for the desired application.
Using the Start Menu on Windows 95 Platform
Windows 95 provides an alternative for starting the Application Editor. Use the
Start Menu as follows to open the appropriate program group and Application
Editor:
Start > Programs > {FactoryLink 6.6.0 Program Group} > Application Editor
Using the Configuration Manager
Choose Application Editor to start the Application Editor from the Configuration
Manager Main Menu.
34 / FactoryLink 6.6.0 / Application Editor Guide
THE APPLICATION EDITOR OVERVIEW
The Application Editor Window
Using the Command Line
Enter the following command to start the Application Editor from the command line:
APPEDIT
T HE A PPLICATION E DITOR W INDOW
After starting the Application Editor, the following window displays.
1
The menu bar at the top of the screen provides the following menus and commands:
• File includes commands that provide access to manipulate entire drawings.
• Edit includes commands for selecting and editing objects.
• View includes commands for controlling what you see on-screen and which tools are available for drawing use.
• Draw includes commands for drawing all objects.
• Attributes includes commands for specifying the line, fill, text, and screen styles, and for defining an object name.
• Animation includes commands for specifying animation included in the drawing during run time.
• Application includes commands for specifying application attributes.
• Windows includes commands for specifying the tiling or cascading of open drawing files and a list of the open drawings to allow you to switch to another open drawing easily.
• Help includes menu and application help.
Instructions for how to use these commands are described throughout this manual.
FactoryLink 6.6.0 / Application Editor Guide / 35
•
•
•
•
THE APPLICATION EDITOR OVERVIEW
Exiting the Application Editor
E XITING THE A PPLICATION E DITOR
Perform the following steps to close the Application Editor.
1 Choose File>Exit to close he Application Editor.
Caution: This is the only correct way to exit the Application
Editor. If you use any other method to exit, you may lose or corrupt data.
2 The Warning!
dialog displays if you modified any files since the last save.
3 Click on the appropriate command button.
Save Saves the changes before closing the file.
Discard Closes the file without saving the changes. Any element names created are retained in the object list.
Cancel Cancels the close of the file and returns you to the open drawing.
36 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 2
Working With Drawing
Files
2
Each user interface screen is a unique drawing file. Drawing files are stored in the
FactoryLink application directory structure. The drawings created in the USER domain are stored in {FLAPP}\user\drw while the drawings created in the SHARED domain are stored in {FLAPP}\shared\drw . Most applications are created with all drawings in the USER domain.
Caution: All drawings in an application should be in a single domain, preferably the USER domain.
Unpredictable results may occur if drawings exist in more than one domain in an application.
Two different drawing file types are used within FactoryLink: standard drawing and power pack drawings. Either type can be exported from its application and imported into another application. FactoryLink uses the following file extensions to identify each type of drawing file:
.g
.gp
Identifies a standard drawing file
Identifies a power pack drawing file
.gx
.gpx
.gs
.gc
Identifies an exported drawing file
Identifies an exported power pack drawing file
Identifies PowerVB source code
Identifies compiled PowerVB code
.gps
.gpc
.pls
.plc
.plx
Identifies PowerVB source code associated with a power pack
Identifies compiled PowerVB code associated with a power pack
Identifies PowerVB library source files
Identifies compiled PowerVB library files
Identifies exported PowerVB libraries
FactoryLink 6.6.0 / Application Editor Guide / 37
•
•
•
•
WORKING WITH DRAWING FILES
Working With Multiple Drawing Files Simultaneously
W ORKING W ITH M ULTIPLE D RAWING F ILES S IMULTANEOUSLY
You can have multiple drawing files open at the same time; however, only one will be active at a time. The drawing file on top of the others is the active drawing file.
When you create or open a drawing file, the file name assigned to the drawing is added to a list of open files. You can view this list from the Windows menu. The active drawing file has a check mark next to its name.
Check mark indicating active window
To make a listed drawing file active, choose it from this menu. All actions described in this manual act on the active drawing file unless otherwise noted.
38 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH DRAWING FILES
Opening Drawing Files
O PENING D RAWING F ILES
When the Application Editor is first started, it opens into the USER domain. If you are developing drawings in the SHARED domain, you need to change the domain by choosing Switch Domain from the Application menu. For the purposes of our discussions here, we will use the USER domain unless noted otherwise.
Opening an Existing Drawing File
Perform the following steps to open an existing drawing file:
1 Choose File>Open to display the Open USER Domain Drawing dialog.
2
2 Choose the drawing from the list displayed below the File Name: field. The drawing name you choose is displayed in the File Name: field.
3 Click OK to complete opening the drawing.
Note: Double-clicking on the drawing name in the list also opens the file directly.
FactoryLink 6.6.0 / Application Editor Guide / 39
•
•
•
•
WORKING WITH DRAWING FILES
Creating a New Drawing File
C REATING A N EW D RAWING F ILE
Perform the following steps to open a new drawing file:
1 Choose File>Open to display the Open USER Domain Drawing dialog.
2 Double click in the File Name: field to highlight the currently selected drawing name and enter a 1 to 8 character name in the File Name: field.
The Application Editor adds the .g
extension for you.
3 Click OK to complete opening the newly created drawing file. The screen displays in grey, the FactoryLink screen default color. To change the color at this time, choose Screen Color from the Attributes menu and make your selection from the color palette displayed.
40 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH DRAWING FILES
Saving a Drawing File
S AVING A D RAWING F ILE
There are two ways to save a drawing file:
Save Save retains changes you made to the active (frontmost) drawing.
The new version of the drawing replaces the old version.
Save As Save As allows you to save a copy of the active drawing using a different name. If you make changes to the drawing prior to duplicating it, the original drawing remains unchanged when you use Save As.
Saving with the Original Name
Perform the following step to save the drawing with its original name after making changes:
1 Choose File>Save . The file that existed before you made modifications is overwritten.
Saving with a New Name
Perform the following step to save the drawing with a new name:
1 Choose File>Save As to display the Save USER Domain Drawing As dialog, if you are currently working in the USER domain. This is the default domain for the
Application Editor.
2
FactoryLink 6.6.0 / Application Editor Guide / 41
•
•
•
•
WORKING WITH DRAWING FILES
Saving a Drawing File
Choosing Save As displays the Save SHARED Domain Drawing As dialog, if you are currently working in the SHARED domain.
You can only work in one domain at a time; therefore, if you want to change domains, you must close all open drawings and switch domains by choosing
Application>Switch Domains . To save a drawing to a different domain, you must export and then import into the other domain.
2 Double click in the File Name: field and enter a 1 to 8 character name. The
Application Editor adds the .g
extension for you.
3 Click on OK to complete the save.
42 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH DRAWING FILES
Deleting a Drawing File
D ELETING A D RAWING F ILE
Perform the following steps to delete a drawing file:
1 Choose File>Delete to display the Delete File dialog.
2
2 Select the drawing from the list displayed below the File Name: field. The files listed are the same type as the current active window ( .g
for a drawing file, .gp
for a power pack window) and in the same domain.
To select a different file type, press the down arrow from the scroll box in the File
Type: field. The list in the File Name: field changes to display the appropriate drawing files.
To select a different domain, choose it from the Domains: field. The list in the File
Name: field changes to display the appropriate drawing files.
3 Click on OK to complete the deletion.
Note: When you delete a file, the elements defined in the file are also deleted from the cross-reference list; however, the element names remain in the object list.
FactoryLink 6.6.0 / Application Editor Guide / 43
•
•
•
•
WORKING WITH DRAWING FILES
Printing a Drawing File
P RINTING A D RAWING F ILE
Perform the following steps to print a drawing file:
1 Choose File>Print Screen to send the drawing file to the default printer the operating system configured.
C LOSING A D RAWING F ILE
Perform the following steps to close a drawing file (only the active or frontmost drawing is closed with this action):
1 Choose File>Close to close the file.
2 The Warning!
dialog displays when you close a drawing that has been modified but not saved.
3 Choose one of the following command buttons:
Save Saves the changes before closing the file.
Discard Closes the file without saving the changes. Any element names you created are retained in the object list.
Cancel Cancels the close of the file and returns you to the open drawing.
44 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 3
Sharing Drawings
Between Applications
You share drawings between applications or domains by exporting them from one application or domain and importing them into another.
3
FactoryLink 6.6.0 / Application Editor Guide / 45
•
•
•
•
SHARING DRAWINGS BETWEEN APPLICATIONS
Exporting Files
E XPORTING F ILES
Exporting a drawing file saves the file in a multiplatform format so it can be easily shared between FactoryLink applications on any platform. Exporting converts the drawing into an ASCII file. The converted ASCII file not only includes the drawing objects, but it can also include the object animation and element definitions.
The file is exported to the {FLAPP}\domain\drw directory of the current application, where domain is the domain of the file being exported. The ASCII file is named the same name as the selected drawing with the letter x appended to the file extension.
For example, if you export a file named mydraw.g
, the resulting ASCII file is named mydraw.gx
. This is true for power pack drawings as well. If you export a power pack drawing named mypwrdrw.gp
, the resulting ASCII file is named mypwrdrw.gpx
.
Perform the following steps to export a drawing file:
1 Choose File>Export to display the Export dialog.
2 Select the drawing from the list displayed below the File Name: field. The files listed are the same type as the current active window ( .g
for a drawing file, .gp
for a power pack window) and in the same domain.
46 / FactoryLink 6.6.0 / Application Editor Guide
SHARING DRAWINGS BETWEEN APPLICATIONS
Exporting Files
Press the down arrow from the scroll box in the File Type: field to select a different file type.
To select a different domain, choose it from the Domains: field.
You may select more than one file name to export multiple files.
3 Choose the appropriate radio button in the Options field.
Graphics only Exports only the graphics of the drawing. Animation and configuration details are not included.
Graphics + animation
Exports the drawing graphics with the included animation. You cannot import animation if it has not been saved with the export.
Graphics + all configuration
Exports the drawing graphics with the included animation and configuration settings, such as alarms, scaling, or I/O.
4 Click the OK button to complete the export. Clicking on Cancel cancels the export.
Caution: Do not edit the converted ASCII file.
3
FactoryLink 6.6.0 / Application Editor Guide / 47
•
•
•
•
SHARING DRAWINGS BETWEEN APPLICATIONS
Importing Files
I MPORTING F ILES
Importing converts the exported ASCII drawing files from other FactoryLink applications or domains to files that are readable by this FactoryLink application or domain. The import places the element definition information included within the file in the object database.
The file is imported to the {FLAPP}\domain\drw directory of the current application, where domain is the destination domain selected when importing the files. The drawing file is named the same name as the selected import with the letter x removed from the file extension.
Perform the following steps to import the drawing file to an application:
1 Choose File>Import to display the Import dialog.
2 Select the drive where the files to import are located from the Drives: field and the appropriate directory from the Directory: field.
If the path shown in the directory field is not accurate, double click the two dots
(..) in the Directory: list to display path elements.
3 Select the drawing from the list displayed below the Files field. The files listed are the same type as the current active window ( .gx
for a drawing file, .gpx for a power pack).
Press the down arrow key from the scroll box in the File Type: field to select a different file type.
48 / FactoryLink 6.6.0 / Application Editor Guide
SHARING DRAWINGS BETWEEN APPLICATIONS
Importing Files
4 Select the destination domain from the Destination Domain field.
5 Deselect the appropriate check boxes, if you want to change the default settings for the messages that display as you import files.
Before replacing files
Warns if existing files will be overwritten.
Before creating tags
Indicates when new tag names will be added. (This is especially helpful if you are using FactoryLink Lite which only allows a total of 1024 application defined tags.)
When tag definition is different
When tag usage is different
Indicates these elements have already been defined with different type, domain, length, or dimensions.
Indicates these elements have already been defined with a different configuration, such as alarms, and I/O.
6 Choose the appropriate radio button in the Options field.
Graphics only Imports the drawing graphics only. If the exported file was saved with animation, the animation will not be imported.
Graphics + animation
Graphics + all configuration
Imports the drawing graphics with the animation that was saved with it. If the exported file was not saved with animation, the animation will not be imported.
Imports graphics, animation, and all configuration such as alarms, scaling, or I/O.
7 Click on Import to complete the import. Click on Cancel to cancel the import.
3
FactoryLink 6.6.0 / Application Editor Guide / 49
•
•
•
•
SHARING DRAWINGS BETWEEN APPLICATIONS
Importing Files
50 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 4
Controlling Your View of the Drawing
4
This chapter describes how to control the view of your drawing. You can control the following features:
• How the grid is displayed
• How much of an object or area is viewed
• The display scale the drawing is shown in
• Default actual size window for all drawings in editing session
A drawing must be open to perform these actions.
FactoryLink 6.6.0 / Application Editor Guide / 51
•
•
•
•
CONTROLLING YOUR VIEW OF THE DRAWING
Controlling the Grid
C ONTROLLING THE G RID
The Grid is used for precision drawing. It works with the Snap option to allow you to draw, size, and place objects exactly.
Perform the following steps to turn on the Grid and define how it displays:
1 Choose View>Grid to display the Grid/Snap Options dialog.
Grid Allows you to turn on the grid and to define how it is displayed.
Snap Allows you to turn on the Snap option and to define the snap tolerance.
Logical Coordinate
System
Displays the width and height of the screen in drawing units. The default is 1024 for the width and 768 for the height. Do not change these values.
2 Select the Show Grid check box to display the grid.
3 Select the Draw with solid lines check box to display the grid with solid lines.
Deselect the check box to display the grid with dotted lines.
Define the Number of Grid Lines Displayed
4 The Make Grids Square check box is selected to display a square grid. The grid is calculated based on the Horizontal Grids field entry. When this option is selected, the Vertical Grids: and the Snap Points/Vertical Grid: are deactivated.
52 / FactoryLink 6.6.0 / Application Editor Guide
CONTROLLING YOUR VIEW OF THE DRAWING
Controlling the Grid
5 Deselect the check box to display the grid based on the values established in the
Horizontal and Vertical Grids: field.
4
6 Enter the values to control the grid size in the Horizontal Grids: and Vertical Grids: fields.
Horizontal Grids: Number of grids displayed in a row. This number can be any number between 1 and the number displayed in the Logical
Coordinate System Width field. Using the default 64, the following illustrates where the grid lines will be displayed along a width of
1024 points.
Points 1 16 32 48
. . .
1008 1024
Grid Lines 1 2 3 4 63 64
Width = 1024 points
If Horizontal Grid is 64, there is a grid line every for a total of 64 lines displayed (1024 ÷ 64 = 16).
Vertical Grids: Number of grids displayed in a column. This number can be any number between 1 and the number displayed in the Logical
Coordinate System Height field. This option is not available when
FactoryLink 6.6.0 / Application Editor Guide / 53
•
•
•
•
CONTROLLING YOUR VIEW OF THE DRAWING
Controlling the Grid the Make Grids Square option is activated. Using the default 48, the following illustrates where the grid lines are displayed along a height of 768 points.
Grid Lines
1 1
Points
2
3
16
32
Height = 768 points
If Vertical Grid is 48, there is a grid line every
16 points for a total of
48 lines displayed
(768 ÷ 48 = 16).
47 752
48 768
Define Snap Tolerance
7 The Enable Snap Points check box is defaulted to turn on the snap option. Enter the values to control the tolerance of the snap in the Snap Points/Horizontal Grid: and Snap Points/Vertical Grid: fields.
Snap
Points/Horizontal
Grid:
Number of snap points within a grid box an object will snap to as it is moved left or right.
Snap
Points/Vertical
Grid:
Number of snap points within a grid box an object will snap to as it is moved up or down. Grids: field.
Snap Point set at 2
(default)
Snap Point set at 4
1
2
1
2
3
4
1 2 1 2 3 4
54 / FactoryLink 6.6.0 / Application Editor Guide
CONTROLLING YOUR VIEW OF THE DRAWING
Using the Grid and Snap Options
U SING THE G RID AND S NAP O PTIONS
Snap can be used in two ways—by enabling the snap function in the Grid/Snap
Options dialog as detailed in “Controlling the Grid” on page 52 or by selecting the
items to be snapped individually and applying the snap command.
To snap an object to the grid perform the following steps:
1 Select the objects to snap.
2 Choose Edit>Snap . This snaps the four corners of the object bounding box to the nearest snap points.
The object is resized to fit its new bounding box.
4
FactoryLink 6.6.0 / Application Editor Guide / 55
•
•
•
•
CONTROLLING YOUR VIEW OF THE DRAWING
Zooming on Object or Area
Z OOMING ON O BJECT OR A REA
The zoom feature controls how much of the object or drawing is displayed in the graphics window. Zoom magnifies the object or area for detailed editing. This section describes how to magnify an object or an area in the drawing.
Zooming on Object
Perform the following steps to magnify an object or group of objects in the drawing:
1 Select the object or group of objects you want to magnify.
2 Choose View>Zoom on Object . The selected objects are magnified.
3 Choose View>Zoom on Object again and the objects magnify again. Objects can be magnified until they fill the entire drawing window. They will not be magnified out of view.
4 Choose View>Zoom Out 100% to return the object to normal size.
Zooming on Area
Perform the following steps to zoom on an area in the drawing:
1 Choose View>Zoom on Area.
2 Place the cursor over the starting position of the area you want to magnify and click and hold down the left mouse button.
3 Drag the cursor over the area you want to magnify. A box is displayed indicating the selected area.
4 Release the mouse button. The area within the box is magnified.
5 Choose View>Zoom Out 100% to return the area to normal size.
Zoom Out 100%
Perform the following step to return a zoomed object or area to normal size:
1 Choose View>Zoom Out 100% to return the area to normal size.
56 / FactoryLink 6.6.0 / Application Editor Guide
CONTROLLING YOUR VIEW OF THE DRAWING
Changing the Display Scale
C HANGING THE D ISPLAY S CALE
When you are creating a drawing, you can view the entire drawing using the whole drawing scale. This view helps you make overall composition and layout decisions for the drawing.
Depending on the size of your drawing window, the drawing may not necessarily be at the same scale as it will display in the run-time application. You can view how the drawing will display in the run-time application using the actual size scale.
While creating a drawing, you can change between each of these scales. This section describes how to select each scale.
Selecting Whole Drawing Scale
Perform the following step to view the entire drawing:
1 Choose View>Whole Drawing to display the entire drawing in the drawing window. If you change the size of the window, the drawing scales to the new window size.
Viewing Actual Run-time Size
At run time, the drawing is placed proportionally into its associated run-time window. Perform the following steps to view the drawing as it will display at run time:
1 Ensure you have a window defined where the drawing will be displayed. Refer to
Chapter 5, “Configuring Run-time Windows” for details.
2 Choose View>Actual Size to display the Frame Window Selection dialog, listing the windows available for displaying drawings at run time.
4
FactoryLink 6.6.0 / Application Editor Guide / 57
•
•
•
•
CONTROLLING YOUR VIEW OF THE DRAWING
Changing the Display Scale
The available windows are listed in the Window: field.
3 Select the window where the drawing will be displayed from those provided in the
Window list. The drawing is displayed in the selected window.
If you resize the drawing window so it is larger than its run-time window, a line is displayed showing where the run-time window ends.
Run-time window size
Actual size window
If you draw in this area, it does not display at run time.
Limit of run-time window
If you draw outside the run-time window size, the objects in this area do not display at run time.
Resizing the actual size window during development does not change the size of the drawing at run time.
If you view the drawing at actual size and then save it, the association with this actual size window is saved. The next time you open it, you can press F7 (Toggle
View command) to view it in this actual size window.
Toggling Between Display Scales
All drawings are displayed in whole drawing view when you open them. For drawings that have an association with an actual size window, you can toggle between the full window scale and the actual size scale in one of two ways:
• Press the F7 function key.
• Select View>Toggle View.
58 / FactoryLink 6.6.0 / Application Editor Guide
CONTROLLING YOUR VIEW OF THE DRAWING
Setting the Default Actual Size Window
S ETTING THE D EFAULT A CTUAL S IZE W INDOW
You can associate a default actual size window with all drawings for an editing session by using the w program argument when starting the Application Editor.
This default does not apply to drawings that already have an actual size window association, only those that do not. This is especially useful if you have several drawings not associated with actual size windows you want to view in the same actual size window.
You can set this program argument starting the Application Editor from the command line using the following command: appedit -w actualsize_window where actualsize_window is the name of the window where the drawing displays at run time.
For example, the following command: appedit -w fl_main defines fl_main as the default actual size window for this editing session.
If you start the Application Editor from the Configuration Manager Main Menu or the Program Manager, you cannot set a default actual size window.
4
FactoryLink 6.6.0 / Application Editor Guide / 59
•
•
•
•
CONTROLLING YOUR VIEW OF THE DRAWING
Setting the Default Actual Size Window
60 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 5
Configuring Run-time
Windows
5
At run time, drawings are displayed in windows. The window controls how the drawing is displayed: its size and position. You can have multiple window definitions, depending on how many unique types of windows you want to use to display drawings. For example, you can have a large window to display large drawings and a smaller window to display smaller drawings.
To display a drawing at run time, you must specify a window for displaying it.
This chapter describes how to associate a drawing with a window for run-time display.
You can have multiple drawings displayed in the same window by configuring an input text field or button to permit you to change the drawing displayed in the window.
You can have multiple windows open when the Run-Time Manager is started, and you can specify which of these windows should be displayed on top of all the other windows. This chapter describes how to specify which window is the top window.
FactoryLink 6.6.0 / Application Editor Guide / 61
•
•
•
•
CONFIGURING RUN-TIME WINDOWS
Creating Run-time Windows
C REATING R UN TIME W INDOWS
This section explains how to set up a run-time window and how to specify the drawing you want to display in it.
1 Choose Application>Window Setup to display the Edit Window Selection dialog.
2 Either select a window name from the Window list or enter a window name between 1 and 16 characters in the Window field. You should restrict this to 8 characters if portability is an issue.
3 Click on OK to display the Window Attributes dialog.
Window you are configuring is listed here.
62 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING RUN-TIME WINDOWS
Creating Run-time Windows
4 Select the Size Border check box to specify whether or not to display a sizing border around the window. The sizing border allows you to resize the window at run time. If the sizing border is present, the cursor changes to a double-sided arrow when it crosses the window border.
If you do not specify a sizing border, you cannot adjust the size of the window using the cursor at run time.
5 Select the Title Bar check box to specify whether or not to display a title bar showing the name of the window. A title bar allows you to move the window at run time.
All windows under Motif have a title bar whether or not you select this option.
6 Select the Maximize Button check box to specify whether or not to display maximize/minimize buttons. If selected, the maximize/minimize buttons are located in the top-right corner of the window. The maximize button makes the active window full screen; the minimize button makes the active window an icon.
If you do not select this option, you cannot maximize or minimize the window at run time.
Note: Selecting the Maximize Button also enables the System
Menu, even though the System Menu check box remains unchecked.
7 Select the System Menu check box to specify whether or not to display a button that lets you open the System Menu from this window. If selected, the System
Menu button is located at the top-left corner of the window and has a small horizontal line.
The System Menu provides the following capabilities:
Restore Restores the window to its original size after it has been minimized or maximized.
Move Allows you to move the window without dragging the cursor.
To move a window, choose Move and move the pointing device.
The window moves with the cursor. When the window is in the desired location, press the left button. The window remains in its new location.
Size Activates the window’s size borders so you can resize the window.
When the window is the desired size, press the left button. The window remains at its new size.
Minimize Shrinks the window to an icon.
5
FactoryLink 6.6.0 / Application Editor Guide / 63
•
•
•
•
CONFIGURING RUN-TIME WINDOWS
Creating Run-time Windows
Maximize Displays the window in a full screen size.
Close This option is always disabled.
8 Select Resize Behavior>Clip to specify whether or not the objects in a window remain the same size when you resize a window. This means the window gets smaller but the objects do not. If you select this option and size a window too small to hold the entire drawing, you will only be able to see part of the drawing.
Title Bar displayed
Graphic clipped during run time when window is resized.
Maximize and Minimize buttons display here during run time.
9 Enter the name of the digital tag whose value enables this window in the Window
Enable Control field. When the tag value changes to 1, the window is enabled.
Forcewriting 1 to this tag places the window in the foreground and refreshes the contents. The tag specified should be in the USER domain.
Use this tag only to animate a button which enables or disables a window.
Caution: If this tag in used in any other animation, your system will lock up.
10 Enter the name of the default drawing to display in this window when the window is enabled in the Startup Display Name: field.
11 Enter the name of a message tag that defines which drawing to display in the
Current Display/Load Display Tag: field. If you do not define this field or if the value of this tag is blank, the default drawing is used.
If neither of these fields is defined, the RUNMGRU drawing is used. This is the default value of the FL_MAINWINNAME tag.
12 After you complete the Window Attributes dialog, click on OK to close the dialog and save the information. If you have entered the names of any tags not already defined, the Tag Definition dialog is displayed.
64 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING RUN-TIME WINDOWS
Defining Window Size and Placement
13 Enter data for any tags displayed. Refer to the field description where the tag name was defined for details on valid data types.
14
If you want to change the size and position of the window, refer to the “Defining
Window Size and Placement” on page 65 for details.
D EFINING W INDOW S IZE AND P LACEMENT
Perform the following steps to change the size and position of a window:
1 Choose Application from the Application Editor menu bar.
2 Choose Application>Window Size/Position... to display t he View Window Selection dialog.
5
3 Select a window to view from the Window: field.
4 Click on OK to display a blank window.
5 Size the blank window to the desired size using the mouse or arrow keys and move it to the desired location.
6 Press one of the following keyboard keys :
Enter Saves a window’s new size and location. The blank window disappears from the screen and the drawing area returns to active. At run time, the window is displayed on the screen in the size and location specified.
Esc Cancels the change and clears the window.
FactoryLink 6.6.0 / Application Editor Guide / 65
•
•
•
•
CONFIGURING RUN-TIME WINDOWS
Setting the Top Window
S ETTING THE T OP W INDOW
You can configure multiple windows to open when the Run-Time Manager is started. You can also configure which window should open first and is displayed on the top of all the other windows. The default top window is FL_MAIN.
Perform the following steps if you want to configure a different top window:
1 Open the Configuration Manager.
2 Select the USER domain.
3 Choose Window Management from the Configuration Manager Main Menu to display the Window Management Control panel.
4 Provide the following information in this panel:
Top Tag Name of the tag that contains the name of the window that should appear on top of all the other windows when Run-Time
Manager is started. If you do not define this field, the tag
TOPWINDOW_U is used.
Default Name of the window displayed on top if the value of Top Tag is blank.
66 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 6
Tag Definition Dialog
6
When developing a FactoryLink application, each data element stored in the real-time database is assigned a logical name, called a tag, which is used to reference the element. Usually a variety of information is associated with each unique data element, such as the tag name, alarm limits, scaling, deadband, logging, persistence and I/O information. This information must be stored in many different tables accessed by FactoryLink when it is running an application.
When creating an application in the Application Editor, this information can be input automatically to the appropriate tables when assigning a tag name to a new data element or modifying an existing tag through the Tag Definition dialog.
This chapter describes how to configure tag names and associated data element information using the Tag Definition dialog.
FactoryLink 6.6.0 / Application Editor Guide / 67
•
•
•
•
TAG DEFINITION DIALOG
Creating or Editing a Tag
C REATING OR E DITING A T AG
The Tag Definition Dialog
The Tag Definition dialog is used to create or modify tags. Separate tabs contain information about different tag parameters. The tab options available are dependent upon the tag type and domain chosen and the program options installed for your system. For example, if you did not select and install the
Allen-Bradley driver option, that tab will not be displayed.
To view a particular tab, position the cursor on the tab header near the top of the dialog box and click the left mouse button. The contents of that tab will be brought to the foreground. Some tabs (Alarms, Logging, Scale/Dead) have two asterisks
(**) in front of the tab title if the tab is configured for the tag.
Some tabs have sub-tabs on the right side of the tab when it is in the foreground.
To view the contents of a particular sub-tab, position the cursor on the sub-tab and click the left mouse button.
When all information has been entered or modified for a tag, click on OK to save the information and exit the Tag Definition dialog. To leave the dialog without making any changes, click on Cancel . To learn more about a particular topic, click on Help .
Subtab
Tab Header
OK Button Cancel Button Help Button
68 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Creating or Editing a Tag
Creating a Tag
The Tag Definition dialog is displayed in the following situations:
• When creating a new data element, if you assign a tag name that has not yet been defined on the animation screen, and click on OK .
• When a template item a tag has not yet been defined for is pasted into a screen.
Refer to the section “Working with Templates” for more information on pasting
template items.
Editing a Tag
If a tag needs to be edited after it is created, the Tag Definition dialog is accessed in the following ways:
• When a field is chosen during development, press CTRL + T.
• When Application>Tag Dictionary is chosen from the Application Editor Menu Bar, the Tag Dictionary dialog displays. Choose the desired tag and click on Edit to display the Tag Definition
dialog for that tag. Refer to the section “The Tag
Dictionary” on page 82 for more information about using the Tag Dictionary.
Click on Edit on the upper right side of the General tab for the tag to edit general information for an existing tag.
6
Apply button
Edit button
FactoryLink 6.6.0 / Application Editor Guide / 69
•
•
•
•
TAG DEFINITION DIALOG
Creating or Editing a Tag
When the edit function is selected, all other tabs associated with the tag disappear. Changes to the information on the Basic sub-tab for the tag must be made before any other changes can be executed. If the tag is a SHARED domain tag already used in the SHARED domain, the tag domain cannot be changed.
Array dimensions can be increased from the existing dimensions or decreased if the items being eliminated have not already been referenced in FactoryLink. If a tag was not originally created as an array, it cannot be changed to be an array tag.
Likewise, the number of dimensions cannot be changed. For example, tag [3][4] cannot be changed to tag [3].
When all changes to the Basic sub-tab information are complete, click on Apply in the upper right corner of the dialog. The changes are made and all other tabs associated with the tag displays again and can be edited.
When all editing to information for the tag is completed, click on OK to save all the options.
70 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Defining Tags
D EFINING T AGS
Data stored in the real-time database is an element. Each element is assigned a logical name called a tag. This tag is used to reference the element in the real-time database.
6
Tag Names pump1_tmp pump2_tmp pump3_tmp
(Logically represents an element in database)
Realtime database
Elements
Once an element is defined, you can make unlimited references to this element.
Any FactoryLink task containing a reference to an element can read and write data to and from the element at run time.
During development, FactoryLink stores tag names in the FLAPP directory in the object database table. This information is updated to the .CT files when the run-time application is started.
Some tags are already defined in FactoryLink when it is shipped. Others are defined during application development either within the Configuration Manager or the Application Editor.
This chapter describes how to define tag names for database elements and provides some suggestions on how to use tags in your application.
FactoryLink 6.6.0 / Application Editor Guide / 71
•
•
•
•
TAG DEFINITION DIALOG
Tag Naming Guidelines
T AG N AMING G UIDELINES
The following guidelines apply when you assign a tag name:
[< node>:]<name>[<dims>][.<ext>] where
<node> Is limited to 8 characters.
<name> Is limited to 32 characters.
If using an array, add delimiters of up to 16 characters.
Refer to “Defining Element Arrays” for more details.
If using PowerNet, use the model:
32 characters less 7 characters = 25 characters.
Refer to “Tag Naming Conventions” in the Communications
Configuration Guide for more details.
If using Scaling and Deadbanding, use the model.
32 characters less 7 characters less 9 characters.
Refer to “Scaling/Deadbanding Definitions” in the Application
Editor Guide for details on the added extensions.
<dims> Is limited to 16 characters.
<ext> Is limited to 16 characters.
The maximum tag name length, including < node> , < name> , < ext> , and the separators : and .
is 32. Legal characters for the < node> , < name> , and < ext> strings are:
• {A-Z}
• {a-z}
• {0-9}
• {@$_}
These strings cannot begin with a number or contain spaces.
System Added Extensions
When defining tag attributes in the Tag Definition dialog, new tags are created automatically from the originally defined tag name if you are using PowerNet or
Scaling and Deadbanding.
72 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Tag Naming Guidelines
PowerNet
When a new tag is created, an extension of up to 6 characters plus a dot (7 characters maximum) is added. These additional characters reduce the maximum length of the original tag name; therefore, the maximum effective length of the original tag name is 32 less 7, or 25. If the original tag name plus extension exceeds 32 characters, a warning is issued.
Scaling and Deadbanding
When a new tag is created, an extension of up to 8 characters plus a colon (9 characters maximum) is added. These additional characters reduce the maximum length of the original tag name; therefore, the maximum effective length of the original tag name is 32 less 7 less 9, or 16.
If you are not sure if you will be using PowerNet or Scaling and Deadbanding, you may choose to define tag names using only 16 characters. Also, remember if shortening tag names, do not reduce the length of the extensions.
6
FactoryLink 6.6.0 / Application Editor Guide / 73
•
•
•
•
TAG DEFINITION DIALOG
Tags Referencing Arrays
T AGS R EFERENCING A RRAYS
Defining Element Arrays
A tag name is assigned to a single element or a group of elements (sometimes called an array). Using a single tag to define a group of elements permits certain
FactoryLink tasks, such as Math & Logic, to perform operations on an entire element array using only one reference to the array, rather than using separate references to each element in the array. Arrays can be single-dimensional or multi-dimensional. Single-dimensional arrays are limited to indexes from [0] to
[65533]. Multi-dimensional arrays are limited a combined total of 65533 indexes; for example [2][32767] and [3][21844] are valid configurations, but [2][50000] is not.
To specify a tag as an array, enter the value(s) that define the array dimensions in the tag name definition field when creating the tag initially. The number(s) should be placed in square brackets [n] immediately following the tag name. Leave no spaces between the tag name and the array dimensions or between any set of array dimensions for multi-dimensional arrays.
Once a tag is created as a non-array tag, it cannot be changed into an array element. Once a tag is created as an array tag, however, the number of array elements can be increased or decreased. Therefore, if you are developing an application, know that a tag will be an array, and know the number of dimensions in the array but not the exact number of elements in each array, create the tag as tagname[0][0]..., and specify the actual number of elements at a later time.
74 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Tags Referencing Arrays
Specify a number one less than the number actually required because the array starts counting at 0. For an array with 3 elements, enter the number 2 in the array dimensions field to receive 3 elements: 0, 1, 2.
Tag defined with one-dimensional array
6
Defining One-dimensional Arrays
Enter a single number to define a one-dimensional array as the array dimension to specify the number of elements in the array. Each element has a unique identifier consisting of the tag name defined in the Tagname field and one of the array identifier numbers: tagname[n]
For example, if 3 elements for an array are specified by entering the number 2 in square brackets as part of the tag temp[2], the following three elements are created in the real-time database:
• temp[0]
• temp[1]
• temp[2]
Defining Multi-dimensional Arrays
Enter multiple numbers to define multi-dimensional arrays in square brackets following the tag name to specify the number of elements in the array. Up to five dimensions can be defined for each array. Each element has a unique identifier
FactoryLink 6.6.0 / Application Editor Guide / 75
•
•
•
•
TAG DEFINITION DIALOG
Tags Referencing Arrays consisting of the tag name defined in the Tagname field and dimensional array identifier numbers: tagname[n1][n2]...
Tag defined with multi-dimensional array
For example, if a tag named tryp is to be an array that has two dimensions with 2 elements in the first dimension and 3 elements in the second dimension, specify the tag name as tryp[2][3] when creating the tag. The following six elements are created in the real-time database:
• tryp[0][0]
• tryp[0][1]
• tryp[0][2]
• tryp[1][0]
• tryp[1][1]
• tryp[1][2]
Working with Element Arrays
Once a tag is created as a multi-dimensional array, each element is accessed through the Tag Definition dialog.
76 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Tags Referencing Arrays
To increase or decrease the number of elements in the array, access the Tag
Definition dialog for the tag. If the tag is already created, click on Edit . Make any necessary changes to the Array Dimensions field and click on Apply .
Apply Button
Edit Button
Array Dimensions field
6
Note: If you are decreasing the number of elements in the array, ensure any of the elements being deleted have not been referenced elsewhere in FactoryLink. If you delete a referenced tag, the program will not compile correctly, and the run-time program will not execute.
FactoryLink 6.6.0 / Application Editor Guide / 77
•
•
•
•
TAG DEFINITION DIALOG
Tags Referencing Arrays
The information contained on the General tab is the same for all elements of an array. Other information pertaining to the tag, such as logging, can be configured for all elements of an array or differently for specific array elements. Click on the desired tab to configure information for the tag.
Array Subscript field
OK Button
Use the arrows on the right side of the Array Subscript field to scroll through the array elements or type in the desired value. When the desired array element is displayed, enter any necessary information or make any changes. Click on OK at the bottom of the dialog or click on a different tab.
A window displays asking if you wish to apply this information to all elements of the array. If you do, click on YES . If you wish to make this information apply only to the specific array element you are configuring, click on Cancel . The information is saved only for that array element.
When viewing the tag dictionary, array tags only display once as tagname[0][0]....
To access any individual element of the array, choose the tag, click on Edit , and proceed as described above.
78 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Working with Templates
W ORKING WITH T EMPLATES
Template animation allows you to animate an object with variables. When creating a template item, define which animation features are constant or variable for the object. When the object is duplicated, a prompt asks for definitions for the variable animation features.
Full Template Items
Any template referenced from an animation dialog is a full template and has all
the functionality described in “Guidelines for Using Template Variables” on page
6
Full template items created in Animation Dialog
When you finish defining the animation for the tag and click on OK , a pop-up window displays, asking for the prompt string to be displayed when this template item is pasted.
Prompt string for tag
FactoryLink 6.6.0 / Application Editor Guide / 79
•
•
•
•
TAG DEFINITION DIALOG
Working with Templates
When an object containing full template items is pasted into a drawing, a dialog displays, prompting you to enter the values for all the full template items.
Prompt string created when defining tag displays when object is pasted.
Simple Template Items
Any template defined in the Tag Definition dialog is referred to as a simple template item. When creating or editing a template in the Application Editor, any values in the Tag Definition dialog fields, except those on the Basic sub-tab, can be configured as template items if the tag name is a template. A simple template item functions like a regular template item, but a prompt string cannot be defined for a simple template item; it is generated automatically.
Tag name defined as template item Simple template items created in Tag Definition
Dialog
80 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Working with Templates
Note: In Single Point edit dialog:
• If the tag being edited is a normal tag (i.e. not a template variable), then the
“?” feature is not available.
• For template variables, the “?” feature is automatically added to all drop-down selection boxes.
When an object containing simple template items is pasted into a screen, a dialog displays, prompting you to enter the values for all the simple template items.
6
Tag name prompt appears when object is pasted
Only the template name and a field to enter the values in is displayed.
If the object being pasted contains both full and simple template items, two dialogs display. The first prompts for values for the full template items; the second prompts for values for the simple template items.
If you enter a template name in the Tag Definition dialog already defined from an animation dialog, it assumes the value from the full template item.
If a simple template name is assigned on one of the tabs of the Tag Definition dialog and the same template name is used on a different tab of the same Tag Definition dialog, the system treats these items as two different templates.
The simple templates are specified in one of two ways:
• The template variable can be entered in the field in braces: {port_id}. Templates can also be entered as a combination of a template variable and text. For example: {port}ID .
• If the field is too short to enter the template name, a ? can be placed in the field.
FactoryLink 6.6.0 / Application Editor Guide / 81
•
•
•
•
TAG DEFINITION DIALOG
The Tag Dictionary
T HE T AG D ICTIONARY
The tag dictionary provides a method to view all the tags in the application.
Up Arrow
Tag Name field
Function buttons
Slider bar
Down arrow
The slider bar scrolls through the tags. One hundred tags display at a time. To see another block of 100 tags, use the up/down arrow buttons next to the slider bar to move to another block of tags.
Selecting a Tag
Type the name of the desired tag in the Tag Name: field or choose the desired tag by clicking on it with the mouse and press ENTER on the keyboard to display the tag in the Tag Name: field . If unsure of the tag name, type in the first few characters of the name (noting that the sorting is case-sensitive) and press ENTER on the keyboard. That portion of the list displays and the desired tag can be chosen.
Click on Close to close the Tag Dictionary .
Click on Help for help about the Tag Dictionary .
82 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
The Tag Dictionary
Creating a New Tag
To create a new tag, type in the name of the tag and click on New . The Tag
Definition dialog displays and information for the tag can be entered.
Editing a Tag
To edit the information for an existing tag, ensure the name of the desired tag is in the Tag Name: field as described above and click on Edit . The Tag Definition dialog for the tag displays and the information for the tag can be edited.
Deleting a Tag
To delete an existing tag, you must first delete all references to the tag in the application. Do this by checking the cross-reference list as described below. After you have removed all references to the tag, ensure the name of the desired tag is in the Tag Name: field as described above and click on Delete . You cannot delete a tag with any references.
Cross-Referencing a Tag
To view a cross-reference list for a particular tag, ensure the name of the desired tag is in the Tag Name: field as described above and click on Xref . The cross-reference list for the tag displays:
6
The size of the field columns can be modified by selecting the bar between the fields (in the column name row) and moving it.
FactoryLink 6.6.0 / Application Editor Guide / 83
•
•
•
•
TAG DEFINITION DIALOG
The Tag Dictionary
The columns on this list provide information about the tag used in the application.
Each row contains information about a particular reference to the tag:
Tagname Lists the name of the tag information is displayed for.
CT Name/Anim
Type
Table Name/
Drawing
The name of the configuration table or type of animation the tag is used in.
The name of the table or drawing the tag is referenced in.
Column Name
/Anim Field
The name of the table column or animation field the tag is referenced in.
Record/Obj. Name The record number assigned to the item in a table, or the object number assigned when animating an object.
CT Domain The domain (SHARED or USER) the tag is referenced in.
Sub-record ID Pen
Name
The name of the sub-record or pen that references the tag.
Tag Dimensions The dimensions of the tag if it is an array.
Task Name The name of the task (GRAPH, EDI, DISTALAOG) that uses the information in the referenced tag.
84 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Basic Tag Definitions
B ASIC T AG D EFINITIONS
When the Tag Definition dialog displays, the Basic sub-tab of the General tag definition tab displays as the top layer. This dialog is used to enter information about the tag, such as a description, tag type, domain, and default value. If the tag is an array, the array dimensions are also entered here. For message type tags, specify the message length.
6
General selected
Basic selected
The fields on this sub-tab define general information about the tag.
Description Enter a description of up to 80 characters that defines the purpose of the tag.
Type Choose the format for the data referenced by this tag. Valid data types may depend on the type of field being defined. Below is a list of all valid data types:
Digital binary data type. Its value can be a 0 or 1.
Analog 16-bit, signed integer. Its value can range between negative and positive 32,768.
Floating-point IEE double precision number with 31 places to the right of the decimal.
Message any combination of alphanumeric characters. Its length is controlled by its tag definition.
FactoryLink 6.6.0 / Application Editor Guide / 85
•
•
•
•
TAG DEFINITION DIALOG
Basic Tag Definitions
Long analog 16-bit signed integer. Its value can range from negative to positive 2 billion.
Mailbox variable length data organized as a queue.
Domain Choose the domain this tag should be used in:
SHARED The data contained within this tag is available from the SHARED or USER environment. It can be read, used and/or modified by all users.
USER The data contained within this tag is available only from the USER environment.
If this tag is created as a shared tag and is referenced in the
SHARED domain, the domain for the tag cannot be changed.
If the tag was created in the USER domain, the domain can be changed.
Most tag options (tabs) are only available for tags to be used in the SHARED domain.
Array Dimensions If this tag is used to reference an array, the array dimensions display in this field. This field is blank if the tag is not an array. If this tag is defined as an array, this field is used to add or remove elements from the array. If removing elements from an array, ensure the element(s) being deleted is not referenced elsewhere in
FactoryLink. Refer to “Tags Referencing Arrays” on page 74 for
details on defining arrays.
Message Length This field defines the maximum length for Message tags. If you do not specify a length, FactoryLink calculates the correct length the first time a message is written to the tag.
Default Value This field defines the value written to the tag when FactoryLink is started.
86 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Basic Tag Definitions
Follow Domain
Persistence
Choose this box to use the persistence settings defined for the domain. The default configuration is no persistence configured for either domain. Refer to Chapter 1, “Persistence” in the Core Tasks
Configuration Guide to define persistence for an entire domain.
Note: Persistence for the domain must be configured for this option to work.
To define tag-specific persistence parameters, use the persistence
sub-tab to define the tag-specific parameters. Refer to “Tag
Persistence Definitions” on page 88 for more details on defining
tag-specific persistence.
If no persistence option is chosen for this tag, the value is not saved for restoration after an unexpected shutdown.
6
FactoryLink 6.6.0 / Application Editor Guide / 87
•
•
•
•
TAG DEFINITION DIALOG
Tag Persistence Definitions
T AG P ERSISTENCE D EFINITIONS
Persistence is used to save the values of an active FactoryLink application at predetermined times so data will not be lost if the system shuts down unexpectedly. Persistence can be configured for an entire domain and/or on a per-tag-basis. For the domain, the user can specify which elements need to be saved and how often to save them. If certain elements need to be saved at a different interval, the domain persistence can be superseded for the element using this persistence function. Refer to Chapter 1, “Persistence” in the Configuration
Guide for a detailed description of the Persistence function.
When the Persistence sub-tab is chosen from the General tag definition tab, the following dialog displays.
General selected general selected
Persistence selected
88 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Tag Persistence Definitions
Enter the following information for the tag:
Use Domain
Settings
Choose this box to use the persistence settings defined for the domain. To check the persistence settings for the domain, access the Configuration Manager. To define tag-specific persistence parameters, ensure this box does not contain an X, and use the rest of the fields on the persistence tab to define the tag-specific parameters.
Save Controls how often the element value is saved to a disk file. This can be one or both of the following. If both options are chosen, the element value is saved based on a time trigger and when it changes.
On Time Saves the tag value based on a time trigger.
On Exception Saves the tag value based on a change in the data stored in the tag.
Restoring Controls whether the element change status flag is set to on or off when restoring the saved value to the element.
Status On The element change status flag is set to on when restoring the saved value.
Status Off The element change status flag is set to off when restoring the saved value.
6
FactoryLink 6.6.0 / Application Editor Guide / 89
•
•
•
•
TAG DEFINITION DIALOG
General Alarm Definitions
G ENERAL A LARM D EFINITIONS
Before configuring alarms, refer to Part XIV, “Distributed Alarm Logger” in the
Reporting section for an overview of alarm functionality, if necessary. If two asterisks (**) are in front of the word Alarm on the tab, it indicates configuration information is on the tab. When the Alarm tab is chosen from the Tag Definition dialog, the Basic Alarm sub-tab displays:
Alarms selected
Basic selected
The condition, limit, and group displays for any configured alarms. Highlight the desired alarm and modify the attributes using the Condition Attributes box at the bottom of the screen to change this information. Enter information for the alarm in the Condition Attributes box to create a new alarm:
Condition Choose the condition the alarm tag type or alarm ID will be checked under. Valid values are
HIHI, HI, GT or > An alarm is triggered when the value of the element is greater than the value specified by the limit.
LOLO, LO, LT or < An alarm is triggered when the value of the element is less than the value specified by the limit.
90 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
General Alarm Definitions
LE or <= An alarm is triggered when the value of an analog or floating-point element is less than or equal to the value specified by the limit.
GE or >= An alarm is triggered when the value of an analog or floating-point element is greater than or equal to the value specified by the limit.
EQ or = An alarm is triggered when the value of an analog or floating-point element is equal to the value specified by the limit.
NE or < > An alarm is triggered when the value of an analog or floating-point element is not equal to the value specified by the Limit.
For example, an acceptable temperature range is 40-100 degrees.
If the temperature exceeds 90, you want to set a HI alarm to alert the operator. If the temperature exceeds 95, it would be considered critical, and this could be configured as the HIHI alarm. In addition, you may want to set an alarm when the temperature is > 85 so the operator can take steps to prevent the temperature from ever reaching a dangerous level. In all three cases, the condition for the tag is greater than but each alarm is differentiated from the other.
Group Choose the alarm group name from the list. Create the name of a new alarm group by going to the Group Alarms tab.
Priority Enter a number between 1 and 9999 to specify the priority of the alarm for filtering and sorting purposes. The default is 1, the highest priority.
* Limit Enter the value constant or a tag name for an element against which the condition is checked. If the condition reaches this limit, the alarm condition occurs.
Area Enter an alphanumeric string to specify the area the alarm resides in for filtering and sorting purposes. If alarms are distributed along the network, use this field to designate and sort by server/client or local/remote.
* Deadband Enter the value constant or a tagname for an element above or below the limit the alarm will remain active for.
6
FactoryLink 6.6.0 / Application Editor Guide / 91
•
•
•
•
TAG DEFINITION DIALOG
General Alarm Definitions
The deadband works in conjunction with the condition and limit specified for the alarm. Once the alarm is triggered when the tag fulfills the condition and limit parameters, it remains active until it moves past its limit by the deadband amount.
For example, if the alarm trigger condition is set to activate when the tag temp_set is equal to 85 degrees F and the deadband is set to 5, the alarm will be triggered at 85 degrees and will not return to normal until the temperature has dropped back below 80 degrees (85 less 5 for the deadband).
If a tag is used, it must be the same data type as the tag and the tag name referenced in the * Limit field.
A message type tag is not valid in the * Deadband field.
Valid Entry: standard tag name or constant
Valid Data Type: analog, longana, float
To add an alarm, specify the alarm condition attributes to the list of configured alarms, then click on Add .
To delete an alarm, select it by clicking on it in the Configured Alarms list to highlight it and click on Delete .
To update an alarm, select it by clicking on it in the Configured Alarms list to highlight it. Make any changes in the Condition Attributes box and click on
Update . The changes displays in the Configured Alarms list.
For those items preceded by an asterisk (*), either a value or a tag name can be entered in the field. If an unused tag name is entered in one of these items, when you click on Add , Update , OK or move to another tab, a Tag Definition dialog for the new tag displays.
To clear all alarms for a tag, press Clear in the upper right corner of the tab. To add an alarm to the list of configured alarms, click on Add .
92 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Advanced Alarm Definitions
A DVANCED A LARM D EFINITIONS
If two asterisks (**) are in front of the word Alarm on the tab, it indicates configuration information is on the tab. When the Advanced sub-tab is chosen from the Alarm Definitions Tab, the Advanced Alarm sub-tab displays.
Alarms selected
Advanced selected
6
Enter the following information if you wish to use advanced alarm functions:
Message Text Enter up to an 80 character alphanumeric string to specify the alarm message text to be displayed for this individual alarm. This text normally displays after the group alarm text. This message text can be enhanced with up to four variables, 1-4, described below. The variables are scanned in order, 1 to 4. The default message is tagname= %d.
Variable 1-4 Enter the name of the tag whose element will be used as part of the alarm message at run time in place of the variable (1-4) specifier indicated within the text of the Message Text. When the message is displayed, this variable is substituted for the specifier at run time. The default for variable 1 is tagname. ANALOG,
LONGANA, FLOAT or message are valid data tag types for this variable.
Hiding To hide the chosen alarm, place an X in the Hiding box and enter the name of the digital tag in the USER domain that hides the alarms. If the Hiding field is left blank, the alarm is processed as a standard alarm.
FactoryLink 6.6.0 / Application Editor Guide / 93
•
•
•
•
TAG DEFINITION DIALOG
Advanced Alarm Definitions
Time-stamp
Format
Enter the format to be used by the input element in the Time
Stamp tag. Valid values are:
NULL Time-stamping format is not used
USA USA time format (yymmddhhmmss)
EUROPE European time format (ddmmyyhhmmss)
USA_HS USA time format with 1/1000 sec
(yymmddhhmmsstt)
EUR_HS European time format with 1/1000 sec
USA_L Long USA time format
EUROPE_L Long European time format
USA_HSL Long USA time format with 1/1000 sec
EUR_HSL Long European time format with 1/1000 sec
Time Stamp Tag Enter the name of a message tag to specify the exact time the alarm occurred. This message is supplied with the alarm tag change. If no tag is supplied here, the time-stamping is determined by when the change is detected by the Alarm Logger.
Complete this tag a correct value before the alarm tag is changed.
Status Tag Enter the name of the analog or digital tag that represents the status of this alarm in the active alarm list. Valid statuses are
Initial (INI), Acknowledged (ACK), Normal (NRM), or Idle
(IDLE).
If an unused tag name is entered for Variable, Hide tag or Time-stamp tag, a Tag
Definition dialog for the new tag displays when you click on OK or move to another tab.
94 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Group Alarm Definitions
G ROUP A LARM D EFINITIONS
Two asterisks (**) in front of the word Alarm on the tab indicates configuration information is on the tab. When the Alarm Groups sub-tab is chosen from the
Alarm Definitions tab, the following displays.
Alarms selected
6
Alarm Groups selected
Alarms can be grouped to facilitate administration or analysis. Enter the following information if use of the group alarm functions is desired:
Alarm Group Choose a group name from the list of existing groups, or create a new alarm group name of up to 16 alphanumeric uppercase characters.
Message Enter a message of up to 40 alphanumeric characters to specify the alarm message to be displayed for all alarms belonging to this group. This text is normally placed in front of the individual alarm text.
Hide Tag Enter the name of the tag (must be a digital type tag) used to hide alarms for the group. Leave this field blank to deactivate this feature. If a tagname entered has not been used before, when you click on Add, Update, OK or move to another tab, a Tag Definition dialog for the new tag displays.
Audible Check this box to generate an audible signal when an alarm is generated. If the box is not checked (default setting), no alarm is generated.
FactoryLink 6.6.0 / Application Editor Guide / 95
•
•
•
•
TAG DEFINITION DIALOG
Group Alarm Definitions
Log Check this box to indicate an alarm belonging to this group is logged in the alarm table after it is removed from the active list.
If the box is not checked (default value), the alarm will not be logged to the table after being removed from the active list.
Print Device # Enter the number of the print device where the alarm state changes will be routed for printing. This number corresponds to the line number of the print device identified in the Print Spooler
Information panel. The default blank or 0 disables this function.
ACK Indicate whether or not alarms belonging to this group need to be acknowledged by the operator. Valid values are:
NO Operator acknowledgment is not required. The alarm disappears from the active list when it returns to normal. This is the default setting.
YES Operator acknowledgment is required. The acknowledge time and operator are logged, if configured for such.
RST The operator must acknowledge the alarm but cannot do so until the alarm has returned to normal.
If this field is set to YES or RST, the Unack Alarms Count Tag field in the General Alarm Setup panel must be set for the alarms in the unacknowledged state to be counted.
Display Attributes Set the foreground and background color and whether or not the tag blinks for the initial, acknowledged, and normal state of the alarms on the alarm display.
Click on ADD in the upper right hand corner of the tab to create a new alarm group. If you are updating existing alarm groups, click on UPDATE to save modifications to the record.
96 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Data-Point Logging Definitions
D ATA -P OINT L OGGING D EFINITIONS
The Data-Point Logging definition tab is used to specify which FactoryLink tags are written to the historical databases and what trigger causes the tag element to be recorded. Two asterisks (**) in front of the word Logging on the tab indicates configuration information on the tab. Data Point Logger comes with five preconfigured tables data can be written to, or the user can create other tables as needed. For each tag element recorded, the tag name, value, and time of recording are written to the Data-Point database.
Data-Point Logging can be configured to occur based on one or more of the following:
• A change in the tag (exception logging)
• A change in a trigger tag
• A fixed-time interval
If using multiple logging methods results in a tag value being logged more than once during a given second, any value logged after the first recorded value is ignored.
Refer to Part XI, “Data Point Logger” in the Data Logging Configuration Guide for a detailed description of how Data-Point Logging functions.
When the Logging tab is chosen from the Tag Definition dialog, the following displays:
6
FactoryLink 6.6.0 / Application Editor Guide / 97
•
•
•
•
TAG DEFINITION DIALOG
Data-Point Logging Definitions
Enter the following information, if use of the Data-Point Logging function is desired:
Log Table Choose the name of the log table to which the tag element should be written. Data Point Logger comes with five tables preconfigured for efficient storage and retrieval of certain tag types. These log tables are:
FLOATVAL Used to store floating value data.
LONGANA Used to store long analog (large integer) data.
ANALOG Used to store analog (small integer) data.
LOGDATA Used to store general log data.
TRENDATA Used to store data used for trend analysis.
To create a new table, you must use the Data-Point Schema Control panel and the Data-Point Logger Control panel in the Configuration
Manager.
Log On Change Choose this box (click on box with arrow and an x displays in the box) if the tag data is to be recorded to the database table when the data in the tag changes.
Log On Trigger Enter the name of the trigger tag to be used in this field if the tag data is to be recorded to the database table when a trigger occurs.
If the tagname entered has not been used before, a Tag Definition dialog for the new tag displays when you click on Apply or OK or move to another tab.
Log On Interval If the tag data is to be recorded to the database table at a specific time interval, enter the time interval number in the Log Rate field and use the radio buttons to indicate if the interval is seconds, minutes, hours, or days.
For example, if the tag data should be written to the database table every 2.5 minutes, enter the number 150 in the Log Rate field and click on the Seconds radio button.
98 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Scaling/Deadband Definitions
S CALING /D EADBAND D EFINITIONS
Scaling is used to convert, or scale, incoming raw data to a different value range, if needed. Use of the scaling task eliminates the need to process data through an intermediate routing mechanism or to write code to perform the scaling function.
The scaling task, if given the conversion factor and/or offset, perform the linear scaling calculations automatically using the formula: mx + b = y where x is the raw value m is the multiplier b is a constant y is the result
Deadbanding is used to indicate a band, or area, around a value that is small enough to be insignificant, so the value does not need to be recalculated. This saves processing time and improves system efficiency.
Two asterisks (**) appearing in front of the word Scale/Deadb on the tab indicates configuration information is on the tab.
When the Scale/Deadband tab is chosen from the Tag Definition dialog, the following displays:
6
FactoryLink 6.6.0 / Application Editor Guide / 99
•
•
•
•
TAG DEFINITION DIALOG
Scaling/Deadband Definitions
When raw and scaled ranges are specified as a value, the system automatically creates and defines the following tags associated with the tag tagname:
• tagname.raw
• tagname.eumin
• tagname.eumax
• tagname.rawmin
• tagname.rawmax
• tagname.dead
• tagname.lock
The value for a scaled tag configured in the Application Editor is calculated on change and written to the scaled tag tagname. Note that for a scaled tag configured in the Configuration Manager, the value is written to the tagname.raw tag, and the scaling is performed.
The tag names assigned for the deadbanding and lock functions can be replaced with other tag names, if desired.
Refer to the Core Task Section of the FactoryLink Configuration Guide for more information on the Scaling and Deadbanding function.
If use of the scaling or deadbanding function is desired, enter the following information:
Scaling Values Enter the minimum and maximum values for the raw (incoming) data and the minimum and maximum values for the scaled
(engineering units) data displayed in FactoryLink.
For example: the temperature in a tank needs to be monitored in a range between freezing and boiling. The tank temperature probe records incoming (raw) data in a Celsius scale, and you prefer to have the temperatures displayed in FactoryLink
(engineering units) of a Fahrenheit scale. Enter the following values in the fields:
Raw High: 100 (the boiling point in the Celsius scale)
Raw Low: 0 (the freezing point in the Celsius scale)
Eng Unit High: 212 (the boiling point in the Fahrenheit scale)
Eng Unit Low: 32 (the freezing point in the Fahrenheit scale)
FactoryLink automatically determines the appropriate scaling values and converts incoming data to the engineering unit values.
100 / FactoryLink 6.6.0 / Application Editor Guide
TAG DEFINITION DIALOG
Scaling/Deadband Definitions
Disable Tag When you specify a scaling function for a tag, FactoryLink automatically creates a tag named tagname.lock
that performs a disabling function to temporarily disable the scaling feature for the tag. If desired, enter the name of a different tag to perform this function.
Deadbanding When you specify a scaling function for a tag, FactoryLink automatically creates a tag named tagname.dead
that performs a deadbanding function for the tag. Deadbanding creates a band, or area, around a tag value. If the tag value remains within this band, the value is not rewritten to the database. If the tag value exceeds this range, the tag value is rewritten, and a band around the new value is recalculated. Therefore, the deadband value should be small enough that the change would not be important enough to require attention. If desired, enter the name of a different tag or a constant value to perform this function.
For example, if a temperature change of 2 degrees in either direction is not considered significant, enter a 2 in the deadbanding value field and choose the Absolute Change radio button. If a change of 2% of the value is not considered significant, a 2 could be entered in the deadbanding value field and the Percent Change radio button could be chosen.
If a tagname is entered in one of these items NOT used before, a Tag Definition dialog displays when you click on OK or move to another tab.
6
FactoryLink 6.6.0 / Application Editor Guide / 101
•
•
•
•
TAG DEFINITION DIALOG
Device Interface
D EVICE I NTERFACE
The Device Interface tabs refer to protocol-specific tasks for external devices that could be providing data to FactoryLink. Tabs only display for the protocol-specific modules installed for your particular system. The data for this tag is either coming from or going to a device that supports the protocol used by the task.
Certain address and table information for the external device must be entered.
Choose the tab for that device, and a dialog similar to the one below displays. The actual fields vary, depending on the type of protocol module used. Refer to the
Device Interface Guide for detailed information on each type of external device.
Address
Information
Table Information
(read only)
Information, such as the logical station number, type, port number, read table name, and data type, is entered for the tag. A detailed explanation for each field is provided in the Device
Interface Guide.
Information about the selected table, such as the read and write trigger, whether information is written automatically or on exception, and whether or not an unsolicited read will be performed, display for the read table specified above. A detailed explanation for each field is provided in the Device Interface
Guide.
If a tagname is entered in one of these items NOT used before, a
Tag Definition dialog displays when you click on OK or move to another tab.
102 / FactoryLink 6.6.0 / Application Editor Guide
Data Reporting Configuration Guide
Part II
Screen Construction
103
Chapter 7
Drawing Objects
This chapter includes instructions for drawing components used to develop user-interface screens. The following topics are included:
• A description of the drawing tools including the Application Editor menu bar and toolbox.
• Instructions on how to use the tools to draw objects on the screen.
7
FactoryLink 6.6.0 / Application Editor Guide / 105
•
•
•
•
DRAWING OBJECTS
The Drawing Tools
T HE D RAWING T OOLS
The Application Editor provides a variety tools through the menus and the Tools box to assist you in developing a drawing.
The Menus
The Draw, Attributes, and Edit menus are the primary menus used when first developing your screens. The Draw menu includes the commands for drawing all objects. The Attributes menu includes commands for specifying the line, fill, text and screen styles and for defining an object name. The Edits menu includes commands for selecting and editing objects.
The Tools Box
The Tools box provides quick access to many of the drawing tools found in the
Draw and Edit menus. It also includes tools found in other menus, such as
Animation and Application.
The Tools box is displayed by default. Choose View>Toolbox to toggle the Tools box open or closed.
The following illustrates the Tools box and identifies the tools used for drawing and selecting objects:
Select
Text
Box
Parabola
Line
Ellipse (circle)
Spline (curve)
Polygon
Arc
Legend
Other tools will be identified as needed throughout this manual.
106 / FactoryLink 6.6.0 / Application Editor Guide
DRAWING OBJECTS
The Drawing Tools
Selecting Objects
Once an object is drawn, you can perform many actions on it, such as cutting, pasting, grouping, changing their size, setting display characteristics, and animating. Before you can perform an action on an object, it must be selected.
This section describes how to select objects.
To select an object, choose Edit>Select Object . The cursor becomes an arrow.
Selecting Simple Objects
To select a single object, place the cursor inside the object and click the left mouse button. Eight solid blocks or handles display around the object, indicating it is selected. An additional handle displays in the middle of the object. This handle is used for moving the object.
Selection
Handles
Move Handle
Selection Cursor Tool
Selecting a Group of Objects
To select a group of objects, press and hold the left button and drag a border around the objects you want to select, then release the mouse button. The border must completely enclose every object you want to select. Handles display around the group.
Drag a border around the objects to be selected
Selection
Handle
7
FactoryLink 6.6.0 / Application Editor Guide / 107
•
•
•
•
DRAWING OBJECTS
The Drawing Tools
Selecting a Composite Object
Composite objects are two or more subobjects grouped together. To select a composite object, place the cursor inside the object and click the left mouse button.
Hollow blocks or handles display around the object, indicating it is selected.
Composite Select Handle
If the selected object site is on top of another object site and you select again, the
Application Editor displays the composite selection handles for the next layered object.
Selecting a Subobject
Choose Edit>Select Subobject from the Edit menu to select individual subobjects contained within the composite object without ungrouping the composite. Perform the following steps to select subobjects comprising a composite object:
1 Select a composite object. Composite select handles display around the entire object.
2 Hold the Ctrl key down while clicking on the subobject with the selection tool. A solid line borders the composite object and selection handles display around the selected subobject.
Optionally, you choose Edit>Select Subobject and then click on the subobject to select it.
Subobject Select Handle
108 / FactoryLink 6.6.0 / Application Editor Guide
DRAWING OBJECTS
Drawing Simple Objects
If the selected subobject is a simple object, the handles are solid. If the selected subobject is another composite, the handles are hollow. You can repeat this procedure to go a layer deeper until you cannot select more composite objects.
The selection handles relocate to the selected subobject as you select different subobjects within the composite.
Click outside the a subobject but within its composite to select a composite object in an overlapping layer. The solid border around the composite changes to the composite selection handles. Click anywhere outside of the composite to deselect the composite entirely. The composite selection handles disappear.
Undo
Choose Edit>Undo to reverse the last action performed in the active drawing,.
Undo operates on a per drawing basis. You can undo the last action performed in each open drawing after making the drawing active. The last action performed is displayed next to the Undo option when you access the Edit menu.
The Undo option does not undo any element names created with the last action.
The element names remain in the object list.
The Undo option is displayed gray and cannot be selected if the last action performed cannot be reversed.
D RAWING S IMPLE O BJECTS
Simple objects are single objects, such as lines, circles, and text, that are not composed of any other objects. They are the basic building blocks of a graphics display. For example, the following are simple objects:
TextString
7
You must select each object individually to perform an action on it, such as to move it.
FactoryLink 6.6.0 / Application Editor Guide / 109
•
•
•
•
DRAWING OBJECTS
Drawing a Straight Line
D RAWING A S TRAIGHT L INE
1 Choose Draw>Line .
2 Place the cursor where you want the line to start and press the left mouse button.
3 Drag the cursor to draw a line in the drawing area. Continue dragging the cursor until the line is the desired length, then release the mouse button.
D RAWING A S PLINE (C URVED L INE )
1 Choose Draw>Spline .
2 Place the cursor where you want the curved line to start and press the left mouse button.
3 Drag the cursor to draw a line in the drawing area. Continue dragging the cursor until the line has the same endpoint as the desired curve, then release the mouse button.
4 Move the cursor to another position and press the left mouse button. The end point of the line moves to the point where you released the button, making a best-fit curve based on the starting point of the cursor, the first point where you released the mouse button, and the second point where you released the mouse button.
110 / FactoryLink 6.6.0 / Application Editor Guide
DRAWING OBJECTS
Drawing a Square or Rectangle
5 Repeat Step 4 until the curve is the desired shape.
6 Press the right mouse button to end drawing of the curved line.
D RAWING A S QUARE OR R ECTANGLE
1 Choose Draw>Box .
2 Place the cursor where you want the rectangle or square to start and press the left mouse button.
3 Drag the cursor to draw a box in the drawing area. Continue dragging the cursor until the box is the desired shape, then release the left mouse button.
7
D RAWING A P OLYGON
1 Choose Draw>Polygon .
2 Place the cursor where you want the polygon to start and press the left mouse button.
3 Drag the cursor to draw a line in the drawing area. You must draw the first line by dragging the cursor or it will disappear when you press the right mouse button to complete the polygon.
4 Release the left mouse button.
FactoryLink 6.6.0 / Application Editor Guide / 111
•
•
•
•
DRAWING OBJECTS
Drawing an Ellipse (Circle or Oval)
5 Move the cursor to another position in the drawing area and press the left button.
Another line is displayed that connects the current point to the previous point.
Repeat this step until the polygon is the desired shape.
6 Press the right mouse button to end drawing of the polygon.
D RAWING AN E LLIPSE (C IRCLE OR O VAL )
1 Choose Draw>Ellipse .
2 Place the cursor where you want the ellipse or circle to start and press the left mouse button.
3 Drag the cursor to draw an ellipse or circle in the drawing area. Continue dragging the cursor until the object is the desired shape, then release the left mouse button.
D RAWING AN A RC
1 Choose Draw>Arc .
2 Place the cursor where you want the arc to start and press the left mouse button.
3 Drag the cursor to draw an ellipse or circle in the drawing area.
112 / FactoryLink 6.6.0 / Application Editor Guide
DRAWING OBJECTS
Drawing a Parabola
4 Continue dragging the cursor to enlarge or shrink the ellipse or circle to the desired size, then release the mouse button.
5 Press and hold the left mouse button down. The ellipse or circle disappears. Drag the cursor to display a pie-shaped wedge with the same radius as the ellipse.
6 Drag the cursor until the arc is the desired size
7 Release the mouse button. The sides of the wedge disappear leaving an arc in the drawing area.
7
D RAWING A P ARABOLA
1 Choose Draw>Parabola .
2 Place the cursor where you want the parabola to start and press the left mouse button.
3 Drag the cursor to draw a line in the drawing area. Continue dragging the cursor until the line has the same end point as the desired parabola, then release the mouse button.
FactoryLink 6.6.0 / Application Editor Guide / 113
•
•
•
•
DRAWING OBJECTS
Drawing a Legend
4 Place the pointer anywhere on the line and press the left mouse button. Drag the cursor until the parabola is the desired shape, then release the left mouse button.
D RAWING A L EGEND
A legend is a rectangle that is already scaled with division marks and labeled from 0 to 100. You can use legends as labels for the axes of graphs and charts or with movable objects, such as a slider.
Perform the following steps to draw a ruled legend:
1 Choose Draw>Legend .
2 Place the cursor where you want the legend to display and click the left mouse button.
3 Drag the cursor to draw a box in the drawing area.
4 Continue dragging the cursor until the box is the desired shape, then release the left mouse button. A rectangle is displayed with a scale that is divided into five equal units and each unit is divided into quarters. The scale is labeled from 0 to
100.
114 / FactoryLink 6.6.0 / Application Editor Guide
DRAWING OBJECTS
Adding Text to a Drawing
The scale grows and shrinks with the size of the rectangle. If you draw the rectangle vertically, the scale is displayed on the right; and if you draw the rectangle horizontally, the scale is displayed along the top.
A DDING T EXT TO A D RAWING
When drawing objects to be animated are data input fields (such as text objects), the order you draw the objects in determines the order the cursor moves to each field when the T AB key is pressed.
1 Choose Draw>Text .
2 Place the cursor where you want the text to display and click the left mouse button to display a text bar.
3 Type the text you want to display in the drawing.
7
FactoryLink 6.6.0 / Application Editor Guide / 115
•
•
•
•
DRAWING OBJECTS
Creating Composite Objects
C REATING C OMPOSITE O BJECTS
Composite objects are collections of objects. Two or more objects grouped together form a single object.
Group simple objects into composite objects in one of two ways.
• Combining—Groups two or more objects as a composite object retaining their original shape and position.
• Connecting—Groups two or more objects as a composite object and connects their points. The look of the object changes based on its point locations.
Combining Objects
The combining method groups two or more objects as a composite object, retaining their original shapes and positions. Combine objects in one of two ways: using the
Edit menu or from the toolbar. This section describes how to combine objects using the Edit menu.
Perform the following procedure to combine objects:
1 Select the objects you want to group.
2 Choose Edit>Combine .
The chosen objects are combined. The attributes, name and animation for each individual object are preserved. A new object name is assigned to the composite object.
Connecting Method
The connecting method joins two or more objects to form a single object. It does this by adding a line from one end point to another end point until the group forms a single object. Connection starts with the object closest to the lower-left corner of the selected group. For example, if you draw two of the lines needed to form a triangle as shown below, the third line is drawn to connect the two lines.
Before connect
116 / FactoryLink 6.6.0 / Application Editor Guide
After connect
DRAWING OBJECTS
Creating Composite Objects
Connect objects in one of two ways: through the Edit menu or from the toolbar.
Perform the following procedure to connect objects:
1 Select the objects you want to connect.
2 Choose Edit>Connect .
A new object name is assigned to the composite object.
Separating Objects
When two or more objects have been combined or connected to comprise a composite object, you can separate them as individual objects.
Perform the following procedure to separate objects:
1
Select the objects you want to ungroup. Refer to “Selecting Objects” on page 107
for details.
2 Choose Edit>Separate .
The name, attributes and animation for each individual object are preserved, but the composite object name is discarded.
Note: When a composite object is created, each individual object can be defined to have the same or different attributes and animation. When a composite object is separated, each individual object maintains the attributes and animation defined for it.
7
FactoryLink 6.6.0 / Application Editor Guide / 117
•
•
•
•
DRAWING OBJECTS
Creating Composite Objects
118 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 8
Editing Objects
You can perform many actions upon an object once it is selected. This chapter describes how to perform the following actions.
• Setting object attributes
• Copying an object
• Pasting an object
• Deleting an object
• Aligning an object
• Moving an object to front or back
• Reshaping an object
• Moving the placement of an object
• Rotating an object
• Resizing an object
• Resizing text
• Reversing last action
8
FactoryLink 6.6.0 / Application Editor Guide / 119
•
•
•
•
EDITING OBJECTS
The Editing Tools
T HE E DITING T OOLS
The Application Editor provides a variety tools through the menus and the Tools box to assist you in editing a drawing.
The Menus
The Attributes and Edit menus are the primary menus used for editing the components of your screens. The Attributes menu includes commands for specifying the line, fill, text and screen styles and for defining an objects name.
The Edits menu includes commands for selecting and editing objects.
The Tools Box
The Tools box provides quick access to many of the drawing tools found in the
Attributes and Edit menus. It also includes tools found in other menus, such as
Draw and Animation.
The Tools box is displayed by default. Choose View>Toolbox to toggle the Tools box open or closed.
The following illustrates the Tools box and identifies the tools used for editing and selecting objects.
Select
Cut
Align
Combine
Reshape
Copy
Bring to Front
Connect
Rotate
Paste
Send to Back
Separate
Line Attributes Fill Attributes Text Attributes
Other tools will be identified as needed throughout this manual.
120 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Setting Object Attributes
S ETTING O BJECT A TTRIBUTES
You can assign attribute and animation to an object. The attributes of an object control how it is displayed, such as its color, fill pattern, or text style. The chart below shows the attributes associated with each object type.
Table 8-0 Attributes Associated with each Object Type
Object
Line
Arc
Parabola
Box
Ellipse
Polygon
Spline
Text
Legend
Color
X
X
X
X
X
X
X
X
X
Line
Style
X
X
X
X
X
X
X
X
X
Color
X
X
X
X
X
X
X
X
X
Attributes
Fill Text
Font Color Style
X
X
X
X
X
X
X
X
X
X
X
X
X
Style
X
X
The rest of this chapter describes how to set or change these attributes for objects included in your drawings.
8
FactoryLink 6.6.0 / Application Editor Guide / 121
•
•
•
•
EDITING OBJECTS
Setting Line Attributes
S ETTING L INE A TTRIBUTES
Each time you start the Application Editor, the line color is set to white and the line style to solid. This section describes how to change the color and style (solid or dash) of a line. Once set, any new lines drawn inherit the existing attributes. If you want to change the color or style of an existing line, you must select the line before performing the following procedure.
1 If you are changing the color and style attributes of existing lines, choose the object containing the lines; otherwise, proceed to the next step.
2 Choose Attributes>Lines to display the Line Attributes dialog. The Sample field shows the current settings. This field changes when you make a new selection.
3 Make a choice in each of the following fields:
Color Select the line color. This palette provides 64 colors. For VGA monitors that display only 16 colors, unavailable colors show as multi-colored dots. The line is shown in the closest solid color available if you choose a dithered color.
Style Choose a line style. Your options are a solid or a dashed line.
Visible Specify whether or not the line is visible. If the line is chosen, it is visible.
4 Click on
OK
to save the line attributes. Any chosen lines and any new lines drawn acquire these attributes.
122 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Setting Object Fill Attributes
S ETTING O BJECT F ILL A TTRIBUTES
Each time you start the Application Editor, the fill style is set to transparent, the foreground fill color to white, and the background fill color to black. This section describes how to change the fill color and transparency of an object.
Once set, any new objects drawn inherit the existing attributes. If you want to change the fill color or transparency of an existing object, you must select the object before performing the following procedure.
1 If you are changing the fill color and transparency attributes of an existing object, select it; otherwise, proceed to the next step.
2 Choose Attributes>Fill to display the Fill Attributes dialog. The Sample field shows the current settings. This field changes when you make a new selection.
8
3 Select a fill style from the Style palette. This can be one of the following:
Solid
Fills objects with the color chosen in the Foreground color palette.
Any background color chosen is ignored.
Transparent
Makes objects transparent so only the object outline is visible.
The color used is the color chosen for displaying lines.
Hatch
Fills objects with a pattern of lines or dots (depending on the platform) in the foreground and background colors chosen.
FactoryLink 6.6.0 / Application Editor Guide / 123
•
•
•
•
EDITING OBJECTS
Setting Object Fill Attributes
4 Select a foreground color from the Foreground color palette. This palette provides
64 colors. For VGA monitors that can display only 16 colors, the other 48 colors show as multi-colored dots.
5 If you select hatch as the fill style, select a background color from the Background color palette. This palette provides 64 colors. For VGA monitors that can display only 16 colors, unavailable colors show as multi-colored dots.
6 Click on OK to save the attributes. Any chosen objects and any new objects drawn acquire these attributes.
124 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Setting Text Attributes
S ETTING T EXT A TTRIBUTES
You can set the text attributes of font, font height, color, style, and alignment for new text, or change these attributes for existing text. The font, font height, color, and style attributes apply to all text, static or animated. The alignment attribute applies only to animated text.
Each time you start the Application Editor, the text color is set to white, the font size is set to 16-point, and the font style is set to System. This section describes how to change these attributes for a text object.
Once set, any new text objects drawn inherit the existing attributes. If you want to change the attributes of an existing text object, you must select the object before performing the following procedure.
1 If you are changing the attributes of an existing text object, select it; otherwise, proceed to the next step.
2 Choose Attribute>Text to display the Text Attributes dialog. The current settings show in the Preview box at the bottom of this box.
8
3 Choose from the following attributes:
Font Name Select the font you want to use from the available typefaces. Use the scroll bar to display all the options. For portability to other platforms, use True Type or Type 1 fonts.
Font Size Select the size of the font ranging between 4 to 128 points.
FactoryLink 6.6.0 / Application Editor Guide / 125
•
•
•
•
EDITING OBJECTS
Setting Text Attributes
Text Color Select the color of the text. This palette provides 64 colors. For
VGA monitors that display only 16 colors, unavailable colors show as multi-colored dots.
Background Color Select the color displayed behind the text. This palette provides
64 colors. For VGA monitors that display only 16 colors, the other
48 colors show as multi-colored dots.
Style Choose a text style. This can be one of the following:
Bold Displays text in boldface type.
Italic Displays text in italicized type.
Underline Displays text with a line under it.
Opaque Places a solid background behind the text to hide anything behind the text. Animated text always receives an opaque background.
Border Places a box around the text in the color and style chosen for line attributes.
Variable Enables resizing using the resize handles. This option is only used in OS/2 and we recommend you do not use it because of portability issues. Other platforms let you proportionally resize text without this option chosen.
Clip Hides the end of static text at run time when the text exceeds its bounding box. (Static text is unanimated text.) For example, if the window is slightly larger at run time than when you created it, the text size may increase to maintain the same proportions. In some cases the new font size is larger than the size of the bounding box, causing the text to exceed its bounding box.
Alignment Select the alignment of animated text within the text field. This applies only to text animated as input text or output text and can be one of the following:
Left Left-justifies the text within the field. You must specify this option for text fields that contain messages.
Center Centers text horizontally within the field.
126 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Cutting, Copying, Pasting, and Deleting Objects
Right Right-justifies the text within the field. You must specify this option for text fields that contain analog text.
Top Places the text at the top of the field.
Middle Centers the text vertically within the field.
Bottom Places the text at the bottom of the field.
4 Click on OK to save the attributes. Any chosen objects and any new objects drawn acquire these attributes.
C UTTING , C OPYING , P ASTING , AND D ELETING O BJECTS
Cutting an Object
This section describes how to cut objects.
Perform the following procedure to cut objects:
1 Select the objects you want to cut.
2 Choose
Edit>Cut
.
The name, attributes, and animation for each individual object are preserved with the object.
Copying an Object
This section describes how to copy objects.
Perform the following procedure to copy objects:
1 Select the objects you want to copy.
2 Choose
Edit>Cut
.
The name, attributes, and animation for each individual object are preserved with the object.
8
FactoryLink 6.6.0 / Application Editor Guide / 127
•
•
•
•
EDITING OBJECTS
Cutting, Copying, Pasting, and Deleting Objects
Pasting an Object
This section describes how to paste objects that have been copied or cut.
Perform the following procedure to paste objects:
1 Cut or copy the objects you want to paste, as described above.
2 Choose
Edit>Paste
. The cursor changes to a crosshair (+).
3 Position the cursor in the area of the drawing where you would like to place the objects and press the left mouse button. The objects are pasted into the drawing.
The name, attributes, and animation for each individual object are preserved with the object.
The Application Editor remains in paste mode until a different function is chosen.
Repeated clicks of the left mouse button result in additional pastes.
Deleting an Object
This section describes how to delete objects.
Perform the following procedure to delete objects:
1 Select the objects you want to delete.
2 Choose Edit>Delete . The objects are removed from the drawing area.
128 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Moving and Aligning Objects
M OVING AND A LIGNING O BJECTS
Moving an Object
When you select an object, eight handles display around the object and one is displayed in the middle of the object. You can use the middle handle to move the object to another location.
Move Handle
Perform the following steps to move an object:
1 Select the object you want to move.
2 Place the cursor on the middle handle, then press and hold the left mouse button.
The handles disappear.
3 Drag the object to its new location, then release the mouse button.
8
FactoryLink 6.6.0 / Application Editor Guide / 129
•
•
•
•
EDITING OBJECTS
Moving and Aligning Objects
Aligning Objects
The Application Editor aligns objects based on their bounding boxes. You can align objects along a vertical line (left, center, or right), along a horizontal line (top, center, or bottom), or equidistant so they have an equal amount of space between them. Perform the following steps to align objects.
1 Select the objects you want to align.
2 Choose Edit>Align to display the Align, Space, and Size dialog.
Alignment
Options
Equidistant
Spacing
Options
Sizing
Options
This dialog provides options that control:
• Horizontal and vertical alignment
• Space between objects
• Size of objects
130 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Moving and Aligning Objects
3 Select the box next to the horizontal and vertical alignment you want. An X is displayed in the box. If you do not define an alignment for either horizontal or vertical, the objects keep their current alignment.
Vertical (column) alignment
Left side alignment
Center column alignment
Right side alignment
Horizontal (row) alignment
Bottom alignment
Top alignment
Center row alignment
4 Select the box next to the equidistant spacing you want. An X is displayed in the box.
Equidistant horizontal
(row) spacing
Equidistant vertical (column) spacing
5 Select the box next to the sizing you want. An X is displayed in the box. Sizing stretches or shrinks all chosen objects to the same size, either horizontally or vertically.
Vertical (column) stretching
Vertical (column) shrinking
Horizontal (row) shrinking
Horizontal (row) stretching
6 Click on OK . The chosen group of objects align accordingly.
Note: If you use the vertical Space option with text objects whose bounding boxes are larger than the text, the space between the text is unequal, although the space between the bounding boxes is equal. To ensure equal vertical spacing between text objects whose bounding boxes are larger than the text, first use the Grow/Shrink option on the chosen text objects to shrink the bounding boxes to the text, then use the vertical
Space option.
8
FactoryLink 6.6.0 / Application Editor Guide / 131
•
•
•
•
EDITING OBJECTS
Rotating an Object
R OTATING AN O BJECT
The rotate command allows you to rotate a polygon, line, box, ellipse, arc, parabola, or spline 90 degrees in a clockwise direction. Composite objects made up of any of the previously mentioned simple objects can also be rotated.
The pivot point is always set to the bounding box center.
1 Select the object you want to rotate.
2 Choose Edit>Rotate . This turns the object 90 degrees clockwise.
3 Choose Edit>Rotate to turn the object again.
132 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Snapping an Object to the Grid
S NAPPING AN O BJECT TO THE G RID
This section describes how to snap an object to the grid.
1 Select the objects you want to snap.
2 Choose Edit>Snap . This snaps the four corners of the object bounding box to the nearest grid points. The object is resized to fit in its bounding box.
8
FactoryLink 6.6.0 / Application Editor Guide / 133
•
•
•
•
EDITING OBJECTS
Reshaping and Resizing
R ESHAPING AND R ESIZING
Reshaping an Object
This section describes how to reshape an object.
1 Select the object you want to reshape.
2 Choose Edit>Reshape . The object’s outline is displayed with handles.
3 Point to a handle, press and hold the left mouse button and drag it. Notice the object changes shape in response to the direction you drag the mouse. Release the mouse button when you finish.
4
Repeat Step 3 for the other handles to adjust the shape of the object.
5 Choose the Select mode to cancel the Reshape mode, When the shape is satisfactory.
Resizing an Object
When you select an object, eight handles display around the object and one is displayed in the middle of the object. You can use the eight handles surrounding the object to stretch or shrink the object.
Resize handles
Use the resize handles to stretch or shrink objects in the following directions. You cannot use the resize handles to change the shape of the object.
• Vertically—To resize vertically, use any of the three resize handles above or below the object.
• Horizontally—To resize horizontally, use any of the three resize handles at the left or right of the object.
• Vertically and horizontally—To resize both vertically and horizontally, use the corner resize handles.
You can also use handles to proportionally resize text objects. You cannot resize text nonproportionally.
134 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Reshaping and Resizing
Perform the following steps to resize an object:
1 Select an object. Handles display around the object.
2 Place the cursor on one of the handles and press the left mouse button. The handles disappear.
3 Drag the cursor in the direction you want to stretch or shrink it until you have achieved the desired size, then release the mouse button.
When you resize an object smaller than its handles, it may be difficult to select the object without selecting the handles. In this case, drag a border around the object to select it.
Caution: Do not reduce the size of a graphic object to a dimension of less than ten pixels in height or width because you may not be able to restore the object to its original size. If you lose the original dimensions of an object, reload the drawing. Refer to
“GraphicObject.Width” on page 294 and
“GraphicObject.Height” on page 295 for more
details.
You can stretch text until it reaches its maximum font size. Once you reach maximum font size, further stretching only increases the size of the text bounding box. The text remains at its maximum size.
Stretching a text bounding box beyond the text maximum font size affects the vertical spacing between text objects.
Resizing Text
Occasionally, the beginning or end of text disappears when text is resized. This can happen when you resize a window at development or run time or when
FactoryLink resizes a drawing to fit inside its run-time window.
8
Before After
FactoryLink 6.6.0 / Application Editor Guide / 135
•
•
•
•
EDITING OBJECTS
Object Placement
Press F8 or choose Recalc Text Clip from the Edit menu to correct this problem,.
This recalculates the text bounding box so all text is displayed.
To avoid text clipping:
• Create your drawings in actual size view and choose Recalc Text Clip from the
Edit menu before saving the drawing.
4 If your platform supports scalable fonts, such as True Type or Type 1 fonts, use them. Fonts that only come in predefined sizes are more likely to clip.
O BJECT P LACEMENT
Moving and Object Front or Back
This section describes how to move an object in front of or behind another object.
1 Select the objects you want to move to the front or back.
1 Choose Move to Front or Move to Back from the Edit menu, or choose the Move to
Front or Move to Back tools from the toolbar. The object moves in front of or behind all other objects.
136 / FactoryLink 6.6.0 / Application Editor Guide
EDITING OBJECTS
Working with Object Names
W ORKING WITH O BJECT N AMES
Renaming an Object
When objects are drawn, they are given a numerical object name.
Perform the following steps to assign a unique name to an object:
1 Select the object you want to rename.
2 Choose Object Name from the Attributes menu. The Object Name dialog is displayed.
8
3 Enter the name you want to assign to the object.
4 Click on OK .
Searching for an Object in a Drawing
This section describes how to find an object in a drawing using its object name.
1 Choose Find from the Edit menu. The Select Object Name dialog is displayed, listing all the top-level objects in the active drawing.
2 Select an object name from the list or enter an object name in the Find Object field.
Click on
OK
. The object with that name is surrounded by handles, indicating its location.
FactoryLink 6.6.0 / Application Editor Guide / 137
•
•
•
•
EDITING OBJECTS
Working with Object Names
138 / FactoryLink 6.6.0 / Application Editor Guide
Data Reporting Configuration Guide
Part III
Object Animation
139
Chapter 9
Animating Objects
You can animate objects in a graphics file to perform an action, such as to change color, size, and position, or to display information. The action occurs based on the value of an element in the real-time database. Animating objects links the object to the data element that controls its action. There are two levels of animation:
• Object level—Animation is defined for a single object. You can apply the following types of animation to an object:
• Input text—Operator can write values to a real-time database element.
• Output text—Displays current value of a real-time database element.
• Chart—Graphically displays element values on a strip chart.
• Legend—Displays the chart range.
• Pen—Draws the element value on a chart.
• Paint—Changes color based on limits.
• Bar—Graphically displays element values on a bar chart.
• Symbol—Graphically displays element values as symbols.
• Button—Performs an action, such as displaying another drawing.
• Template—Preserves objects, their attributes and animation for repeated use as a baseline.
• Power VB—Allows animation scripts to be attached to FactoryLink 6.6.0 graphic objects.
• Drawing level—Animation is defined for the drawing. You can apply the following types of animation to a drawing:
• Print screen—Prints the contents of a drawing window.
• Beep—Produces an audible beep.
• Function key—Performs an action in response to pressing a key.
This chapter discusses the concepts you must understand to animate objects. The remainder of this part describes how to animate objects for each animation type.
9
FactoryLink 6.6.0 / Application Editor Guide / 141
•
•
•
•
ANIMATING OBJECTS
Animation Tools
A NIMATION T OOLS
The Application Editor provides a variety tools through the menus and the Tools box to assist you in editing a drawing.
The Menus
The Animation menu is the primary menu used for animating the components of your screens. It includes commands for animating bars, buttons, symbols, charts, legends, painting, and specifying text as input or output fields.
The Tools Box
The Tools box provides quick access to many of the drawing tools found in the
Animate menu. It also includes tools found in other menus, such as Draw and
Edit.
The Tools box is displayed by default. Choose View>Toolbox to toggle the Tools box open or closed.
The following illustrates the Tools box and identifies the tools used for animating and selecting objects.
Select
Output Text
Bar
Button
Input Text
Symbol
Legend
Test
Paint
Chart
Other tools will be identified as needed throughout this manual.
142 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING OBJECTS
Static and Animated Objects
S TATIC AND A NIMATED O BJECTS
Objects not animated are considered static. A drawing can contain a combination of both object types. If you overlap an animated object with a static object, you may get unwanted results. For example, if you place a static object on top of an animated object, the animated object moves in front of the static object when the value of the element associated with the animated object changes.
To prevent this from happening, insert the -01 flag in the Program Arguments field for the GRAPH task from the System Configuration Information panel.
The argument causes the static object to be redrawn when the value of the animated object it overlaps changes.
FactoryLink 6.6.0 / Application Editor Guide / 143
9
•
•
•
•
ANIMATING OBJECTS
Dynamic and Static Attributes
D YNAMIC AND S TATIC A TTRIBUTES
Some of the animation dialogs in the Application Editor have optional fields that let you assign attributes associated with these fields to an object at run time.
Attributes you can assign to an object at run time are called dynamic attributes.
The following table lists these optional fields and their associated attributes.
Table 9-0 Object Attributes
Optional field Associated attribute
Foreground Color Control The object foreground color.
Background Color Control The object background color.
X Position Control
Y Position Control
The object’s horizontal position in the application drawing.
The object’s vertical position in the application drawing.
Dynamic attributes override static attributes.
Perform the following steps to assign an attribute to an object at run time:
1 Enter a tag name referencing an element in the appropriate optional field during animation.
2 Configure another task, such as Math & Logic, to change the value of the element.
Run-time graphics reads this value and uses it to display the object in the application drawing.
3 Set the -t flag in the Program Arguments field for the GRAPH task from the
System Configuration Information panel to control which attributes are displayed
(static or dynamic) when a screen is redrawn.
• If you set the -t flag, static attributes display after a screen is redrawn.
• If you do not set the -t flag, the dynamic attributes display after a screen is redrawn.
144 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING OBJECTS
Object Level Animation
O BJECT L EVEL A NIMATION
Not all objects can be animated with all animation types. The following table lists the animation types permitted for each object type.
Table 9-0 Animation Types for Each Object Type
Animation
Object
Input
Text
Out
Text
Lgnd Paint
Line
Arc
Parabola X
Box X
X
X
Ellipse X
Polygon X
Spline X
Text X X
Legend X
Bar
X
X
X
X
X
X
X
X
Chart
X
Sym
X
X
X
X
X
X
X
X
Button
X
X
X
X
X
X
X
X
PwrVB
X
X
X
X
X
X
X
X
X
When you open a drawing and open the Animation menu without an object selected, a check mark displays next to the animation characteristic selected for the drawing.
When you select an animated object and open the Animation menu, a check mark displays next to each animation characteristic selected for the object. The animation also shows as a check mark on the toolbar.
9
FactoryLink 6.6.0 / Application Editor Guide / 145
•
•
•
•
ANIMATING OBJECTS
Testing the Animation of a Drawing
T ESTING THE A NIMATION OF A D RAWING
Perform the following steps to test the animation and attributes assigned to an object:
1 Choose Animation>Test to display all static and animated objects in its window. If desired, resize the window the drawing is displayed in.
2 Choose Test Cycle (or press Enter ) to test the animation of objects other than buttons, function keys, or Power VB. Each animated object makes a single step through its animation limits.
This tests each animated object except for those animated as buttons or function keys by stepping once through its animation limits.
3 Choose a button or press a function key to test its animation. A dialog displays indicating the action taken and tag name associated with the button or function key.
Button or Function Key Detected
Key: key_name , Action: action ,
!Tagname: name where key_name Is the key selected from the F-KEY field on the Button or Function
Key dialog. If a key combination is used, key_name is the combination of keys from the F-KEY field and the Shift field.
action Is the selected for the button or function key from the Action field on the Button or Function Key dialog.
name Is the name of the element defined for the button or function key.
When this box displays, it demonstrates the button or function key performs as animated.
4 Click on OK to clear the box from the screen.
5 To end the test at any time, choose Test again to return to the drawing mode.
146 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING OBJECTS
Color/Analog Value Table
C OLOR /A NALOG V ALUE T ABLE
This section provides the analog values of the colors in the color palette shown below.
0 1 2 3
8 9 10 11
16 17 18 19
24 25 26
32
40
48
33
41
49
34 35
42
50
43
51
56 57 58
27
59
4
12
20
28
36
44
52
60
5
13
21
29
37
45
53
61
6
14
22
30
38
46
54
62
7
15
23
31
39
47
55
63
The names of the colors in the color palette and their associated analog values are displayed in the following table.
Table 9-0 Color Analog Values
Analog
Value
4
6
0
2
8
10
Color
Red
Orange-Red
Yellow
Yellow-Green
Green
Sea Green
Analog
Value
5
7
1
3
9
11
Color
Orange-Red
Yellow Orange
Green-Yellow
Pale Green
Lime Green
Aquamarine
9
FactoryLink 6.6.0 / Application Editor Guide / 147
•
•
•
•
ANIMATING OBJECTS
Color/Analog Value Table
Table 9-0 Color Analog Values (Continued)
Analog
Value
36
38
40
42
28
30
32
34
44
46
48
50
52
20
22
24
26
12
14
16
18
Color
Cyan
Sky Blue
Blue
Cornflower Blue
Magenta
Coral
Indian Red
Brown
Khaki
Med Olive Green
Spring Green
Dark Green
Turquoise
Slate Blue
Navy Blue
Violet
Red-Violet
Maroon
Black
Dark Gray-3
Dark Gray-1
Analog
Value
37
39
41
43
29
31
33
35
45
47
49
51
53
21
23
25
27
13
15
17
19
Color
Light Blue
Medium Blue
Midnight Blue
Orchid
Pink
Firebrick
Sienna
Sandy Brown
Light Olive Green
Dark Olive Green
Forest Green
Dark Aquamarine
Cadet Blue
Steel Blue
Blue-Violet
Dark Orchid
Plum
Dark Maroon
Dark Gray-4
Dark Gray-2
Med. Gray-6
148 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING OBJECTS
Color/Analog Value Table
Table 9-0 Color Analog Values (Continued)
Analog
Value
54
56
58
60
62
Color
Med. Gray-5
Med. Gray-3
Med. Gray-1
Light Gray-3
Light Gray-1
Analog
Value
55
57
59
61
63
Color
Med. Gray-4
Med. Gray-2
Light Gray-4
Light Gray-2
White
FactoryLink 6.6.0 / Application Editor Guide / 149
9
•
•
•
•
ANIMATING OBJECTS
Blink Rate
B LINK R ATE
Each animation type that allows for the blinking of an object provides a rate choice of slow or fast blink. The fast blink speed within an application is controlled by setting the -bxxxx parameter in the System Configuration panel where xxxx is the period of blinking in milliseconds. The default is 1000 ms if this parameter is not set.
150 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 10
Animating
Input/Output Fields
You can animate text objects in two ways:
• As output fields—Displays numeric values or text messages.
• As input fields—Accepts input from the keyboard and writes it to a real-time database element.
This chapter describes how to animate text objects as input or output fields.
FactoryLink 6.6.0 / Application Editor Guide / 151
10
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field
A NIMATING T EXT AS AN I NPUT F IELD
A text object animated as an input field accepts input from the keyboard and writes it to a real-time database element. At run time, a reverse video cursor displays in the input text field. If more than one field is animated as input text, the cursor displays in input fields based on the object name.
At run time:
• Press Tab to move through the fields according to the input text’s object name.
Input text displays in the order it is created.
• When positioned in a field, press Esc to delete old data from the field before typing new data.
• When you enter an out-of-range value in a field, a message displays notifying you of the error. Until you acknowledge the error, the system will not update animated objects. When you acknowledge the error, the system positions the cursor in the field containing the error.
Perform the following steps to animate a text object as an input field:
1 Choose Draw>Text .
2 Place the cursor where you want the text to display and click the left mouse button to display a text bar.
3 Type the format of the text to be entered in this field. Type an uppercase X for each character position. For example, type XXXXX for a five-character field. Input is compared to this format. If any text is entered in this field that exceeds the limits set by this format, the entry is rejected.
If the text to be entered in this field will contain a decimal point, you must include a decimal in the text format, as in XXX.XXX
. Input is compared to this format. If the number of digits entered to the left of the decimal exceed the number of digits defined in the format, the entry is rejected and asterisks are written to the element. If the number of digits entered to the right of the decimal exceed the number of digits defined in the format, the entry is accepted; however, it is truncated to fit in the available positions.
If the text to be entered in this field defines the name of a window and the name of a drawing to open in that window, use the following format if the specified action for this field is TOP:
XXXXXXXXX[:XXXXXX]
152 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field where the X s before the colon define the window name. You can specify up to 16 positions to hold the window name. The X s after the colon define the drawing name. You can specify up to 8 positions to hold the drawing name. The drawing name is optional.
If the text to be entered in this field defines the name of a window and the name of a drawing to open in that window, use the following format if the specified action for this field is DRW:
[XXXXXXXXX]:XXXXXXX where the X s before the colon define the window name. You can specify up to 16 positions to hold the window name. The window name is optional. The X s after the colon define the drawing name. You can specify up to 8 positions to hold the drawing name.
4 The Application Editor remains in text mode so you can place the cursor in multiple locations to add text. Change to select mode to exit text mode.
5 Select the text you want to animate.
6 Choose Animate>Input Text to display the Input Text Animation dialog. The name of the object selected displays in the title.
7 Provide the following information in this dialog:
Tag Enter a name to reference the element that receives the input.
Valid Entry: standard tag name
Valid Data Type: digital, analog, longana, float, message
FactoryLink 6.6.0 / Application Editor Guide / 153
10
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field
Range Check
Parameters
Range check parameters define the numerical limits of the element. The operation defined in the Action field of this dialog is not performed if the result of the operation exceeds these limits.
These fields do not apply if the tag defined in the Tag field is a message. This field is optional.
Maximum Enter a number to indicate the high range for the limit.
Minimum Enter a number to indicate the low range for the limit.
Action Defines the action taken when text is entered in this field. This can be one of the following:
SET Writes the value entered in the input field to the real-time database element referenced by the name defined in the Tag field on this dialog. This action and the NUL action are the only two actions valid for a message tag.
ADD Adds the value entered in the text input field to the current value of the database element referenced by the name defined in the Tag field on this dialog.
SUB Subtracts the value entered in the text input field to the current value of the database element referenced by the name defined in the Tag field on this dialog.
TOP Opens the window specified in the input field and moves it to the top.
If a drawing is also specified, the drawing displays in the window.
If a drawing is not specified, the default drawing specified for the window displays.
154 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field
DRW Opens a drawing and places it in a window. The
DRW action only loads a drawing into a window. It does not change the order of windows or make a window active.
If a window is also specified, the drawing displays in the specified window.
If a window is not specified, the drawing displays in the current window (the window where the operator types the window name).
PAN Moves back and forth along a chart using the numeric range as the panning distance. This is valid only if you are showing chart data in historical mode. Refer to the task where you have configured your chart for more details.
ZM Zooms in or out to expand or reduce the time period viewed on a chart. This is valid only if you are showing chart data in historical mode. Refer to the task where you have configured your chart for more details.
MOD Switches between real-time and historical mode when displaying data on a chart. If the tag is set to
0, real-time mode is displayed. If it is set to 1, historical mode is displayed.
NUL No action is taken. This action and the SET action are the only two actions valid for a message tag.
The actions ON, OFF, TGL (toggle), ENB (enable), MON (momentary on), MOF
(momentary off), and STP (stop) are available but rarely used as actions for input text. If any of these actions are defined, the action occurs whenever text is entered into the input text field. For example, if the input text tag action is ON, anytime text is entered in the input field, the tag is set to ON.
Options>
Background updates
Choose this option if you want to use the field as both an input text and an output text field. If this option is not selected, the field can only be used to enter text.
Color Controls Defines the text foreground and background colors and blink rate of the text field.
10
FactoryLink 6.6.0 / Application Editor Guide / 155
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field
Foreground Enter the name of an analog tag that defines the color of choice for this text field at run time.
When the Tag Definition dialog displays, enter the analog in the Value field that corresponds to the
desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that correspond
to colors on the color palette.
Background Enter the name of an analog tag that defines the color of choice for the text field background at run time.
When the Tag Definition dialog displays, enter the analog in the Value field that corresponds to the
desired color. Refer to Chapter 9, “Animating
Objects,” for a list of analog values that correspond
to colors on the color palette.
Blink Enter the name of a digital tag that controls the blink rate of the input text. This tag is initialized with a value according to the blink speed chosen.
This can be one of the following:
None Text does not blink. This is the default.
Slow Text blinks slowly.
Fast Provides a blink every second.
Position Controls Defines the horizontal and vertical location of the text field in the drawing.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing.
The value of the left side of the drawing is 0 and the value of the right side of the drawing is 32000.
If you leave the field blank, the text displays where you drew it. If you specify a tag without writing a value to it, the value defaults to the default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves horizontally within the display.
156 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Input Field
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text displays where you drew it. If you specify a tag without writing a value to it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
Object Security
Defines the security of the object. Refer to Part V, “Security” in
this book for details on defining security classes and logins.
Security class Select the appropriate security class from the pull-down list field.
Log Message Enter a text string to identify the object for the security log.
8 Click on OK to save the animation information.
10
FactoryLink 6.6.0 / Application Editor Guide / 157
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Output Field
A NIMATING T EXT AS AN O UTPUT F IELD
A text object animated as an output field can display the value of a real-time database element.
Perform the following steps to animate a text object as output text:
1 Choose Draw>Text .
2 Place the cursor where you want the text displayed and click the left mouse button to display a text bar.
3 Type the format of the text to be displayed in this field. Type an uppercase X for each character position. For example, type XXXXX for a five-character field.
Output is compared to this format. If the output exceeds the limits set by this format, the displayed text is truncated; however, the total width of the field must be enough to accommodate the longest possible entry.
FactoryLink uses proportional font spacing in displaying the text. More space is required to display the letter w than the letter i. The Xs used to mark the text output set the character count and width of the field. If the displayed output is within the character count but the size of the characters displayed exceeds the width of the field, the text displayed will be truncated.
Include a decimal in the text format, as in XXX.XXX if the text to be displayed in this field will contain a decimal point. Output is compared to this format.
If the field is not large enough to display a particular floating-point value and only least-significant digits up to the decimal are truncated, the task writes the value in the number of available character positions.
If the task truncates the decimal or any digits to the left of the decimal, the task does not write the value. Instead, it writes asterisks indicating significant digits are lost.
If you do not specify a decimal in the field, the task writes floating-point values with all of the digits to the left of the decimal and as many digits as possible to the right of the decimal.
If the text to be displayed in this field is the date and time, you can enter the format you want to use to display this information. You can specify any combination of the following. Separate formats with the spaces and punctuation marks (colons, dashes, commas) you want shown at run time.
year Displays a four-digit year (1995)
158 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Output Field yr Displays a two-digit year (95) mon Displays an alpha month abbreviation (Feb) mo Displays a two-digit month (01-12) dy Displays a two-digit day of month (01-31) hr Displays military hours (0-23) ah Displays hour of day (1-12) mi Displays minute (0-59) sc Displays second (0-59) ap Displays two-character am/pm indicator dow Displays day of the week
Note: FactoryLink supports only these English-language format tokens.
4 The Application Editor remains in text mode so you can place the cursor in multiple locations to add text. Change to select mode to exit text mode.
5 Select the text you want to animate.
6 Choose Animation>Output Text to display the Output Text Animation dialog.
10
FactoryLink 6.6.0 / Application Editor Guide / 159
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Output Field
7 Specify the following information:
Tag Enter a name to reference the element displayed in the text field.
To display the start time for a chart, you must use the same name defined in the Starting Time field on the Chart Animation dialog.
To display the end time for a chart, you must use the same name defined in the Ending Time field on the Chart Animation dialog.
If you leave this field blank, the static text does not change. Place a tag in the Alternate Comparison field to change the color of static text.
The tag specified must be one of the following types: digital, analog, longana, float, or message.
Color Changes The fields in this area define color changes when limits are met.
To define a color, you must double click the color button to display the color palette and select the desired color. The color button reflects the color selected. Specify the following to effect color changes. Do this for each limit you want to set. You can specify up to 16 limits.
FG Specify the text color used when the limit is met.
BG Specify the background color of the text field when the limit is met.
Blink Specify the blink animation used when the limit is met. This field toggles through none (no blink), slow (slow blink), or fast (fast blink).
None is the default.
*Limit Enter the limit where the change occurs. This can either be a numeric value or the name of a tag whose value defines the limit.
The tag specified must be one of the following types: analog, longana, or float.
Alternate
Comparison Tag
Name of the tag to compare with the defined limits to determine the text and background color. You can use the same tag name as the one used in the Tag field of this dialog unless the tag type is message. If you leave this field blank, no limit changes are performed.
The tag specified must be one of the following types: digital, analog, longana, or float.
160 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Output Field
Foreground Enter the name of an analog tag that defines the color of choice for this text field at run time.
When the Tag Definition dialog is displayed, enter the analog in the Value field that corresponds to
the desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that
corresponds to colors on the color palette.
Background Enter the name of an analog tag that defines the color of choice for the text field background at run time.
When the Tag Definition dialog displays, enter the analog in the Value field that corresponds to the
desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that
corresponds to colors on the color palette.
Blink Enter the name of a digital tag that controls the blink rate of the input text. This tag is initialized with a value according to the blink speed chosen.
This can be one of the following:
None Text does not blink. This is the default.
Slow Text blinks slowly.
Fast Provides a blink every second.
Position Controls Defines the horizontal and vertical location of the text field in the drawing.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing.
The value of the left side of the drawing is 0 and the value of the right side of the drawing is 32000.
If you leave the field blank, the text displays where you drew it. If you specify a tag without writing a value to it, the value defaults to the default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves horizontally within the display.
10
FactoryLink 6.6.0 / Application Editor Guide / 161
•
•
•
•
ANIMATING INPUT/OUTPUT FIELDS
Animating Text as an Output Field
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text displays where you drew it. If you specify a tag without writing a value to it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
8 Click on OK to save the animation information.
162 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 11
Animating a Chart
You can graphically display data on charts using chart animation. Chart animation is used in trending data and in showing statistical data.
You can chart trending data from the real-time database or a relational database.
This chapter describes how to animate chart objects for showing data from the real-time database. Refer to Part XII, ”Trending” in the Reporting for specific details on animating charts to show trending data from a relational database.
Refer to “Drawing and Animating Display Charts” in the PowerSPC
Configuration Guide for details on animating charts to show statistical data.
The steps involved in creating and animating a real-time trend chart are described below. References are made to sections of this manual that provide the details for performing each step.
1. Draw a rectangle to contain the chart and at least one legend object next to it or under it.
2. Animate the rectangle as a chart. Refer to “Animating a Real-Time Only Chart
Object” on page 164 for details on animating a chart.
3. Assign a pen. Refer to “Assigning a Pen for the Chart” on page 167 for details
on animating a pen.
4. Animate the legend. Refer to “Animating a Legend” on page 170 for details on
animating a legend.
Note: Trending performance is affected if the chart object is partially covered by another window, or if the chart is only partially visible in a window. If only a part of the chart object is visible, the chart must be redrawn each time it is updated. This slows performance, especially if the chart is updated frequently.
11
FactoryLink 6.6.0 / Application Editor Guide / 163
•
•
•
•
ANIMATING A CHART
Animating a Real-Time Only Chart Object
A NIMATING A R EAL -T IME O NLY C HART O BJECT
This section describes how to animate a rectangle as a chart object. The drawing shown below is the sample chart you will animate using this procedure.
Legend
1 Select the object you want to animate as a chart. In this case, select the box to the right of the legend.
2 Following the Attributes>Fill path, define a foreground color for the chart. You cannot use a transparent or hatch fill style in a trend chart.
3 Choose Animation>Chart to display the Chart Animation dialog.
164 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING A CHART
Animating a Real-Time Only Chart Object
4 Complete the following required areas of the dialog:
Data Source or
Scroll Trigger Tag
Enter the name of the tag that triggers one pen movement in the specified direction.
Scroll Direction Select the direction you want the trend to move. This can be up, down, right, or left.
Initial Chart
Duration
Select a scale for the chart and enter the amount of time the chart can display. For example, if you type 2 in the field and choose
Hours , the chart displays two hours of data.
Chart Scroll
Frequency
Enter the frequency for plotting data, expressed as unit of time per data point. For example, type 1 and choose Secs to plot a point every second.
Starting Time Leave this field blank. This field is not used for real-time only trending.
Ending Time Leave this field blank. This field is not used for real-time only trending.
Zoom Leave this field blank. This field is not used for real-time only trending.
Pan Leave this field blank. This field is not used for real-time only trending.
Mode Leave this field blank. This field is not used for real-time only trending.
Cursor Position Enter an analog tag that controls the location of the value cursor on the chart. A value cursor is a vertical or horizontal line, depending on the trending direction, indicating the value of the pen where it intersects the value cursor.
Chart Color Enter an analog tag that contains the value of the chart background color.
Refer to Chapter 9, “Animating Objects"” for a list of analog
values that correspond to colors on the color palette. If you leave this field blank, use the Fill Attributes dialog to define the background color.
# of X Enter a positive integer to indicate the number of grid lines on the horizontal (X) axis. If you use zero or if the Grid On/Off element is set to 0, grid lines are not drawn.
11
FactoryLink 6.6.0 / Application Editor Guide / 165
•
•
•
•
ANIMATING A CHART
Animating a Real-Time Only Chart Object
# of Y Enter a positive integer to indicate the number of grid lines on the vertical (Y) axis. If you use zero or if the Grid On/Off element is set to 0, grid lines are not drawn.
Enter an analog tag that contains the value of the chart’s grid
color. Refer to Chapter 9, “Animating Objects"” for a list of analog
values that correspond to colors on the color palette.
Grid Color Select a color for the grid. If the grid and the chart background colors are the same, the grid is invisible.
Grid On/Off Enter a digital tag to turn the grid on and off. If the value of the tag is 1 (ON), a grid is displayed on the chart. If the tag is 0
(OFF), no grid is displayed. If you leave this field blank, the grid cannot be activated.
5
Assign a pen to the chart. Refer to “Assigning a Pen for the Chart” on page 167 for
details.
166 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING A CHART
Assigning a Pen for the Chart
A SSIGNING A P EN FOR THE C HART
A trend chart uses pens to draw lines and plot data received from a database.
Each pen retrieves data from an element in the database.
You can create as many pens as you need to correspond to different sources of data you want to trend. You can usually distinguish up to 15 pen colors, but a more practical number is about 8 pens per chart.
Pen
Pen 2
Each pen draws a different trend line. This chart uses two pens.
You can change the appearance of a trend line by changing the pen style. For example, you can set the color of the line to blue, change the line style to dotted, and place circles where points are plotted.
Each pen operates independently of the other pens. Pens within a single chart can use different scales.
Perform the following steps to assign pens to a chart:
1 Choose Edit Pens from the Chart Animation dialog to display the Select Pen dialog.
2 Type the name of the pen object to be defined in the Pens field to create a new pen.
Select a pen from the pen list to edit a previously defined pen.
11
FactoryLink 6.6.0 / Application Editor Guide / 167
•
•
•
•
ANIMATING A CHART
Assigning a Pen for the Chart
3 Choose OK to display the Pen dialog.
4 Define the data to trend. One pen trends one data element.
5 Provide the following information for each pen used to trend data.
Tag Tag name assigned to the real-time database element trended by this pen. The tag specified must be one of the following types: analog, longana, or float .
Database Leave this field blank. This field is not used for real-time only trending.
Table Leave this field blank. This field is not used for real-time only trending.
Column Leave this field blank. This field is not used for real-time only trending.
Maximum Enter the maximum value the pen can plot. Values above this limit are not plotted on the trend chart.
Minimum Enter the minimum value the pen can plot. Values below this limit are not plotted on the trend chart.
168 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING A CHART
Assigning a Pen for the Chart
Max Tag Enter the name of a tag that defines the maximum value the pen can plot. This value replaces the value specified in the Maximum field. Values above the limit specified in this tag are not plotted on the trend chart. This is optional
Min Tag Enter the name of a tag that defines the minimum value the pen can plot. This value replaces the value specified in the Minimum field. Values below the limit specified in this tag are not plotted on the trend chart. This is optional
Color Enter the color used to display the pen. Choose a pen color by double clicking the color button and then double clicking the color you want to use on the color palette.
Limit Define the limit the pen color changes at. This can either be a number or the name of a tag that contains the limit value. You can dynamically change the limit at run time if you use a tag.
Line Style Select the style of line drawn by the pen.
Marker Style Select the graphical symbol to display at each plotted point.
Symbols are the same color as the pen they are associated with.
Interpolation Style Select the type of line to use to connect points drawn by the pen.
Choose Across Gaps to connect gaps in the trending data using the specified interpolation style. In a time-based chart, gaps occur when a sample does not get logged at the expected frequency.
Gaps occur when you forcibly create them in an event chart.
Cursor Value Tag Enter the name of the tag that defines the plotted point of the pen line that it intersects. The tag specified must one of the following types: analog, longana, or float.
6 Choose OK to save the information. This returns you to the Chart Animation dialog.
7 Choose OK to save the information.
8
Animate the legend using the information provided in “Animating a Legend” on page 170.
11
FactoryLink 6.6.0 / Application Editor Guide / 169
•
•
•
•
ANIMATING A CHART
Animating a Legend
A NIMATING A L EGEND
Perform the following steps to animate a legend for a real-time only trend chart.
Real-time only charts can only be animated based on time.
1 Select the legend object you want to animate. Verify no other objects overlap the legend object.
2 Choose Animation>Legend to display the Legend Animation dialog.
3 Provide the following information:
Direction Select the direction to display the legend scale in (major and minor division marks).
Parent Chart Reserved for future use.
Legend Type Choose Time as the mode for the scale of the legend.
Division Type Select the scale to display between the minimum and maximum values. This can be one of the following:
Count The legend scale is divided equally by the number specified in the Major Divisions field or the value the operator writes to this tag at run time. The formula used to calculate this value is:
(Maximum - Minimum) ÷ Major Divisions
170 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING A CHART
Animating a Legend
Units The legend scale is incremented by the number specified in the Major Divisions field or the value the operator writes to this tag at run time from the minimum to the maximum.
Refer to the following example for both count and units legends with a maximum of 100 and a minimum of 0 and 5 major divisions. FactoryLink divides the scale between 0 and 100 into 5 equal parts for the count legend. FactoryLink increments the scale between 0 and 100 by 5 for the units legend.
Maximum Value = 100
Minimum Value = 0
Major Divisions = 5
Minor Divisions = 0
Count Legend
100
80
60
40
20
0
Units Legend
80
75
70
65
60
55
40
35
30
25
20
15
10
5
0
100
95
90
85
Scale Maximum Enter a maximum value for the trend chart legend. This can be one of the following:
Value Enter a maximum value for the legend. This can be any positive or negative integer or floating-point numeric constant.
Tag Enter the tag name specified in the Ending Time field on the Chart dialog to synchronize the time displayed on the legend with the time displayed on the chart object.
Scale Minimum Enter a minimum value for the trend chart legend. This can be one of the following:
Value Enter a minimum value for the legend. This can be any positive or negative integer or floating-point numeric constant.
11
FactoryLink 6.6.0 / Application Editor Guide / 171
•
•
•
•
ANIMATING A CHART
Animating a Legend
Number of Major
Divisions
Tag Enter the tag name specified in the Starting Time field on the Chart dialog to synchronize the time displayed on the legend with the time displayed on the chart object.
Enter the number of major divisions for the trend chart legend.
This can be one of the following:
Value Enter a positive or negative integer or floating-point numeric constant. This field works with the Division Type field to determine how the number of major divisions are displayed.
Tag Enter the name of a tag whose value dynamically updates the major divisions of the legend. To change the number of major divisions, animate an input-text field that writes to this tag.
For example, a metric ruler 5 centimeters long would have 5 major divisions—one for each centimeter. This ruler would have also have 25 minor divisions—one every 2 millimeters.
Minor divisions
1 2 3 4 5
Major divisions
Number of Minor
Divisions
Enter the number of minor divisions for the trend chart legend.
The minor divisions are displayed between the major divisions on the trend chart legend. This can be one of the following:
Value If the division type is count, enter any positive integer, including zero. If the division type is units, enter any positive or negative number.
Tag Enter the name of a tag whose value dynamically updates the minor divisions of the legend.
Configure an input animation or other task that writes to this tag to change the number of minor divisions.
172 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING A CHART
Animating a Legend
Format Enter the formatting characteristics for the legend scale. This can be one of the following: year Year with four digits, for example, 1997 yr Year with two digits, for example, 97 mon Alphabetical month abbreviation, for example,
Jan, Feb, or Mar mo Month numerically, for example, 5 (for May) dy Day of the month using two digits, for example, 09,
10, 11 hr Hour of the day in 24-hour format (military time), for example, 09 or 21 (9:00 am and 9:00 pm, respectively) ah Hour of the day in 12-hour format, for example, 9 is displayed for both 9:00 am and 9:00 pm mi Minute, for example, 07 is displayed for seven minutes past the hour sc Second, for example, 07 is displayed at seven seconds past the minute ap am and pm dow Day of the week
You can combine time formats, separating them with spaces and punctuation marks as necessary.
For example, enter mon day, year to show the date as Jan 03, 1997. Type ah:mi ap to show the time as
9:07 pm.
4 Choose OK when you have completed entering all the information on this dialog to save the data and return to the legend object.
11
FactoryLink 6.6.0 / Application Editor Guide / 173
•
•
•
•
ANIMATING A CHART
Animating a Legend
174 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 12
Animating an Object as a Button
You can animate an object so, when selected, it performs an action. For example, you can animate a button that opens another window or closes the application.
Perform the following steps to animate a button object to perform an action.
1 Select the object you want to animate.
2 Choose Animation>Button to display the Button Animation dialog.
3 Fill out this dialog. Provide the following information to animate the object:
Mouse Click or
Key
Select the mouse button or keystroke that activates the button.
This works in conjunction with the left mouse button; that is, you can use this method to activate the button in addition to clicking the left mouse button.
12
FactoryLink 6.6.0 / Application Editor Guide / 175
•
•
•
•
ANIMATING AN OBJECT AS A BUTTON
For example, if you choose F1 , you activate the button by pressing the F1 function key or by clicking on the button object using the left mouse button. The following table lists the possible options and defines the key sequence that corresponds to the option.
Table 12-0 Mouse or Key Options
Option Key sequence
NUL
BT1
BT2
BT3
BRK
BSP
TAB
BTB
None
Reserved
Reserved
Reserved
Break
Backspace
Tab
Shift+Tab
NL Enter (OS/2 only)
ALGA Alt-Graph
Pause PSE
CLK Caps Lock
ESC
PUP
Esc
Page Up
Option
PDN
END
HME
LFT
UP
RGT
DWN
PSC
Key sequence
Page Down
End
Home
Left arrow
Up arrow
Right arrow
Down arrow
Print Screen
INS
DEL
SCR
ENT
Insert
Delete
Scroll Lock
Enter
SYS SysReq
F1 - F24 Function keys 1 to 24
Alt, Ctrl and Shift Select one of these to add to the alternate key sequence defined to activate the mouse button. For example, if you specify INS in the
Mouse Click or Key field and choose Alt , you must press Alt+Insert to use the alternate method to activate the button. Keys like BTB,
SYS, and BRK with shift, alt, ctrl don’t work.
176 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING AN OBJECT AS A BUTTON
Action Defines the action taken when the button is activated. This can be one of the following:
SET Writes the value of the Value or Tag field to the real-time database element referenced by the
Destination Tag field on this dialog.
ADD Adds the value of the Value or Tag field to the real-time database element referenced by the
Destination Tag field on this dialog.
SUB Subtracts the value of the Value or Tag field from the real-time database element referenced by the
Destination Tag field on this dialog.
TOP Opens the window specified in the Value field and displays the drawing currently defined for the window.
If you want to specify a different drawing, define both the window name and drawing name separated by a colon in the Value field, using the following format: window_name:drawing_name
Refer to Step 3, Animating Text as an Input Field, for details on text formatting.
DRW Opens a drawing and places it in the current window.
MON Sets digital tag to ON when mouse is placed over object with left mouse button depressed. Sets tag to OFF when the button is released.
MOF Sets digital tag to OFF when mouse is placed over object with left mouse button depressed. Sets tag to OFF when the button is released.
NUL No action is taken.
12
FactoryLink 6.6.0 / Application Editor Guide / 177
•
•
•
•
ANIMATING AN OBJECT AS A BUTTON
Source Value or
Tag
Enter the value to use to perform the action. This can either be a constant defined in the Value field or a variable defined in the Tag field. You can only specify one of these fields.
Value Fixed constant to combine with the value in the
Destination Tag field to perform the action specified in the Action field.
Tag Name of the tag that contains the value to combine with the Destination Tag field to perform the action specified in the Action field. The tag specified must be one of the following types: digital, analog, longana, float, or message.
Destination Tag Tag name used to reference the real-time database element that receives the action. The tag specified must be one of the following types: digital, analog, longana, float, or message.
Range Check
Parameters
Range check parameters define the numerical limits of the element. The operation defined in the Action field of this dialog is not performed if the result of the operation exceeds these limits.
These fields do not apply if the tag defined in the Tag field is of type message.
Maximum Enter a number to indicate the high range for the limit.
Minimum Enter a number to indicate the low range for the limit.
Position Controls Defines the horizontal and vertical location of the text field in the drawing.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing.
The value of the left side of the drawing is 0 and the value of the right side of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to the default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or
178 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING AN OBJECT AS A BUTTON another real-time input so the object moves horizontally within the display.
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
Object Security Defines the security of the object.
Security class Select the appropriate security class from the pull-down list field.
Log Message Enter a text string to identify the object for the security log.
4 Choose OK to save the animation information.
Note: You may stack buttons on top of one another, but this practice is not recommended if you have security defined on any
of them. Refer to “Security and Stacked Buttons” on page 373
for more detail.
12
FactoryLink 6.6.0 / Application Editor Guide / 179
•
•
•
•
ANIMATING AN OBJECT AS A BUTTON
180 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 13
Paint and Bar
Animation
This chapter describes how to:
• Animate an object with paint. You can change the color of an object as the value of a real-time database element changes using Paint animation.
• Animate a bar object. Bar animation lets you graphically represent the value of an element. You can change the movement and color of the bar as the value of a real-time database element changes.
A NIMATING A P AINT O BJECT
Perform the following steps to assign color changes to an object:
1 Select the object to be animated.
2 Choose Animation>Paint to display the Paint Animation dialog.
13
FactoryLink 6.6.0 / Application Editor Guide / 181
•
•
•
•
PAINT AND BAR ANIMATION
Animating a Paint Object
3 Specify the following information:
Tag Enter a name to reference the element that affects the object color. The tag specified must be one of the following types: digital, analog, longana, float, or message.
Color Changes The fields in this area define color changes when limits are met.
To define a color, you must double click the color button to display the color palette and choose the desired color. The color button reflects the color selected. Specify the following to effect color changes. Do this for each limit you want to set. You can specify up to 16 limits.
Foreground Enter the name of an analog tag that defines the color of choice for this text field at run time.
When the Tag Definition dialog is displayed, enter the analog in the Value field that corresponds to
the desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that correspond
to colors on the color palette.
Background Enter the name of an analog tag that defines the color of choice for the text field background at run time.
When the Tag Definition dialog is displayed, enter the analog in the Value field that corresponds to
the desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that correspond
to colors on the color palette.
Blink Enter the name of a digital tag that controls the blink rate of the input text. This tag is initialized with a value according to the blink speed chosen.
This can be one of the following:
None Text does not blink. This is the default.
Slow Text blinks slowly.
Fast Provides a blink every second.
Position Controls Defines the horizontal and vertical location of the text field in the drawing.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing.
182 / FactoryLink 6.6.0 / Application Editor Guide
PAINT AND BAR ANIMATION
Animating a Paint Object
The value of the left side of the drawing is 0 and the value of the right side of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to the default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves horizontally within the display.
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
4 Choose OK to save the animation information.
13
FactoryLink 6.6.0 / Application Editor Guide / 183
•
•
•
•
PAINT AND BAR ANIMATION
Animating an Object as a Bar
A NIMATING AN O BJECT AS A B AR
Perform the following steps to animate an object as a bar:
1 Select the object to be animated.
2 Choose Animation > Bar to display t he Bar Animation dialog.
3 Specify the following information:
Tag Enter a name to reference the element that affects the objects movement and color. The tag specified must be one of the following types: digital, analog, longana, float, or message.
Maximum Enter the maximum value that can display on the uni-directional bar. This field does not apply to bi-directional bars.
You can enter either a constant value or name of a tag that contains the maximum value. If you enter a tag name, the upper limit can be changed during run time. The tag specified must be one of the following types: analog, longana, or float.
Minimum Enter the minimum value that can display on the uni-directional bar. This field does not apply to bi-directional bars.
You can enter either a constant value or name of a tag that contains the minimum value. If you enter a tag name, the lower limit can be changed during run time. The tag specified must be one of the following types: analog, float, or longana.
184 / FactoryLink 6.6.0 / Application Editor Guide
PAINT AND BAR ANIMATION
Animating an Object as a Bar
Direction Direction the color moves when the value of the tag specified in the Tag field of this dialog increases or decreases. You can configure bars to grow either horizontally or vertically and in one or two directions.
If you want the color movement to occur uni-directionally, choose one of the first four options. Uni-directional bars move in only one direction from the point of origin.
If you want the color movement to occur bi-directionally, choose one of the last two options. Bi-directional bars move in both a positive and negative direction from the point of origin.
The following table shows how uni-directional and bi-directional bars work.
Table 13-0 Unidirectional and Bidirectional Bars
Unidirectional Bars Bidirectional Bars
If the Tag field element value is:
Then the bar is:
If the Tag field element value is:
Then the bar is:
< the Min. value not colored
> the Min. value and
< the Max. value colored to the value of the field element
= the Max. value completely colored
Tag
< the anchor point
= the anchor point
> the anchor point moves in a negative direction
(toward the Min. value) is a single line at the anchor point moves in a positive direction
(toward the
Max. value).
Bidirectional
Anchor Point
Enter the value the color in a bi-directional bar grows from. The anchor point has no effect on uni-directional bars.
Color Changes The fields in this area define color changes when limits are met.
To define a color, you must double click the color button to display the color palette and select the desired color. The color button
13
FactoryLink 6.6.0 / Application Editor Guide / 185
•
•
•
•
PAINT AND BAR ANIMATION
Animating an Object as a Bar reflects the color selected. Specify the following to effect color changes. Do this for each limit you want to set. You can specify up to 16 limits.
Foreground Enter the name of an analog tag that defines the color of choice for this text field at run time.
When the Tag Definition dialog displays, enter the analog in the Value field that corresponds to the
desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that correspond
to colors on the color palette.
Background Enter the name of an analog tag that defines the color of choice for the text field background at run time.
When the Tag Definition dialog displays, enter the analog in the Value field that corresponds to the
desired color. Refer to Chapter 9, “Animating
Objects” for a list of analog values that correspond
to colors on the color palette.
Blink Enter the name of a digital tag that controls the blink rate of the input text. This tag is initialized with a value according to the blink speed chosen.
This can be one of the following:
None Text does not blink. This is the default.
Slow Text blinks slowly.
Fast Provides a blink every second.
Position Controls Defines the horizontal and vertical location of the text field in the drawing.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing.
The value of the left side of the drawing is 0 and the value of the right side of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to the default value of the tag you entered.
186 / FactoryLink 6.6.0 / Application Editor Guide
PAINT AND BAR ANIMATION
Animating an Object as a Bar
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves horizontally within the display.
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to
it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
4 Choose OK to save the animation information.
13
FactoryLink 6.6.0 / Application Editor Guide / 187
•
•
•
•
PAINT AND BAR ANIMATION
Animating an Object as a Bar
188 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 14
Animating an Object as a Symbol
You can use symbol animation for two purposes:
• To represent the values of an element
• To create a moving image
This chapter describes how to achieve both of these purposes.
You can use either of the following two methods to display symbols at run time:
• Method 1—Erases the existing symbol by redrawing the symbol background
(the part of the screen behind the symbol) then draws the new symbol.
Because graph spends time redrawing the background to mask the previously displayed symbol, this method affects system performance.
To use Method 1, insert a -p (not case-sensitive) in the graph task row of the
Program Arguments column in the System Configuration Information panel.
• Method 2—Draws only the new symbol.
Method 2 requires you to combine a solid object, such as a box or a circle, with the symbol to serve as the symbol’s background. Because graph does not redraw the part of the screen behind the symbol to mask the previous symbol, the symbol must have its own background to mask the previous symbol.
Therefore, as the new symbol is drawn on the screen, its background object masks the previously displayed symbol.
Do not enter the -p argument in the System Configuration Information panel to use Method 2.
14
FactoryLink 6.6.0 / Application Editor Guide / 189
•
•
•
•
ANIMATING AN OBJECT AS A SYMBOL
Animating Symbol Object to Represent a Value
A NIMATING S YMBOL O BJECT TO R EPRESENT A V ALUE
Perform the following steps to animate an object to represent the value of an element:
1 Select the object you want to animate.
2 Choose Animation>Symbol to display the Symbol Animation dialog.
3 Specify the following information:
Tag Enter a name to reference the element controlling the symbol for this object. The tag specified must be one of the following types: digital, analog, longana, float, or message.
Shape Changes The fields in this area define the changes for this object when limits are met. Define these for each limit you want to set. You can specify up to 8 limits.
Blink Specify the blink animation used when the limit is met. This field toggles through none (no blink), slow (slow blink), or fast (fast blink). Fast blink is the default.
Name Name of symbol to display when limit is met. This name must match the name of an object in the
SYMBOLS.G
file for this application.
190 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING AN OBJECT AS A SYMBOL
Animating Symbol Object to Represent a Value
Limit Enter the limit where the change occurs. This can either be a positive or negative numeric value or the name of a tag whose value defines the limit.
The tag specified must be one of the following types: analog, longana, or float.
X Enter the name of an analog tag that controls the horizontal location of the object in the drawing. The value of the left side of the drawing is 0 and the value of the right side of the drawing is
32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to it, the value defaults to the default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves horizontally within the display.
Y Enter the name of an analog tag that controls the vertical location of the object in the drawing. The value of the bottom of the drawing is 0 and value of the top of the drawing is 32000.
If you leave the field blank, the text is displayed where you drew it.
If you specify a tag without writing a value to it, the value defaults to default value of the tag you entered.
To write a numerical value to this element, configure a function key, the Math & Logic task, or another real-time input so the object moves vertically within the display.
Width Name of analog tag that contains a value that controls the width of the symbol. The maximum width value is 32000, which makes the symbol as wide as the display.
To configure a task to write a numerical value to this element, configure a function key, Math & Logic, or other real-time input so the width of the symbol changes.
If no task writes a value to this element, the symbol is displayed in its drawn width.
14
FactoryLink 6.6.0 / Application Editor Guide / 191
•
•
•
•
ANIMATING AN OBJECT AS A SYMBOL
Animating Symbol Object to Represent a Value
Height Name of analog tag that contains a value that controls the height of the symbol. The maximum height value is 32,000, which makes the symbol as tall as the display.
To configure a task to write a numerical value to this element, configure a function key, Math & Logic, or other real-time input so the height of the symbol changes.
If no task writes a value to this element, the symbol is displayed in its drawn width.
4 Click on OK to save the information after you complete the Symbol Animation dialog.
192 / FactoryLink 6.6.0 / Application Editor Guide
ANIMATING AN OBJECT AS A SYMBOL
Simulate Object Rotation
S IMULATE O BJECT R OTATION
Because symbols represent the value of an element, you can use them to simulate object rotation at run time.
You can use PowerVB to rotate an object during run time. Refer to Part IV,
“PowerVB Animation” for more information.
Perform the following steps to simulate object rotation:
1 Draw one symbol for each incremental position of the object rotation in the file
SYMBOLS.G
. These symbols represent the object at run time. You can draw up to eight symbols to represent a single object.
The following example of the SYMBOLS.G
file shows a propeller drawn in four positions so it appears to rotate in 45 degree increments.
Each of these four symbols represent the propeller object.
2 Draw a bounding box to locate the object on the drawing. The object in the
SYMBOLS.G
file is sized to this object.
3 Configure an area on an Application Editor screen the object rotates in.
FactoryLink 6.6.0 / Application Editor Guide / 193
14
•
•
•
•
ANIMATING AN OBJECT AS A SYMBOL
Simulate Object Rotation
4 Animate this area as a Symbol, linking the symbols drawn in the SYMBOLS file to
this area using the procedure provided in the “Animating Symbol Object to
Represent a Value” on page 190.
5 Configure a task so the element is set to the next consecutive number based on another element, such as a timer.
As each incremental position of the propeller is displayed, the propeller appears to rotate.
194 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 15
Working With Power
Packs
Template animation allows you to animate an object with variables. When you duplicate an object in normal graphics drawing, you must edit the animation for the new object after it is duplicated. With template animation, you define which animation features are constant or variable for each duplicated object. When the object is duplicated, you are prompted to provide definitions for variable animation features.
Objects defined using variables are template objects, or Power DragOns, and the variables defined in the object are template variables. Any object, whether simple or composite, becomes a template object when you define one or more template variables. They are used to perform graphical, logical, process, and communication operations and incorporate all the information necessary to display and control automation equipment. They define I/O communication, scaling, alarming, logging, and security as well as define the graphical rendering of the device.
You enter a template variable in any field of an Animation dialog that accepts text input. You cannot enter template variables in fields where you choose information, such as radio buttons, check boxes, list boxes, and palettes.
You place Power DragOns in a library of drawings collectively known as Power
Packs. Power Pack files work just like any drawing file, except that when you open a Power Pack file, the Application Editor is automatically in the copy/paste mode. When you select an object from a Power Pack drawing, the Application
Editor immediately copies it into the buffer so it can be pasted into an open drawing file. All Power Pack files have a .gp
extension.
Power Packs are designed to be sized to any display and provide a clear resolution at edit and runtime. The architecture of Power Packs provide for easy expansion and enhancement.
Power DragOns fall into two general categories:
• Those that produce no tags. Many Power DragOns implement animation by using PowerVB to directly set window, drawing, and graphic object properties, or there may be no pre-designed animation associated with the Power DragOn.
• Those that create or reference tags. Power DragONs can create and reference scalar or structured tags. If the prompt reads Tag Name, the Power DragOn can
15
FactoryLink 6.6.0 / Application Editor Guide / 195
•
•
•
•
WORKING WITH POWER PACKS create a scalar tag, reference an existing scalar tag or reference any member of an existing structured tag. If the prompt reads Process tag name, it can only create or reference a structured tag.
You can customize Power DragOns easily using the Application Editor drawing and animation.
If customizing is only desired on a single use of the Power DragOn, you should modify the pasted Power DragOn in the drawing.
If you will be using the customized Power DragOn multiple times, either customize the original in the Power Pack or make a copy in the Power Pack and customize it.
196 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
Guidelines for Using Template Variables
G UIDELINES FOR U SING T EMPLATE V ARIABLES
This section lists the guidelines to use when defining template variables.
• The format for a template variable is a character string enclosed in braces { }. A template variable name has the same syntax as an element name.
• You can specify multiple template variables within a field.
For example,
{assy_line}{mach_no}
• You cannot nest template variables; that is, enclose a template variable within another template variable. For example, the following entry is not a valid use of a template variable.
{tnum{valvnum}}
• You can specify multiple template variables within an object animation configuration. For example, you can specify both the Minimum and Maximum fields as template variables.
• You can use the same template variable in more than one field in an object animation. For example, in the Bar Animation dialog, you can use the same template variable for the Minimum field and the first Limit field, because the initial value of the bar and its first limit are equal.
• You can use the same template variable in more than one object within a composite object. For example, given a composite object that contains a bar object and an output-text object, you can specify both objects to have the same template variable in the Tag field of their Animation dialog. The text field displays the value associated with the variable numerically, and the bar displays the same value graphically.
• You can use template animation with object-level animation options, but not with drawing-level animation.
15
FactoryLink 6.6.0 / Application Editor Guide / 197
•
•
•
•
WORKING WITH POWER PACKS
Creating a Template Object
C REATING A T EMPLATE O BJECT
Perform the following procedure to animate an object as a template:
1 Select the object you want animate.
2 Choose Animation > Object Level Animation you wish to animate.
Do not choose any Drawing Level Animation types (Print Screen, Beep , or Function Key) because template animation does not apply to these animation types.
3 Animate the object as required, but enter template variables in the fields where you want values to be different for each instance of the object. Refer to the appropriate section in this manual for details on each animation type.
You must enclose template variables in braces { } and use the same syntax as an element name. Variable names can be from 1 to 30 characters long counting the braces, which count as two characters.
4 Click on OK . The Define Template Variable dialog displays.
5 The name of the variable you are defining displays in the Variable field.
6 Specify the following information:
Prompt String Message to display to prompt for this variable definition when this template object is duplicated. This can be a 1 to 64 character alphanumeric string.
The name of the template variable is used as the prompt string if you leave this field blank.
7 Click on OK . The Tag Definition dialog displays if you entered a template variable in a field that expects a tag name.
198 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
Creating a Template Object
8 If you want to define this field now, enter data for any tags that display. Specify the following for each tag:
• Domain
• Element type
• Dimension (if an element array)
• Default value
• Description
Click on Cancel if you want to define these fields when you paste the object.
FactoryLink 6.6.0 / Application Editor Guide / 199
15
•
•
•
•
WORKING WITH POWER PACKS
Using a Template Object
U SING A T EMPLATE O BJECT
Perform the following steps to duplicate a template object:
1 Select the template object.
2 Choose Edit>Copy to copy the object into the buffer.
3 Choose Edit>Paste.
Place the cursor where the object is to be pasted and press the mouse button. The Template dialog displays.
4 Specify the following information:
Name Lists the prompt strings you entered for the template variables.
Value Values substituted for template variables for this object. Enter a value for each prompt string.
The number of characters in the value depends on the number of characters in the static portion (characters other than the template variable) of the variable name because the maximum number of characters in an element name is 32. For example, if the variable name is tank{tnum}level, the static portion of the variable name is tanklevel . Because there are 9 characters in tanklevel , the maximum number of characters that can be substituted for tnum is 23.
[32 (maximum characters in an element name) - 9 (number of characters in tanklevel ) = 23]
200 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
Using a Template Object
Class: Type of template object used to create this new object. Use this field to establish classes for your template objects, associating each object with its source template. The system does not use this information; it is for your reference.
You can enter an alphanumeric string from 1 to 16 characters.
Description: Description of the template object. This is for your reference only.
You can enter an alphanumeric string from 1 to 64 characters.
5 Click on OK to save the information. If you created a template variable requiring element definition information but did not enter it, the Tag Definition dialog displays now, prompting you for that information.
If the Tag Definition dialog does not display, the system pastes the new object and substitutes the values you entered for each prompt string into their associated template variables.
If FactoryLink generates a new element after you click on OK , it uses the element definition information supplied with the template variable for the new element without prompting you.
6 Specify the domain, element type, dimension (if an element array), default value, and description of the element, and click on OK . The Tag Definition dialog closes and the system pastes the new object, substituting the values you entered for each prompt string into their associated template variables.
15
FactoryLink 6.6.0 / Application Editor Guide / 201
•
•
•
•
WORKING WITH POWER PACKS
Displaying the Template Configuration
D ISPLAYING THE T EMPLATE C ONFIGURATION
You can display the template configuration for objects you created from template objects on the Animation dialog in one of two ways:
• As template variables from the source template object
• As element names/values resulting from template variable substitutions
Choose Template Variables from the View menu do display the template configuration as template variables. Deselect Template Variables to display the template configuration as element names/values. Each time the Application
Editor starts, it defaults to displaying the element names/values in the animation dialog.
If you choose to display the template configuration as element names/values, the
Application Editor allows you to distinguish which element names/values on the
Animation dialog result from template variable substitutions and which do not.
Element names/values that result from template variable substitutions display in a different text/background color combination than the other fields on the dialog.
The Template Variables option applies globally to all drawings; therefore, you do not need to open a drawing to set this option.
C OMBINING T EMPLATE O BJECTS
When combining template objects that use the same variables, the Application
Editor checks for conflicts in the prompts for those variables. The Application
Editor completes the Combine operation if the prompts for the variables are the same in each object that is to be combined.
The Application Editor displays an error in the Variable Conflict dialog if the prompts differ (you entered different prompts for the same variable in different objects).
The Application Editor displays the first prompt you entered for the displayed variable. If you click on OK, the Application Editor resolves the prompt conflict by assigning this prompt to the variable wherever the variable is used in the composite; however, you can change the prompt for this variable. After you click on OK , the Application Editor displays the next variable that has a prompt conflict, if one exists. When you have resolved all prompt conflicts, the Application
Editor completes the Combine operation.
Click Abort to cancel the Combine operation.
202 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
Unresolved Template Variables
U NRESOLVED T EMPLATE V ARIABLES
Whenever you save a drawing or perform an animation test on a drawing, the
Application Editor checks it for variables that do not have a value entered in the
Template dialog. When a variable does not have a value, it is called unresolved.
Perform the following steps to resolve unresolved template variables:
1 Use Edit > Find to locate the object in the drawing. Enter the object name given in the Animation Error dialog.
2 Choose Animation>Template.
3 Enter the missing value for the variable prompt string.
The Application Editor completes the save whether or not you resolve the variables.
If you do not enter values for all of the template variables in the drawing, at run time, the system will not load the drawing containing the unresolved variables.
Instead, the system displays the following message:
Unable to load (drawing name) because of Unresolved
Template Variables.
Open the drawing in the Application Editor and perform an animation test to resolve the variables. The Application Editor displays an error message indicating the object name with the unresolved variable. Follow the steps above for resolving variables.
A TTACHING P OWER D RAG O NS TO I/O D EVICES
The Power DragOns supplied with FactoryLink do not request information about
I/O devices. You can add prompts that complete the device interface tables. If customizing is only desired on a single use of the Power DragOn, you should fill out the specific I/O address information in the pasted Power DragOn in the drawing. If you will be using the customized power DragOn multiple times, either customize it or enter a template variable like {IO} instead of a specific I/O address.
There are a number of restrictions associated with using I/O device template variables. Template tag definitions are not shared between fields within a single animation, different animation types on a single object, or animations on different subobjects within an animation. Even though the string representing the
15
FactoryLink 6.6.0 / Application Editor Guide / 203
•
•
•
•
WORKING WITH POWER PACKS
Adding Security to Power DragOns template tag definition may be the same, the associated single point configuration is unique for every instance of that template tag definition.
For cases where a template tag string is defined in two places, the pasting operation causes Application Editor to work on both references separately. So after Application Editor creates the records for the first template reference, it detects this configuration when processing the second template reference and issues an overwriting warning. You are, in effect applying the second definition over the first.
The best approach to this situation is to attach the I/O device single point information to only one of the template tag references. The second reference to the template can define the base attributes of the tag (e.g. SHARED, DIGITAL) but not include the single point information. When the paste occurs the I/O device information comes from only one of the references, not both, eliminating the overwrite.
Template references within PowerVB scripts cannot define tags, so they have no
I/O information attached to cause an overwrite. Template references for tag event triggers do define tags, so they can have single point template definitions associated.
A DDING S ECURITY TO P OWER D RAG O NS
Configure Security by applying the desired security class to the button animation of the Power DragOn.
204 / FactoryLink 6.6.0 / Application Editor Guide
F ACTORY L INK S UPPLIED P OWER P ACKS
Bars
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Run-time Features
The Bars Power Pack includes both horizontal and vertical bars with and without legends and with and without numeric displays. Each renders a value as a solid bar graph. The height or width of the bar is determined by the value of the tag.
The minimum and maximum values displayed in the legend are attached to the process tag tag.eumin
and tag.eumax values. The range of the bar graph can be modified at run time by changing the values of these tags.
Template Prompts
Process tag name
Sizing and Rotating
Bar graphs can be sized but not rotated. The legend may have to be resized to match the new bar height for bars that contain legend animation objects.
15
FactoryLink 6.6.0 / Application Editor Guide / 205
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Real-time database elements
Bar graphs create or reference an analog or floating-point process tag. When the
Power DragOn object is pasted on a screen, the system creates the following tags when a new tag name is entered in the template dialog.
{tag} {tag}.eumax {tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
BORDERS
Customizing
The bar graphs are composed of three animated components: a bar, a legend, and a text output.Click on the checked animation tool to display the correct animation dialog and modify the animation properties as desired.
Run-time Features
You can use borders to provide a simulated 3D panel for your drawings.
After you have pasted one of the transparent borders into a drawing, run-time performance is improved by selecting the item and choosing Edit>Separate to separate the object into its component parts.
206 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
BUTTONS
Template Prompts
None
Real-time database elements
None
Sizing and Rotating
You can size and rotate borders. Rotating an inset border 180 degrees changes it to a raised border.
Run-time Features
Buttons will:
• appear to be depressed when the button is clicked.
• change background color when button is pointed at.
• change the color of text when button is pointed at.
• display tooltip help when the button is pointed at.
FactoryLink 6.6.0 / Application Editor Guide / 207
15
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
See the Style1 section for more information about enabling or disabling these features.
The following buttons comprise the Buttons Power Pack:
System: Displays the Run-Time Manager drawing.
Change Drawing: Enables you to add buttons to displays that allow the operator to choose a different drawing at run time. If desired, you can change the caption text to the name of the actual drawing.
Push Button: Does not perform any actions. Use this button as a starting point to create a custom button.
Momentary: Sets a digital tag to 1 while the mouse button is depressed and returns the value to 0 when the mouse button is released.
Toggle: Toggles the state of a digital tag between 0 and 1 each time the button is clicked. The button appears depressed when the tag value is 1 and raised when its value is 0.
Shutdown: Sets the necessary tags to cause both the USER and SHARED domains of the FactoryLink programs to exit or stop running.
Arrows: Increment or decrement a process tag. The single arrow buttons change the tags value by one, the double arrows by the specified amount. The begin and end arrows set the process tag to its engineering units minimum or maximum value.
Template Prompts
Vary
Real-time database elements
The System, Change Drawing, Push Button, Shutdown, Help, and Alarm buttons do not produce tags. The Momentary and Toggle buttons create or reference an existing digital tag. The Arrow buttons create or reference an existing process tag.
Sizing and Rotating
You can size buttons but not rotate them. When you stretch a button horizontally, the text remains the same size and centered. When you stretch a button vertically, the text size increases proportionally with its height. You change the text size by selecting the text and setting its attributes.
208 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
CHECKS
Run-time Features
You view and set the state of digital tags using Check Box Group. The tag value is
1 when the box is filled and 0 when it is empty. You toggle the state by clicking the box or its descriptive text on the right.
Template Prompts
Tag name
Real-time database elements
The single check box creates or references a single digital tag. A check box group creates or references an existing digital array tag.
Sizing and Rotating
You can size check boxes but not rotate them.
Customizing
You change the text associated with a selection by selecting the text and, when the text cursor is shown, enter the new text.
15
FactoryLink 6.6.0 / Application Editor Guide / 209
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Frames1, Frames2
GAUGES
The Power DragOns in the Frame Power Pack enable you to add additional frames to the FLNEW application. Choose File>Open , then enter a new name to add a new drawing. A blank screen is displayed. Paste a Frame Power DragOn into the new drawing, then choose Edit>Separate to separate the objects. This significantly improves run-time performance.
Run-time Features
The Gauges Power Pack includes dials, LEDs, and text fields. The needle position on the dials indicates the value of the tag. The minimum and maximum values displayed are attached to the process tag’s tag.eumin
and tag.eumax values. The range of the dial scale can be modified at run time by changing the values of these tags.
210 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Template Prompts
Process tag name
Real-time database elements
Dials create or reference an analog or floating-point process tag. When the Power
DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}.eumax {tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
KEYPADS
Sizing and Rotating
Dials can be sized but not rotated. After sizing the dial, you may need to change the font size of the text.
Customizing
Dials are composed of two animated components: a needle and output text. At run time, the needle is rotated around the center of the faceplate object. If desired, the text output is deleted without affecting the needle’s operation. Colors can be changed by selecting a component and changing its color.
15
FactoryLink 6.6.0 / Application Editor Guide / 211
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Misc
Motors1, Motors2, Motors3
The Motors Power Packs include motor Power DragOns that allow you to view and control a motor’s state.
212 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Run-time Features
Digital status motors indicate whether the motor is running or stopped and control actions to start or stop the motor.
Speed status motors provide information about the motor speed and control actions to start or stop the motor and set its speed.
The minimum and maximum speeds are defined by the process tag tag.eumin
and tag.eumax values. The range of the motor speed is modified at run time by changing the values of these tags.
Template Prompts
Process tag name
Real-time database elements
Digital status motors create or reference a digital process tag. When the Power
DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}_command
Speed status motors create or reference two analog or floating-point process tags and a digital command tag. When the Power DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}.eumax
{tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
{tag}_sp {tag}_sp.eumax
{tag}_sp.eumin
{tag}_sp.raw
{tag}_sp.rawmax
{tag}_sp.rawmin
{tag}_sp.lock
{tag}_command
{tag} is the actual motor speed, {tag}_sp is the speed control and {tag}_command is the motor start/stop control tag.
Sizing and Rotating
Motors can be both sized and rotated.
15
FactoryLink 6.6.0 / Application Editor Guide / 213
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
PIPES
Power SPC
214 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Pumps1, Pumps2
The Pumps Power Packs include pump Power DragOns that allow you to view and control a pump’s state.
Run-time Features
Digital status pumps provide status indicating whether the pump is running or stopped and control actions to start or stop the pump.
Speed status pumps provide status indicating the pump's speed and control actions to start or stop the pump and set its speed.
The minimum and maximum speeds are defined by the process tag’s tag.eumin
and tag.eumax values. The range of the pump speed can be modified at run time by changing the values of these tags.
Template Prompts
Process tag name
15
FactoryLink 6.6.0 / Application Editor Guide / 215
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Real-time database elements
Digital status pumps create or reference a digital process tag. When the Power
DragOn object is pasted on a screen, the system creates the following tags when a new tag name is entered in the template dialog.
{tag} {tag}_command
Real-time database elements
Speed status pumps create or reference two analog or floating-point process tags and a digital command tag. When the Power DragOn object is pasted on a screen, the system creates the following tags when a new tag name is entered in the template dialog:
{tag} {tag}.eumax
{tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
{tag}_sp {tag}_sp.eumax
{tag}_sp.eumin
{tag}_sp.raw
{tag}_sp.rawmax
{tag}_sp.rawmin
{tag}_sp.lock
{tag}_command
{tag} is the actual pump speed, {tag}_sp is the speed control and {tag}_command is the pump start/stop control tag.
Sizing and Rotating
Pumps can be both sized and rotated.
216 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
RADIOS
Run-time Features
Radio buttons provide a way at run-time to set the value of an analog tag according to a selection list. Clicking the radio button or the text to its right sets the analog tag value to the selection value.
Template Prompts
Tag name
Real-time database elements
Radio button groups create or reference a single analog tag.
Sizing and Rotating
Radio buttons can be sized but not rotated.
Customizing
You change the text associated with a selection by selecting it and entering the new text.
You can change the value set by a radio button selection. Choose the radio button and change the button animation to set the desired value. You must also choose the radio button and change the value associated with its paint animation.
15
FactoryLink 6.6.0 / Application Editor Guide / 217
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
S1TREND
Template Prompts
Tag name
Real-time database elements
Trend charts create or reference one analog or floating-point process tag for the pen value and create several digital and analog tags for chart control. When the
Power DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}.eumax {tag}.eumin
{tag}.raw
{tag}.rawmax {tag}.rawmin
{tag}.lock
trendchart{chart}Cursor trendchart{chart}End trendchart{chart}Grid trendchart{chart}Mode trendchart{chart}ModeDisplay trendchart{chart}Pan trendchart{chart}Pen1 trendchart{chart}Start trendchart{chart}Zoom
218 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
SLIDERS
Sizing and Rotating
Trend charts can be sized but not rotated.
Customizing
You can add additional pens to the chart. Choose chart animation, then choose the
Pens button. Follow the standard procedure for adding pens to a chart.
Run-time Features
The Sliders Power Pack includes different types of sliding control buttons.
Changing the value of the tag moves the position of slider button and moving the position of the slider button sets the value of the tag. The minimum and maximum values for the slider are attached to the process tag’s tag.eumin
and tag.eumax values. The range of the slider can be modified at run time by changing the values of these tags.
Template Prompts
Process tag name
15
FactoryLink 6.6.0 / Application Editor Guide / 219
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Real-time database elements
Sliders create or reference an analog or floating-point process tag. When the
Power DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}.eumax {tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
Sizing and Rotating
Sliders can be sized and rotated. After re-sizing the slider, you may need to resize the background and button.
Customizing
The Slider is composed of one animated object, the button. If desired, all other components can be deleted without affecting the slider operation. Colors can be changed by selecting a component and changing its color.
Style1
The Style1 Power Pack includes Power DragOns that do not show at run time but affect the way other Power DragOns in the Power Packs operate. Place any Style1
Power Pack items to be used on the Splash screen since they only need to execute once. These Power DragOns execute methods in the Style1 PowerVB library
(style1.pls) .The Style1 Power Pack items include tooltips and outlines for buttons, buttons displayed behind process Power DragOns, and pop-up command panels.
Others cause buttons to change their background color or appearance when they are pointed at or change the color of their text.
220 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Style1 Initialize
The Style1 Initialize Power DragOn sets the defaults for all Power DragOns that use the style1 methods. The following defaults are set:
• Style1 Button1 depress = Enabled
• Style1 Button1 Highlight Background = Disabled
• Style1 Button1 Highlight Text = Disabled
• Style1 Process On color = Red
• Style1 Process Off color = Green
• Style1 Process Transition color = Green
• Style1 Button1 ToolTip = Disabled
• Style1 Button1 Outline = Disabled
• Style1 Process Outline = Disabled
• Style1 Process Object Selected = Toggle state of selected Power DragOn
Style1Button1 Highlight Background
Add this Power DragOn to the Splash display to cause all Style1 buttons to change their background color when selected. To change the highlight color of all buttons, change the Fill Color of this Power DragOn in the Splash display.
Style1 Button1 Highlight Text
Add this Power DragOn to the Splash display to cause all Style1 buttons to change their text color when selected. To change the highlight color of all buttons, change the Text Color of this Power DragOn in the Splash display.
Style1 Button1 Disable Key Press
Add this Power DragOn to the Splash display to disable the appearance of all
Style1 buttons being depressed with a mouse down action.
Style1 Process Colors
Add this Power DragOn to the Splash display to change the status color of all
Style1 process Power DragOns. To choose different status colors, simply select the text of this Power DragOn in the Splash display and change the Fill Color.
15
FactoryLink 6.6.0 / Application Editor Guide / 221
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Style1 Button1 ToolTip
Add a Style1 Button1 ToolTip Power DragOn to each display where you want to have tooltip text displayed near all Style1 buttons and process Power DragOns when they are chosen. Each time you add additional Power DragOns to a display with this feature, you must move this Power DragOn to front. To change the tooltip color, font, or text size, change the attributes of the Power DragOn in the each display.
Style1 Button1 Outline
Add a Style1 Button1 Outline Power DragOn to each display where you want an outline to be displayed around all Style1 button Power DragOns when they are chosen. Each time you add additional Power DragOns to a display with this feature, you must move this Power DragOn to front. To change the highlight outline’s line style or color, change the attributes of this Power DragOn in each display.
Style1 Process Outline
Add a Style1 Process Outline Power DragOn to each display where you want to have a 3D button displayed around all Style1 process Power DragOns when they are chosen. Each time you add additional Power DragOns to a display with this feature, you must move this Power DragOn to the front. At run time this button will depress with mouse down actions like other Style1 buttons.
Style1 Process Command
Add a Style1 Process Command Power DragOn to each display where you want to have a control panel displayed near all Style1 process Power DragOns when they are chosen. Each time you add additional Power DragOns to a display with this feature, you must move this Power DragOn to front. At run time the two buttons of this Power DragOn allow you to proceed with the commanded operation or cancel it.
222 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Tutorial
The Tutorial Power Pack contains a collection of Power DragOns copied from the other Power Packs. When these template items are pasted onto a screen, default values are provided in the template dialogs. The only Power DragOn not copied from another Power Pack is the Simulator.
15
FactoryLink 6.6.0 / Application Editor Guide / 223
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
VALVES
Run-time Features
The Valves Power Pack includes valve Power DragOns that allow you to view and control a valve state. Each renders the valve state using the colors set by the
Style1 Process Colors Power DragOn.
Template Prompts
Process tag name
Real-time database elements
Valves create or reference a digital process tag. When the Power DragOn object is pasted on a screen, the system creates the following tags a new tag name is entered in the template dialog.
{tag} {tag}_command
Sizing and Rotating
Valves can be both sized and rotated.
224 / FactoryLink 6.6.0 / Application Editor Guide
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
VESSELS
Run-time Features
Each vessel renders a single value as a solid blue vertical bar graph. The height of the bar is determined by the value of the tag. The minimum and maximum values for the vessel are attached to the process tag’s tag.eumin
and tag.eumax values. The scale of the vessel can be modified at run time by changing the values of these tags.
Template Prompts
1 Process tag name
2 Default maximum level
Real-time database elements
Vessels create or reference an analog or floating-point process tag. When the
Power DragOn object is pasted on a screen, the system creates the following tags after a new tag name is entered in the template dialog.
{tag} {tag}.eumax {tag}.eumin
{tag}.raw
{tag}.rawmax
{tag}.rawmin
{tag}.lock
15
FactoryLink 6.6.0 / Application Editor Guide / 225
•
•
•
•
WORKING WITH POWER PACKS
FactoryLink Supplied PowerPacks
Sizing and Rotating
Vessels can be sized but not rotated.
Customizing
Vessels contain one animated component, a bar graph. You modify this by sub-selecting the animated component. When selected, a green check is displayed in the bar graph animation in the toolbox. Choose the checked animation tool to display or modify the animation properties.
226 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 16
Drawing-Level
Animation
Drawing-level animations are not linked to an object in the drawing. Instead, they are linked to a real-time element that executes the action when changed. You can configure drawing-level animation to perform the following actions:
• Print the screen
• Beep when a condition occurs
• Respond to a key press
This chapter describes how to configure these actions.
To activate these options, you must first open a drawing. Drawing-level animations do not use an object but rather define an element so when the element value is 1 (ON), it causes the animation to occur. Although you define this element for the drawing, you can associate it with an animated object. For example, you can animate a button object using the same element defined for the Print Screen option, so when the operator selects the button object at run time, it prints the screen.
The Function Key command on the Animation menu allows you to tie real-time elements to keyboard function keys. Then, at run-time, the operator can press the associated function key to perform the action. FactoryLink performs the specified operation, such as changing the active drawing in a window or shutting down a task.
16
FactoryLink 6.6.0 / Application Editor / 227
•
•
•
•
DRAWING-LEVEL ANIMATION
Print Screen Animation
P RINT S CREEN A NIMATION
Perform the following steps to animate an object to print the contents of a screen after selecting an object.
1 Select the object you want to animate.
2 Choose Animation>Print Screen to display the Print Screen Animation dialog.
3 Specify the following information:
Enable Tag Enter the name of the digital tag that controls screen printing.
The screen is printed when the tag value changes to 1.
4 Choose one of the following:
OK Saves the information
Cancel Discards the information
Delete Deletes the tag definition
228 / FactoryLink 6.6.0 / Application Editor
DRAWING-LEVEL ANIMATION
Beep Animation
B EEP A NIMATION
Beep animation allows you to configure the computer to beep on conditions at run time. This is useful for alerting the operator of a change in conditions requiring immediate attention.
For example, you can use the name of the element specified in a Math & Logic procedure that sets the element value to 1 when a particular process value is reached, thereby causing the computer to beep.
Perform the following steps to configure a tag to beep:
1 Select the object you want to animate.
2 Choose Animation>Beep to display the Beep Animation dialog.
3 Provide the following information:
Enable Tag Enter the name of the digital tag that causes the computer to beep. When the tag value is 1, the computer beeps.
4 Choose one of the following:
OK Saves the information
Cancel Discards the information
Delete Deletes the tag definition
16
FactoryLink 6.6.0 / Application Editor / 229
•
•
•
•
DRAWING-LEVEL ANIMATION
Function Key Animation
F UNCTION K EY A NIMATION
Function Key animation animates a key on the keyboard or a button on the pointing device to execute an action when it is pressed. Function Key animation is like Button animation except Function Key animation is used to animate actual buttons (keyboard keys or pointing device buttons) while button animation is used to animate button objects on the display.
Note: The Alt-F6 key is generally trapped by Microsoft Windows and changes window focus from the current top window to the next window in the order. Use of the Alt-F6 key should be avoided on any application which may need to run under
Windows 95 or Windows NT.
Perform the following steps to animate a function key:
1 Select the object you want to animate.
2 Choose Animation>Function Key to display the Select Function Key dialog listing all defined function keys. The box is blank if none are defined.
230 / FactoryLink 6.6.0 / Application Editor
DRAWING-LEVEL ANIMATION
Function Key Animation
3 Provide the following information:
Function Key Abbreviation of the function key you want to perform the action.
This can be one of the following:
Table 16-0 Function Key Abbreviations
Description
No key
Reserved
Reserved
Reserved
Break
Backspace
Shift + Tab (back tab)
Enter
Alt graph
Pause
Caps Lock
Escape
Insert
Keystroke options
NUL
BT1
BT2
BT3
BRK
BSP
BTB
NL
ALG
PSE
CLK
ESC
INS
Description
Page Up
Page Down
End
Home
Left arrow
Up arrow
Right arrow
Down arrow
Tab
Enter
SysRq
Delete
Function keys F1 - F24
Keystroke options
PUP
PDN
END
HME
LFT
UP
RGT
DWN
TAB
ENT
SYS
DEL
F1 to F24
16
FactoryLink 6.6.0 / Application Editor / 231
•
•
•
•
DRAWING-LEVEL ANIMATION
Function Key Animation
4 Click on OK.
The Button Animation dialog displays.
5
Complete the dialog. Refer to Chapter 12, “Animating an Object as a Button”, for
detailed instructions.
6 Click on OK to save the animation information.
232 / FactoryLink 6.6.0 / Application Editor
Manual Name Variable Applied Here
Part IV
PowerVB Animation
FactoryLink 6.6.0 / September 1988 / 000A*DOC-PVB*000*660 233
Chapter 17
PowerVB Overview
PowerVB is an animation tool based on Microsoft Visual Basic
®
. It allows Visual
Basic compatible scripts to be attached to FactoryLink graphic objects. These scripts may manipulate graphic objects in many ways at run time, including making the object rotate, move, or change color. Scripts can be attached to a single graphic object, a composite graphic object, or a piece of a composite object.
At run time, scripts are triggered by events. In FactoryLink, changes in tags can trigger many events such as:
• PLC Communications
• File Operations
• Recipe Operations
PowerVB supports these FactoryLink events as well as other built-in graphical events, which will be discussed thoroughly in the next chapter.
PowerVB is an interpreted language.The code runs under the graphic task and is multi threaded.This means the code for different objects and/or different drawings runs at the same time if the drawings are both loaded into enabled windows at the same time. Performance varies based on the amount of code being executed.
Be familiar with programming in BASIC or Visual Basic
®
before using PowerVB.
Refer to the PowerVB Language Reference Guide for specific syntax information.
It is generally good practice to limit PowerVB scripts to those controlling graphical manipulation. PowerVB is not recommended for use in some cases.
These include:
• If the script is lengthy enough to require significant debugging.
• For computation-complex executions because PowerVB is slower than
IML/CML.
• If only tags are manipulated and only tag events are used (IML).
17
FactoryLink 6.6.0 / Application Editor Guide / 235
•
•
•
•
POWERVB OVERVIEW
Differences Between PowerVB and Microsoft Visual Basic
When to Use PowerVB vs.IML and CML
Use the following list to help determine whether to use PowerVB, IML, or CML.
For more information about IML, refer to Chapter 12, “Math & Logic Task
Definition” in Core Tasks in the FactoryLink Configuration Guide. For more information about CML, refer to Chapter 9, “Compiled Math & Logic” in Core
Tasks in the FactoryLink Configuration Guide.
Use IML/CML:
• When speed is a factor.
• When a needs to be triggered at a continuous interval, for example to average 2 points so the result can be logged. In addition to being slower, the PowerVB will not run if the drawing it resides on is not loaded.
Use PowerVB:
• When the application needs to react to certain types of events, like mouse movements.
• When certain properties, such as font type and color, need to be changed.
• To control the execution and behavior, such as maximizing and minimizing, of non-FactoryLink programs. PowerVB provides standard routines which can be called from any PowerVB script. All called PowerVB routines must be declared before being referenced in a PowerVB script.
• To control graphics effects.
D IFFERENCES B ETWEEN P OWER VB AND M ICROSOFT V ISUAL B ASIC
The following lists differences between PowerVB and Microsoft Visual Basic.
• Microsoft Visual Basic is forms based, PowerVB uses drawings.
• Microsoft Visual Basic features drag and drop controls onto forms, PowerVB requires code to be entered into an object using an editor.
• Microsoft Visual Basic objects are windows objects like buttons and list boxes.
PowerVB objects are graphics objects like lines, boxes, and circles.
• Microsoft Visual Basic can not rotate objects at run time.
• Microsoft Visual Basic does not supports templates for code / object portability,
PowerVB does.
• Microsoft Visual Basic external functions and sub procedures can be declared at the form level, PowerVB requires these to be declared at the object level.
• Microsoft Visual Basic forms can have event procedures, PowerVB can only have object events.
236 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB OVERVIEW
Opening PowerVB from the Application Editor
• Microsoft Visual Basic requires DLLs to run (VBRUN300.DLL), PowerVB includes all necessary files.
• Microsoft Visual Basic can use third party extensions such as VBX and OCX controls, PowerVB can not.
• Microsoft Visual Basic only runs on Windows operating systems, PowerVB is multi-platform, although there are commands and function which are platform specific.
• Microsoft Visual Basic is single threaded, whereas PowerVB is multi threaded.
• Microsoft Visual Basic can run code from the editor, PowerVB requires
FactoryLink to be running.
• Microsoft Visual Basic objects are all located at the form level. They can be grouped, but this does not change their object reference. PowerVB objects form an object hierarchy,
O PENING P OWER VB FROM THE A PPLICATION E DITOR
Select a graphic object; then open the PowerVB animation editor by choosing
Animation > PowerVB or by clicking the PowerVB icon on the Application Editor
Toolbar.
Choose File > Open PowerVB Lib to open a PowerVB library.
P OWER VB S YMBOL N AME MEMORY L IMITATION
There is a 64K byte limitation to the memory available for public symbol names for all the graphics loaded during runtime. Examples of public symbols are:
• Public variables
• Dim variables declared outside subroutines
• Tagnames
• Tagname members
A “create script error” message will be generated when the limit has been exceeded, and the graphics task will shut down. The solutions are:
• Limit the number of scripts
• Move non-graphic manipulation code to IML/CML
• Shorten public, global, and external variable names
• Limit use of public, global, and external variables
• Use local RTDBObjects instead of tagnames to read and write values
17
FactoryLink 6.6.0 / Application Editor Guide / 237
•
•
•
•
POWERVB OVERVIEW
For More Information
For example: dim x as RTDBObject set x = RTDBObjectValue (tagname) this.text = x value
Note that most tagnames members can only be accessed via local RTDBObject variables such as x. type, x. raw, x. max, x. min, etc.
F OR M ORE I NFORMATION
This guide is intended to provide you with basic understanding of how to create
PowerVB scripts. See the PowerVB Language Reference Guide for a reference to each function available in PowerVB.
238 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 18
PowerVB Editor
This chapter explains the various menu options available in the PowerVB animation editor. Because PowerVB has no configuration panels, PowerVB animation is set up by entering code in the editor window.
18
FactoryLink 6.6.0 / Application Editor Guide / 239
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
P OWER VB A NIMATION E DITOR
File Menu
Use the File menu for the following reasons:
• To validate and save a script
• To import or export information
• To delete PowerVB animation from a graphic object
• To close the PowerVB animation editor.
Choose one of the following options from the File menu:
Validate Checks the object script for errors. If the script is valid, a message displays in the bottom left of the window. If the script contains an error, an alert window displays. The text where the error occurs displays in the bottom left of the window, and the line containing the error is highlighted in the animation editor.
Save Saves the object script.
240 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EDITOR
PowerVB Animation Editor
Import Allows you to import ASCII text into the current editor window.
Refer to “Using the Import and Export Dialog” on page 242 for a
description of fields in the Import dialog.
18
Export Allows you to export either the selected text in the object script or the entire script to a text file. This is useful for printing the script or attaching the script to another object.
FactoryLink 6.6.0 / Application Editor Guide / 241
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
Refer to “Using the Import and Export Dialog” on page 242 for a
description of fields in the Export dialog.
Delete Deletes all of the PowerVB animation for the object. A message window displays to verify the script should be deleted.
Close Closes the PowerVB animation editor. If changes have been made to the script since it was last saved, the editor prompts to see if the changes should be saved.
Using the Import and Export Dialog
The Import and Export dialogs operate similarly. Each dialog consists of the following components:
• Menubar
• Current path combo box
• Files area
• Chosen file text box
• Open or Save button
• Apply button
• Cancel button
Menubar
Current Path Combo Box
Files Area
Chosen File Text Box
Open/Save, Apply, and
Cancel Buttons
242 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EDITOR
PowerVB Animation Editor
History Menu
The History menu is used to change to a specific path. The section above the horizontal line is the recent files list. The bottom section is the marked directories list.
Recent Files List
18
Marked Directories List
Recent Files List Marks recently selected directory paths. Choose a path in this list to change the chosen path.
Marked Directories
List
Shows directory paths marked with the Mark option under the
Special menu. Choose a path in this list to change the chosen path.
Special Menu
The Special menu is used to change to the home directory, insert the current directory in the marked directories list, or remove the current directory from the marked directories list.
Home Changes the current path to the home path. For example, on
Windows NT a user home path is defined in the environment variables HOMEDRIVE and HOMEPATH. This is the path holding the user log-in script and other information.
Mark Adds the current path to the marked directories list under the
History menu.
Unmark Removes the current path from the marked directories list under the History menu.
FactoryLink 6.6.0 / Application Editor Guide / 243
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
View Menu
The View menu is used to change the order of the files and directories shown in the file area of the dialog.
By Name Sorts files in the file area by their names.
By Date Modified Sorts files in the file area by the date they were last modified.
Files are sorted from least recently modified to most recently modified.
By Date Created Sorts files in the file area by the date they were created. The files are sorted from the oldest to the newest.
Volumes Menu
The Volumes menu is used to display the current directory for each drive.
Current Paths List Choose a path in this list to change the current path.
Current Path Combo Box
Box below menu bar that displays a list of the components of the current path and backs up the current path to one of its parent directories.
Files Area
List below Current Path Combo Box that displays the files and directories in the current path. The top left button changes the current path to its parent path. The bottom left button changes the current path down one level to the directory chosen in the files list, if a directory is selected. The list shows the files and directories according to the order chosen under the View Menu. The scrollbar on the right of the list shows more files if too many files exist to display at once.
244 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EDITOR
PowerVB Animation Editor
Chosen File Text Box
The Chosen File Text Box displays the name of the file to be opened or saved. The text above the entry field is either Open: or Save as:, depending on whether text is being imported or exported. This box is filled in automatically when a file is chosen in the Files Area. Typing a name into the entry field selects a file without having to use the Files Area list.
Open or Save Button
The Open or Save button is in the lower-left corner of the dialog and is used to open
(import) or save (export) text. This button says Open when importing or Save when exporting. No importing or exporting actually occurs until this button is pressed.
Apply Button
The Apply button imports or exports the selected text. Choosing Open or Save also achieves this result.
Cancel Button
The Cancel button is in the lower-right corner of the dialog and is used to cancel the import or export operation. No text is imported or exported when this button is pressed.
18
FactoryLink 6.6.0 / Application Editor Guide / 245
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
Edit Menu
Use the Edit menu to cut, copy, paste, or delete code in an object script.
Choose the following options from the Edit menu:
Undo Erases the previous action(s) performed in PowerVB. Undo as many actions as needed from the time the script was last saved.
Redo Repeats the action previously completed.
Cut Cuts the selected text and posts it to the clipboard.
Copy Copies the selected text to the clipboard.
Paste Pastes the text from the clipboard to the PowerVB animation editor. If the text is selected in the editor, the pasted text replaces the selected text.
Delete Deletes the selected text without pasting it to the clipboard.
246 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EDITOR
PowerVB Animation Editor
Search Menu
Use the Search menu to locate specific text in an object script.
18
Choose the following options from the Search menu:
Find Finds the first occurrence of the designated text in the object script. If the text is found, the cursor moves to the location. A beep sounds if no matching text is found. The Find option operates only the animation or library script being edited.
Find Next Finds the next occurrence of the designated text in the object script. A beep sounds if no other occurrence exists beyond the current location of the cursor in the editor.
PowerVB Search options search the script from the current location of the cursor to the end of the code. Move the cursor to the beginning of the script before using these options to ensure the entire script is searched.
FactoryLink 6.6.0 / Application Editor Guide / 247
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
Event Menu
Use the Event menu to choose the type of event routine incorporated into an object script. A sub-menu listing specific events is displayed for each event category available for the selected object.
Depending on the type of object selected, all types of routines may not be available. For example, text input routines are not available unless the current object is a text object that has input animation.
Choose from the following options:
Drawing Routines Displays a list of drawing events. Specific drawing subroutine
options are discussed in the “Drawing/Window Events” on page
Mouse Routines Displays a list of mouse events. Specific mouse subroutine options
are discussed in the “Mouse Events” on page 263.
Text Input
Routines
Displays a list of text input events. Specific text input subroutine
options are discussed in the “Text Events” on page 269.
Tag Routines Displays a list of defined tag events. Specific tag subroutine
events are discussed in the “RTDB Events” on page 271.
Define Tag Event Allows you to define tag events. Tag events trigger an event during run time based on the value of one or more tags changing.
248 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EDITOR
PowerVB Animation Editor
Help Menu
Use the Help menu for online information about menu options using the PowerVB animation editor, event routines, and object properties.
18
Choose from the following options:
Menubar Options Displays online help about the menu options available in the
PowerVB animation editor.
PowerVB Editor Displays online help about the PowerVB editor.
Event Routines Displays online help about the event routines that may be attached to an object in PowerVB.
FactoryLink 6.6.0 / Application Editor Guide / 249
•
•
•
•
POWERVB EDITOR
PowerVB Animation Editor
Object Properties Displays a list of the properties available for the object whose script is being edited.
If text is selected in the editor when this menu option is chosen, the selected text is interpreted as a graphic object name and properties for that object are displayed. For example, if the script for an object named Box is being edited and Object Properties is chosen when no text is selected, then Box’s PowerVB properties display. If the text \Rectangle is selected and the drawing has a top-level object named Rectangle, then Rectangle’s PowerVB properties display.
250 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 19
Attaching a Script to an Object
This section details the procedure for attaching a PowerVB script to an object.
This procedure is used for any type of event routine coded in an object script.
Specific information about each of the events, variables used in their subroutines, and examples of PowerVB code for specific events follow this procedure.
C REATING A S CRIPT
Perform the following steps to create a script:
1 Create an object in the Application Editor.
2 Select the object.
3 Choose Attributes>Object Name . Name the object and click on OK to accept the new name.
19
This step is optional, but it is a good idea to name objects that will be referenced from other objects because the object name serves as its reference in the
subroutine code. Refer to Chapter 26, “Hierarchical Graphic Object Naming” for
more information on naming objects.
FactoryLink 6.6.0 / Application Editor Guide / 251
•
•
•
•
ATTACHING A SCRIPT TO AN OBJECT
Creating a Script
4 Choose Animation>PowerVB to will display the PowerVB animation editor window.
5 Choose the type of event routine to be attached to the object from the Event menu.
When an event routine is selected, its beginning and ending statements display in the PowerVB animation editor window. The beginning statement is
Sub <drawing>_<object id>_<event>
The ending statement is always
End Sub
252 / FactoryLink 6.6.0 / Application Editor Guide
ATTACHING A SCRIPT TO AN OBJECT
Creating a Script
6 Add the necessary PowerVB code in the PowerVB animation editor window.
Typically this code opens FactoryLink properties. Information on each type of
PowerVB event follows this procedure.
Caution: Be careful using statements that may be ported to a
FactoryLink application containing PowerVB on a different platform. Several statements in the BASIC language PowerVB supports are only available on
PC operating systems - Windows NT, Windows 95, and OS/2. Also be aware that some BASIC statements are restricted to Windows NT or
Windows 95. The PowerVB Language Reference
Guide provides information on which statements are restricted to which platforms, syntax, and commands.
Click on a checked item in the Event pull-down menu to jump the cursor to the location of the subroutine in the script. This is helpful when navigating through a lengthy script.
7 After entering the necessary code, validate it to ensure the script can be executed at run time. Choose File>Validate to validate the code. If the code contains an error, a message is displayed and the first incorrect line of code is highlighted. Correct any errors and repeat this step until validation is successful.
8 Choose File>Save to save the object script and close the PowerVB animation editor.
Note: Closing the PowerVB animation editor is optional.
Remember that leaving the PowerVB animation editor open while writing code requires frequent saving until the drawing is closed. If the PowerVB animation editor is open, toggle to the
Application Editor before proceeding to Step 9.
9 Choose File>Save in the Application Editor to save the drawing.
Note: This is important because both the PowerVB code and the object must be saved for proper execution of the object script.
10 Run the application to test the animation.
Note: The Test command in the Application Editor cannot test
PowerVB functions. The application must be run to test the
PowerVB code.
11
Debug the script if necessary. Refer to Chapter 27, “Debugging a PowerVB Script”
for information on debugging PowerVB code.
19
FactoryLink 6.6.0 / Application Editor Guide / 253
•
•
•
•
ATTACHING A SCRIPT TO AN OBJECT
Creating a Script
Adding Comments to a Script
Add an apostrophe to the beginning of text that serves as a comment in the script.
A comment can be displayed on a line by itself or after a BASIC statement.
Comments can also begin with the word REM if no BASIC statement precedes the comment on the same line.
Another alternative is enclosing the comment with a slash and the * character, as shown in the following example. Refer to the PowerVB Language Reference Guide for more information on coding subroutines in PowerVB.
Sub cj1_g1145_MouseMove [(X As Long, Y As Long)]
‘Comment: Move this object where the mouse was moved this.Left = X ‘Comment: Move object horizontally this.Bottom = Y ‘Move object vertically
REM this is also a comment
/*This is also a comment.*/
End Sub
PowerVB Files
PowerVB creates the following additional files:
*.GS
PowerVB source code for a specific drawing file.
*.GC
Compiled PowerVB code for a specific drawing file.
*.GPS
PowerVB source code associated with a power pack.
*.GPC
Compiled PowerVB code associated with a power pack.
*.PLS
PowerVB library source files.
*.PLC
Compiled PowerVB library files.
*.PLX
Exported PowerVB libraries.
Caution: Do not delete these files or your PowerVB will not work.
254 / FactoryLink 6.6.0 / Application Editor Guide
ATTACHING A SCRIPT TO AN OBJECT
Calculating Graphic Object Movement
C ALCULATING G RAPHIC O BJECT M OVEMENT
The coordinate location and anchor points of an object are important when considering and calculating object movement. Unlike Microsoft Visual Basic
®
,
PowerVB uses the same coordinate system as other types of animation.
Coordinates for an object are defined with the Left and Bottom properties.
FactoryLink coordinates are numbered from the bottom-left corner, which is 0,0, and the numbers increase as you move upward or to the right. It is simple to calculate the right (object.Left + object.Width) and top (object.Bottom + object.Height) coordinates of the object, if necessary.
All coordinates are relative to the bottom left corner of the drawing, not the bottom left corner of the selected object. The coordinate range is approximately
32,000 horizontal (along the X axis) and 24,000 vertical (along the Y axis), depending on the properties of the specific display and the shape of the window the drawing displays in.
P RINTING S CRIPTS
Perform one of the following procedures to print a script:
Exporting Text
1 Select the text to be printed.
2 Choose File>Export . Enter a name for the ASCII-format file.
3 Print the code.
Using Document PowerVB
1 Choose File>Document PowerVB in the Application Editor. A message box is displayed with the name of the report that will be generated.
2 Open the report through a text editor.
3 Print the report.
Pasting to the Clipboard
1 Copy the text directly into a text editor using the clipboard.
2 Print the code.
19
FactoryLink 6.6.0 / Application Editor Guide / 255
•
•
•
•
ATTACHING A SCRIPT TO AN OBJECT
Reserved Words
Object Names and Object IDs
When you create a graphic object, it receives a default name which the application developer can replace ( Attributes, Object Name ). These default names are in the form of hxxxx where xxxx is a sequential number starting at 1001. Each object also gets an ID in the form of #xxxx where xxxx is also a sequential number.
Object names and IDs are important to understand because the object name can be used in the body of the PowerVB code while the object ID is used to generate the event procedure names. Do not use duplicate procedure names in the same drawing. The object ID, unlike the object name, is always unique; therefore, no duplicate event procedure names occur.
R ESERVED W ORDS
All statements and function names in the PowerVB Language Reference Guide as well as all properties and methods are considered reserved words. These words cannot be used as variable names in PowerVB.
256 / FactoryLink 6.6.0 / Application Editor Guide
ATTACHING A SCRIPT TO AN OBJECT
Literals
L ITERALS
Literals are values of a specific type. The following table shows the different types of literals supported by PowerVB.
Table 19-0 Literals supported by PowerVB
Literal Description
10
43265
5#
5.5
Integer whose value is 10.
Long whose value is 43,265.
Double whose value is 5.0. A number type can be explicitly set using any of the following type-declaration characters.
%
&
Integer
Long
#
!
Double
Single
Double whose value is 5.5. Any number with a decimal point is considered a double.
5.4E100
&HFF
&047
&HFF#
Double expressed in scientific notation.
Integer expressed in hexadecimal.
Integer expressed in octal.
Double expressed in hexadecimal.
“hello” String of five characters: hello.
“““hello””” String of seven characters: “hello”. Quotation marks can be embedded within strings by using two consecutive quotation marks.
#1/1/1994# Date value whose internal representation is 34335.0. Any valid date can appear with #’s. Date literals are interpreted at execution time using the local settings of the host environment. To ensure that date literals are correctly interpreted for all locales, use the international date format:
YYYY-MM-DD HH:MM:SS#
19
FactoryLink 6.6.0 / Application Editor Guide / 257
•
•
•
•
ATTACHING A SCRIPT TO AN OBJECT
Literals
258 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 20
PowerVB Events
PowerVB events determine when PowerVB code is initiated at run time. For example, a PowerVB routine could be assigned to run when the drawing is loaded.
Many different types of events come built in to PowerVB; however, you may also define your own types of events. This chapter describes the PowerVB built-in events as well as user-defined events.
D RAWING /W INDOW E VENTS
Use drawing/window events to perform the following types of operations at run time:
• Events that happen when a drawing is loaded or unloaded from memory
• Events that happen when a window gains or loses focus
Open these events from the Drawing Routines menu.
Drawing Routines menu
The following graphic is the Drawing Routines menu.
20
FactoryLink 6.6.0 / Application Editor Guide / 259
•
•
•
•
POWERVB EVENTS
Drawing/Window Events
DrawUnload
A DrawUnload event occurs when the drawing is about to be unloaded from memory. This event occurs every time the drawing is unloaded from a window whether it is loaded in other windows or not.
Sample Code: sub mouse_g1005_DrawUnload window.title = old_title ‘reset windows title end sub
Note: If a window is removed/dismissed by setting the enable tag to 0, the DrawingUnload event is not triggered for the active drawing (the WinLostFocus event is triggered).
DrawLoad
A DrawLoad event occurs when the drawing is loaded into memory. The
DrawLoad event occurs every time the drawing is loaded into a window whether it is already loaded in other windows or not.
260 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Drawing/Window Events
For example, the ceramic injection drawing title changes with the code that follows.
20
Sample Code: sub mouse_g1006_DrawLoad old_title = window.title ‘save window’s previous
‘title window.title = “Mouse Events” ‘change window’s title
WinLostFocus
A WinLostFocus event occurs when a window loses input focus or is no longer the top window.
FactoryLink 6.6.0 / Application Editor Guide / 261
•
•
•
•
POWERVB EVENTS
Drawing/Window Events
Sample Code: sub misc1_g1020_WinLostFocus this.text = “Window Lost Focus” end sub
WinGotFocus
A WinGotFocus event occurs when a window receives input focus or becomes the top window.
Sample Code: sub misc1_g1001_WinGotFocus this.text = “Window Got Focus” end sub
Debug windows focus events carefully. If an error occurs in a window focus event, the error pop-up message causes another window focus event, which may cause another error. This results in an infinite loop.
Note: The WinGotFocus event is not triggered if a drawing is loaded into an open window; it is only triggered if the drawing is loaded into a new window.
262 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Mouse Events
M OUSE E VENTS
Mouse events are used in PowerVB to perform the following types of operations:
• Click and drag objects
• Animate an object to show when you press and release a mouse button
• Indicate when the mouse is passed over an object
For non-rectangular objects, mouse events are captured within the bounding box of the object (defined as an imaginary rectangle enclosing the object). If objects overlap, the object on top generates the mouse routine.
Open mouse events through the Mouse Routines sub-menu.
Mouse Routine Arguments
Mouse routines take either two arguments (X As Long, Y As Long) or three arguments (Button As Integer, X As Long, Y As Long).
The Button As Integer argument defines which button is pressed, released, or clicked to cause an event. The value of Button is checked against the pre-defined constants as in the following example:
Sub drwg_g1003_MouseDown (Button As Integer, X As Long, _
Y As Long) if Button and Left_Button then
REM left button pressed, released, or clicked elseif Button and Right_Button then
REM right button pressed, released, or clicked elseif Button and Middle_Button then
REM middle button pressed end if
End Sub
The X As Long and Y As Long arguments define the horizontal and vertical coordinates of the mouse at the time the event occurred.
20
FactoryLink 6.6.0 / Application Editor Guide / 263
•
•
•
•
POWERVB EVENTS
Mouse Events
Mouse Routines Menu
The following graphic is the Mouse Routines menu.
MouseMove (X as long, Y as long)
A MouseMove event occurs when the mouse is moved over an object.
Sample Code: sub mouse_g2001_MouseMove(X As Long, Y As Long) if mouse_button_state = 1 then
This.Left = X - XOffset.value
This.Bottom = Y - YOffset.value
end if end sub
264 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Mouse Events
MouseUp (button as integer, X as long, Y as long)
A MouseUp event occurs when a mouse button is released and even if the mouse cursor is moved off the object before the button is released.
Sample Code: sub Drawing_Object_MouseDown(Button As Integer, X As Long,_
Y As Long)
’ This code gives the effect of a button being pressed
This.c(“LeftLine”).linecolor = 57
This.c(“TopLine”).linecolor = 57
This.c(“RightLine”).linecolor = 63
This.c(“BottomLine”).linecolor = 63 end sub sub Drawing_Object_MouseUp(Button As Integer, X As Long, _
Y As Long)
' This code gives the effect of a button being released
This.c(“LeftLine”).linecolor = 63
This.c(“TopLine”).linecolor = 63
This.c(“RightLine”).linecolor = 57
This.c(“BottomLine”).linecolor = 57 end sub
MouseDown (button as integer, X as long, Y as long)
A MouseDown event occurs when a button on the mouse is pressed. An example of
PowerVB code using this event is illustrated in the discussion of the MouseUp event.
20
FactoryLink 6.6.0 / Application Editor Guide / 265
•
•
•
•
POWERVB EVENTS
Mouse Events
Dragging an Object
Use the MouseUp and MouseDown routines to identify whether the object is selected. Use MouseMove to drag the selected object to a new location on the screen. The following example illustrates PowerVB code to achieve this animation.
Private Mouse_Is_Down As Integer, X_Offset As Integer,_
Y_Offset As Integer sub Drawing_g1002_MouseMove(X As Long, Y As Long)
If Mouse_Is_Down then
’ Move object while mouse button is down
This.Left = X - X_Offset
This.Bottom = Y - Y_Offset
End If end sub sub Drawing_g1002_MouseUp(Button As Integer, X As Long, Y As_
Long)
Mouse_Is_Down = FALSE end sub sub Drawing_g1002_MouseDown(Button As Integer, X As Long,_
Y As Long)
If Button = LEFT_BUTTON Then Mouse_Is_Down = TRUE
’ Calculate where user clicked on object
X_Offset = X - This.Left
Y_Offset = Y - This.Bottom
end sub
When a mouse button is pressed while the mouse cursor is over an object that responds to the MouseDown, MouseMove, or MouseUp events, that object gains mouse focus. All MouseMove events go to an object with mouse focus even if the mouse cursor moves off the object. Mouse focus is lost when the button is released.
266 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Mouse Events
EndPointedAt (X as long, Y as long)
An EndPointedAt event occurs when the mouse stops being over an object.
Sample Code: sub Drawing_Object_EndPointedAt(X As Long, Y As Long)
’ Change this object back to gray when the cursor moves away
This.Fillcolor = GRAY end sub
Click (button as integer, x as long, y as long)
A Click event occurs when the mouse button is pressed and released while over an object. A click event does not occur if the mouse is moved off of the object before the button is released. A click event does occur if the mouse is moved off of the object and back onto the object before the button is released.
Sample Code:
Click (button as integer, x as long, y as long)
’Force tag ’ThisTag’ to 1
ThisTag.Force 1 end sub
BeginPointedAt (x as long, y as long)
A BeginPointedAt event occurs when the mouse initially moves over an object.
Sample Code: sub Drawing_Object_BeginPointedAt(X As Long, Y As Long)
’ Change this object to red when the cursor is over it
This.Fillcolor = RED end sub
20
FactoryLink 6.6.0 / Application Editor Guide / 267
•
•
•
•
POWERVB EVENTS
Mouse Events
Troubleshooting – Overlapping Objects
If objects are overlapping, the top-most object with a mouse event defined receives all mouse events of that type, as demonstrated in the following example.
ObjectA
ObjectB
If both ObjectA and ObjectB have Click events and you click on ObjectB, the Click routine for Object B will run but not ObjectA. If this type of behavior is required, put all of the Click event code in ObjectA and, based on the X and Y parameters in the Click event, determine where the Click occurred.
If ObjectA has a MouseMove event but ObjectB does not, ObjectA receives the
MouseMove events, even if the mouse is pointing at ObjectB.
If ObjectA has a EndPointedAt event, it executes when the mouse cursor enters
Object B.
268 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Text Events
T EXT E VENTS
Text events in PowerVB code are used to perform various operations. Only text objects with input text animation can have these events. If a text event is defined for another object, the event subroutine is never invoked.
Text Input Routines Menu
The Text Input Routines menu is displayed below. The following paragraphs explain the text input events.
20
EnterKey
An EnterKey event occurs when the enter key is pressed if the contents of the Edit field have not been written to the RTDB.
Sample Code: sub Drawing_Object_EnterKey
’ Change the contents of this field to uppercase
This.Text = UCase(This.Text) end sub
FactoryLink 6.6.0 / Application Editor Guide / 269
•
•
•
•
POWERVB EVENTS
Text Events
LostFocus
A LostFocus event occurs when a text object has keyboard focus, then loses it.
Sample Code: sub Drawing_Object_LostFocus
‘Indicate that this field no longer has focus by changing
‘text to black
This.Textcolor = BLACK end sub
GotFocus
A GotFocus event occurs when a text object gets keyboard focus. For example, an input text field has focus at run time when the cursor is positioned in that field. To gain focus, you click on the field or tab to the field.
Sample Code: sub Drawing_Object_GotFocus
‘Indicate that this field has focus by
‘changing text to red
This.Textcolor = RED end sub
Change
A Change event occurs when the contents of a text object change.
Sample Code: sub Drawing_Object_Change
‘Update the window title with the contents of this
‘text object
Window.Title = This.Text
end sub
270 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
RTDB Events
RTDB E VENTS
RTDB events are used to perform various operations. These events do not have pre-defined names. Define the name of a RTDB event and its trigger elements in the PowerVB animation editor. RTDB events do not take any arguments. A list of the tag routines defined is available in the Tag Routines menu. Click on the name of a routine to jump to the appropriate place in the script for that routine.
The combination of all of the tag events for an object can have a maximum of 50 different tags in the trigger lists.
D EFINING T AG E VENTS
Tags are used to trigger certain FactoryLink or custom-created events at run time when one or more tag values change.
Adding a New Tag Event
1 Choose Event>Define Tag Event in the PowerVB animation editor to display the
Define Tag Event window.
20
2 Enter a name for this event in the Event Name field of the dialog.
3 Enter the applicable tag in the Tag List Edit field.
4 Click on Add , or press return, to add the tag to the trigger list.
FactoryLink 6.6.0 / Application Editor Guide / 271
•
•
•
•
POWERVB EVENTS
Defining Tag Events
5 Click on OK to accept the new tag event information. The beginning and ending statements for the subroutine are created in the PowerVB animation editor window.
6 Enter the code for this event in the PowerVB animation editor window.
The example below outlines the procedure for creating and implementing an event that occurs once each second. A tag event named onesecond using the tag A_SEC is used to implement an analog clock. The object SecondHand rotates 6 degrees every second (variables ClockFaceHorizCenter and ClockFaceVertCenter would have been previously calculated).
sub drawing_object_onesecond
\SecondHand.rotate ClockFaceHorizCenter,_
ClockFaceVertCenter, 6 end sub
Tag events are defined at the object level. It is possible to have a tag defined as part of more than one tag event. Also, more than one tag can be used as a trigger
for a single tag event. Repeat Steps 3 and 4 in the example to add as many tags as
desired to a tag event’s trigger list.
Modifying an Existing Tag Event
Use the Define Tag Event Window to change the name of an existing tag event or change the list of tags used to trigger it.
1 Choose Event>Define Tag Event to display the Define Tag Event window.
2 Click on the arrow next to the Event Name field to display a list of the existing tag events.
3 Select a tag event from this list. The name is displayed in the Event Name field.
4 Alter the tag event as necessary.
272 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB EVENTS
Defining Tag Events
Renaming a Tag Event
Click on Rename to rename the tag event. A message box displays, prompting for a new name. Once a new name is entered, the tag event code in the animation editor changes to use the new name.
Adding a Tag
Enter the tag name in the entry field above the Add button to add a tag to the tag list for the tag event. Click on Add to insert t he tag into the list.
Removing a Tag
Select the tag to remove it from the tag list for the tag event, or click on Remove to delete the tag from the list.
5 Once a tag event has been altered in the Define Tag Event window, click on OK to apply the changes to the code in the editor or click on Cancel to discard the changes.
Note: Once the tag event has been altered, the PowerVB editor script must still be saved to make the change permanent.
Deleting an Existing Tag Event
Use the Define Tag Event window to delete an existing tag event.
1 Choose Event>Define Tag Event to display the Define Tag Event window.
2 Click on the arrow next to the Event Name field to display a list of the existing tag events.
3 Select a tag event from this list to display the name in the Event Name field.
4 Click on Delete to remove this tag event. The event, as well as all the code in its subroutine, is deleted.
20
FactoryLink 6.6.0 / Application Editor Guide / 273
•
•
•
•
POWERVB EVENTS
Declaring Events
D ECLARING E VENTS
Event routine declarations are generated when a routine is chosen from the event menu. All events in PowerVB have the same declaration statement format: sub drawing_object_event [(arguments)] where drawing is the name of the drawing to which the PowerVB animation is attached object is the ID of the object to which the PowerVB event is attached event is the event name
[(arguments)] is the list of arguments for the event, if any
For example, the MouseMove event for object z1002 on drawing button.g is declared as: sub button_z1002_MouseMove (x as long, y as long)
A statement declaration in a PowerVB script is highlighted in the following example.
Do not change the declaration text of FactoryLink-created subroutine statements or the routine will not be triggered properly.
274 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 21
Using Variables to
Declare PowerVB
Objects
Declare an object for RTDB and graphics objects in PowerVB code in one of following ways:
• Implicit
• Explicit
I MPLICIT V ARIABLES
If the RTDB or graphics object name is used as a variable name in an object’s
PowerVB code, a connection is made automatically to the object. This works with
FactoryLink defined names as well as user-created names. For example, the following code integrates the meaning of the FactoryLink tag A_SEC and a graphic object named \graphname .
Sub Somedwg_someobj_DrawLoad dim I% as integer
‘set I equal to the current second value
I% = A_SEC.Value
‘move the box to the right 20 units
\graphname.Left = \graphname.Left + 20
End Sub
When this code is validated or saved in the PowerVB editor, PowerVB recognizes
A_SEC as a FactoryLink tag and \graphname as a graphics object and uses these variables with the appropriate meaning.
21
FactoryLink 6.6.0 / Application Editor Guide / 275
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Implicit Variables
However, if a local variable is defined with the same name as a RTDB or graphics object, the variable overrides the implicit meaning. For example, the variable
A_SEC has no special tag meaning in the following code:
Sub somedwg_someobj_DrawLoad
Dim A_SEC As Integer, I As Integer
I = A_SEC ‘Not a RTDB element
End Sub
Troubleshooting – Implicit Variables
PowerVB recognizes RTDB or graphic object names only if they are defined before they are used in a script. For example, if you create a script that refers to a variable named PumpMotor without explicitly defining the variable, saving the drawing, and then defining a tag named PumpMotor, the variable in the script has no special tag meaning. However, if you alter the script later, re-save the drawing, or export and then import the drawing or application the script is attached to, PowerVB detects that PumpMotor is an RTDB element and uses it as such.
Avoid using variable names identical to tag names because this makes the
PowerVB script difficult to debug and maintain.
Implicit variable names are case-sensitive. Graphic object names must be displayed in the correct case every time they are used. RTDB element names must be displayed in the correct case at least once in a script.
For example, the name A_SEC is recognized as a tag in both places in the following code (when used as a_Sec and A_SEC) because it is spelled with the correct case at least once.
a_Sec = 5
A_SEC = 20
Do not create two tags whose names vary only by case. Both tags could not be used as implicit variables in PowerVB.
276 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Implicit Variables
Arrays as Implicit Variables
Tag arrays are partially supported when using implicit tag variables. Use array dimensions with the BASIC array syntax, but do not use remote node prefixes or dot property suffixes. Use the tag properties with tag arrays.
The following example illustrates legal uses of an array:
‘Set Motors [3] [2] to 20
Motors (3, 2) = 20
‘If Motors [4] [1] has changed, do something
If Motors (4,1) .Changed Then
‘other part of the code
End If
‘Force write the value 50 into Motors [5] [5]
Motors (5,5) .Force 50
The following code illustrates illegal uses of tag arrays as implicit variables:
‘Can’t use remote node (PowerNet) syntax remote_node:some_tag = 20
‘Can’t use square brackets - use SomeTag (5,6)
SomeObj [5] [6] = 20
‘Can’t use “dot properties” like “.Raw” implicitly
SomeObj.Raw = 30
21
FactoryLink 6.6.0 / Application Editor Guide / 277
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
E XPLICIT V ARIABLES
Explicit declarations provide flexibility in PowerVB coding, although using them requires extra typing. Explicit declarations are necessary to use properties of a tag or PowerNet tags.The following example illustrates the use of explicit variable declaration: dim x as RTDBObject set x = RTDBObjectValue (“A_SEC”) x.Value = 5
RTDBObjectValue Function
Although an explicit drawing or window variable cannot be set as the output of a function like RTDBObjectValue, a variable of type DrawingObject or
WindowObject can be explicitly defined. This is mainly used for passing drawing and window objects to subroutines in a library, as in the following example:
Sub SetDrawingColorToCommonColor (d as DrawingObject) d.BackColor = BLUE
‘blue is the common color to use for all drawing backgrounds)
End Sub
The special function RTDBObjectValue associates explicit RTDB object variables with the actual RTDB elements. The string used in these functions does not have to be a simple string literal. It can be any variable expression that evaluates to a string.
278 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
For example, the following code sets all the RTDB elements in the given array to the given value:
Sub SetRTDBObjs (names () as string, new_value as long)
Dim RTDB_var as RTDBObject, I as Integer
For I = 1 to Ubounds (names)
‘link variable to a tag
Set RTDB_var = RTDBObjectValue (names (I%)) rtdb_var = new_value ‘change value of tag
Next I
End Sub
Note: Functions ‘UBound’ and ‘LBound’ do not recognize implicit RTDBObject arrays.
When using the RTDBObjectValue function, use the same case as when the RTDB object was defined.
For example, the following code refers to the same tag value because PowerVB is not case-sensitive regarding variable names:.
x = thistag.value
y = THISTAG.value
21
FactoryLink 6.6.0 / Application Editor Guide / 279
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
The following code, however, refers to different tags:.
private tagval as RTDBObject set tagval=RTDBObjectValue(“thistag”) x = tagval.value
set tagval=RTDBObjectValue(“THISTAG”) y = tagval.value
Arrays as Explicit Variables
Unlike implicit array references, use brackets to indicate array subroutines when defining a tag array element explicitly with the RTDBObjectValue function.
Sample Code:
’These two sets of code have the same result
’Explicitly declared object array dim x as RTDBObject dim i as Integer
For i = 0 to 10 set x = RTDBObjectValue(“arraytag[“ & trim(str$(i))_
& ”]”) x.Value = 5
Next i
' Implicitly declared object array
For i = 0 to 10 arraytag(i).Value = 5
Next i
Parent and Child Methods
The Drawing.Child method associates explicit graphic object variables with the actual graphic objects.
280 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
The .parent and .child methods of graphic objects can also link explicit graphic object variables with actual graphic objects.
Refer to Chapter 26, “Hierarchical Graphic Object Naming” for more information
on parent and child graphic object relationships.
The following code example illustrates the difference between explicit and implicit variable declaration.
Sample Code:
’ This code (5 lines) is the same as...
dim x as RTDBObject dim i as Integer
For i = 0 to 10 set x = RTDBObjectValue(“tag” & trim(str$(i))) x.Value = 5
Next i
' this code (10 lines).
tag0.value = 5 tag1.value = 5 tag2.value = 5 tag3.value = 5 tag4.value = 5 tag5.value = 5 tag6.value = 5 tag7.value = 5 tag8.value = 5 tag9.value = 5 tag10.value = 5
21
FactoryLink 6.6.0 / Application Editor Guide / 281
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
Troubleshooting – Explicit Variables
When to Use Set
Verify you are using the Set statement when using explicit variables.
Sample Code: dim tag as RTDBObject
Set tag = A_SEC tag = A_SEC
The first statement lets the variable tag represent the RTDB element called
A_SEC.The second statement sets the value of whatever RTDB element tag refers to the current value of A_SEC. Use set only to refer a tag variable to a specific
RTDB element or the resulting error can be difficult to identify and correct.
Meaningless Values
It is possible to set explicit RTDB and graphic object variables to a meaningless value.
Sample Code:
Sub SomeDrawing_SomeObjectID_SomeEvent
Dim Tag As RTDBObject
Set Tag = RTDBObjectValue(“WHOOPIE”)
Tag.Value = 50
End Sub
282 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables
In the preceding example, the set statement puts the special value nothing into the variable Tag because the FactoryLink application does not have an RTDB element named WHOOPIE. The next statement, which sets the value of Tag at 50, causes a run-time error. Trap this error using the On Error functionality of BASIC or using code like the following:
Sub SomeDrawing_SomeObjectID_SomeEvent
Dim Tag As RTDBObject
Set Tag = RTDBObjectValue(“WHOOPIE”)
If Tag Is Not Nothing Then
' now we're sure tag is a valid variable
Tag.Value = 50
End If
End Sub
The run-time error could also be trapped using the following code:
Sub someDrawing_SomeObjectID_SomeEvent
Dim O As GraphicObject
Set O = Drawing.Child(“JOE”)
If O Is Nothing Then
MsgBox “Uh oh, the drawing has no child named JOE”
Exit Sub
End If
End Sub
Refer to the PowerVB Language Reference Guide for more information on Set and
Nothing .
21
FactoryLink 6.6.0 / Application Editor Guide / 283
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Explicit Variables vs. Implicit Variables
E XPLICIT V ARIABLES VS . I MPLICIT V ARIABLES
When referring to objects in PowerVB code, use implicit variables whenever possible since in addition to less typing and steps needed to implement, implicit references are checked during validation. Explicit references are checked during run time, so they are more difficult to debug.
However, explicit references are necessary in certain situations. Use objects use explicit references for graphics objects in the following cases:
• When using variables to build the reference. These are often built for similarly named objects in a loop.
• When there are _ in the object name (version 6.0.0)
Use explicit references for RTDB objects in the following cases:
• When using variables to build the name. These are often built for similarly names objects in a loop.
• When referencing tags which only have capitalization differences in the same
PowerVB object.
• When referencing PowerNet tags, following the Domain:Tag syntax, or tags with attributes such as tag.raw
generated by the scaling and deadbanding task.
D ATA T YPES
When creating a variable, the data type must be specified. Since a variable is a name of a memory address where PowerVB stores the data, PowerVB must know how many memory cells to put aside for this data to most efficiently use your computer’s resources.
For example, PowerVB needs to reserve much less memory to store the number 1 than to hold Pi computed to seventeen decimal places. The following table outlines the different data types available in PowerVB.
284 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Data Types
Table 21-0 PowerVB Data Types
#
!
%
&
Suffix
@
Data
Type
Description Range
Space
Required
Integer
Long
Double
Single
Integer numbers
Integer numbers
-32768 to 32767
-2,147,483,648 to
2,147,483,647
Real (float) numbers 4.94E-324 to 1.79E38
Real (float) numbers 1.40E-45 to 3.40E38
Date Date
Currency Fixed-decimal numbers
-922,337,203,685,477.5808 to
922,337,203,685,477.5807
2 bytes
4 bytes
8 bytes
4 bytes
8 bytes
$
Boolean True/False
Object
Variant
String Text 0 to approx. 65500 characters
1 byte per character
None Userdefined type
Arrays
21
FactoryLink 6.6.0 / Application Editor Guide / 285
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Declaring Dimension Variables
D ECLARING D IMENSION V ARIABLES
PowerVB reserves the required memory space when a variable is declared. The amount depends on the type of variable.
Use the Dim (short for dimension) statement to declare a variable. When the variable is created it is set to the initial value of 0 or empty depending on whether the variable is a number or a string.
Rules for Naming Variables
Observe the following rules when naming variables:
• The first character in the variable name must be a letter.
• The only characters allowed in variable names are letters, numbers, and the underscore character.
• The variable name must be 40 characters or fewer in length.
• The variable name cannot be the same as a PowerVB reserved word, such as
Sub , End , If , or While .
The following table lists some incorrect variable declarations.
Table 21-0 Variable Declaration Problems
Statement
Dim 1Address As String
Dim First&LastName As
String
Dim Birth Date As Integer
Dim End As Integer
Problem
Variable name begins with a number.
Variable name contains the & character.
Variable name contains a space.
Variable name contains the PowerVB reserved word “ End ”.
286 / FactoryLink 6.6.0 / Application Editor Guide
USING VARIABLES TO DECLARE POWERVB OBJECTS
Expression Evaluation
E XPRESSION E VALUATION
PowerVB allows expressions to involve different data of different types. When this occurs, the two arguments are converted to the same type by promoting the less precise operand to the same type as the more precise operand. For example,
PowerVB promotes the value of i% to a Double in the following expression: result# = i% * d#
In some cases, the data type each operand is promoted to is different than that of the most precise operand. This is dependent on the operator and the data types of the two operands and is noted in the description of each operand.
If an operation is performed between a numeric expression and a String expression, then the String expression is usually converted to be of the same type as the numeric expression. For example, the following expression converts the
String expression to an Integer before performing the multiplication: result = 10 * “2”‘Result is equal to 20.
There are exceptions to this rule, as noted in the description of the individual operators.
T YPE C OERCION
PowerVB performs numeric type conversion automatically. Automatic conversions sometimes result in overflow errors, as shown in the following example: d# = 45354 i% = d#
In this example, an overflow error is generated because the value contained in d# is larger than the maximum size of an Integer .
21
FactoryLink 6.6.0 / Application Editor Guide / 287
•
•
•
•
USING VARIABLES TO DECLARE POWERVB OBJECTS
Rounding
R OUNDING
When floating-point values (Single or Double) are converted to integer values
(Integer or Long), the fractional part of the floating-point number is lost, rounding to the nearest integer value. PowerVB uses Baker’s rounding:
• If the fractional part is larger than .5, the number is rounded up.
• If the fractional part is smaller than .5, the number is rounded down.
• If the fractional part is equal to .5, the number is rounded up if it is odd and down if it is even.
For example,
Before Rounding After Rounding to Whole Number
2.1
4.6
2.5
3.5
2
5
2
4
288 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 22
Using Properties and
Methods in PowerVB
A property is an attribute of the object that can be read from and, unless designated as read-only, written to. A method is an action on an object.
RTDB O BJECT P ROPERTIES
RTDB object properties allow manipulation of certain aspects of an RTDB object
(tag) during run time. RTDB objects are basically tag variables. Tags are immediately available to PowerVB code if they exist in the realtime database. The
PowerVB editor will not create tags for you except during the Tag Event definition
process, discussed in “Defining Tag Events” on page 271.
RTDBObject.Value
RTDBObject.Value is a read/write variant property that holds the value of the
RTDB element. Use .Value
after a tag name to utilize the value of the tag. For example, in the statement if old_value = A_SEC , A_SEC could be either a tag or a declared variable within the subroutine. If the same statement read if old_value = A_SEC.Value then , there is no confusion that the value the code should identify is that of a tag. RTDBObject.Value is the default property for a tag variable and can be referred to in any of the following ways:
‘set RTDB element x’s value to 10 x.Value = 10
‘read value of the RTDB element x
I% = x.Value
‘now set x’s value to 20 x = 20
‘read value of RTDB element x again
I% = x
22
FactoryLink 6.6.0 / Application Editor Guide / 289
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
RTDB Object Properties
Although the .Value property is not required, use it to distinguish between references to local variables and tags to make the code more readable.
RTDBObject.Type
RTDBObject.Type is a read-only integer property that tells the type of the RTDB element. (Mailbox RTDB elements are not supported in PowerVB code.) This type can be compared to one of the following constants:
• FL_DIGITAL
• FL_ANALOG
• FL_LONGANA
• FL_FLOAT
• FL_MESSAGE
Sample Code: sub DisplayType (Name as string) dim obj as RTDBObject dim typ as string set obj = RTDBObjectValue (Name) select case obj.type
case FL_DIGITAL typ = “digital” case FL_ANALOG typ = “analog” case FL_FLOAT typ = “float” case FL_MESSAGE typ = “message” case FL_LONGANA typ = “long analog” case else typ = “unknown and unsupported” end select msgbox “The RTDB element” & Name & “ is a “ & typ &
“RTDB element” end sub
290 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
RTDB Object Properties
RTDBObject.Active
RTDBObject.Active is a read-only integer property that is true if the tag is triggered for the current RTDB event subroutine. When a tag event can be triggered by several different tags, it is possible for more than one tag to be Active at the same time. This value can be true only inside an RTDB event subroutine.
Sample Code: sub Drawing_Object_TagEvent
If A_SEC.Active Then
\txtMessage.Text = “This event triggered by A_SEC”
If OTHER_TAG.Active then
\otherTxtMessage.Text = “This event also_ triggered by OTHER_TAG
End If
End If end sub
22
RTDBObject.Force
RTDBObject.Force writes a value into an RTDB element and sets the element change flag even if the value did not change. By contrast, a regular write with the statement rtdb_obj = newvalue or rtdb_obj.Value = newvalue , sets the changed flag for this RTDB object only if newvalue is different from the previous value.
Sample Code:
‘turn the motor on by forcing its RTDB element to 1
Motor.Force 1
‘force a new string into ErrorMessage object
ErrorMessage.Force “New Error Message”
FactoryLink 6.6.0 / Application Editor Guide / 291
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
G RAPHIC O BJECT P ROPERTIES
Graphic object properties are used to manipulate certain aspects of an object during run time. Some graphic object properties may only be used for specific types of graphics objects. A BASIC run-time error results if properties are used with an object of the wrong type.
This Object Variable
The this variable is a special graphics object variable available when a PowerVB subroutine is attached to a graphic object in a drawing. The this variable is a convenient way to access the graphics object the subroutine is attached to. Use the this variable in place of the object name when assigning variable properties in
PowerVB. Because this always refers to the currently-selected object, code using the this variable is portable and can be copied, called, or imported, and applied to several different objects. This means code would not need to be modified if the name of the current graphics object changed.
RedrawOn and RedrawOff
Normally, visible changes to a graphic object take place immediately. If a graphic object is moved diagonally towards the lower left corner of the screen by changing its left property and then its bottom property, the object moves left across the screen and then vertically down the screen during run time. The RedrawOff statement makes the movement across the screen invisible during run time.
Using the RedrawOn statement after moving the graphic means the graphic is displayed in the new location with no visible movement across the screen.
Issue the RedrawOn statement as many times as the RedrawOff statement during the execution of an event routine or redrawing is turned off until the event routine finishes.
Sample Code:
RedrawOff ‘don’t show changes in Box01’s position
‘Move the box to the left and down
Box01.left = Box01.left - 200
Box01.bottom = Box01.bottom - 200
RedrawOn ‘show Box01 in its new position
292 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.Type
GraphicObject.Type is a read-only integer property that defines the type of the graphics object. The constants available to check this value against are
• FL_DRAWING
• FL_BOX
• FL_ELLIPSE
• FL_POLYGON
• FL_TEXT
• FL_COMPOSITE
• FL_LEGEND
• FL_LINE
• FL_PARABOLA
Sample Code: if this.type = FL_BOX then msgbox “This PowerVB code is attached to a_
Box object.” end if
GraphicObject.Left
GraphicObject.Left is a read/write long integer value that defines the left position of the object along the x axis. Use this property to move an object along the x axis.
Coordinates in PowerVB are discussed in “Calculating Graphic Object Movement” on page 255.
Sample Code:
‘Move the box to the right a little.
Box01.left = Box01.left + 100
22
FactoryLink 6.6.0 / Application Editor Guide / 293
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
An object can become invisible if its left value is set out of the range of 0 to 32000.
For example, changing the left value to 40000 would make an object invisible.
If the object has an animation type with X and Y coordinate animation, then conflicts could occur when writing to this property. In the case an event that changes both the X and Y coordinates tag and the left property, the change that happens last governs the position of the object. Reading the property always shows the proper left coordinate.
Note: A pen change on a chart may cause the pen lines to disappear until the chart has enough samples to redraw the line.
GraphicObject.Bottom
GraphicObject.Bottom is a read/write long integer value that defines the bottom position of the object along the y axis. Use this property to manipulate the location of an object on the y axis.
Sample Code:
‘Move the box up a little
Box01.bottom = Box01.bottom + 100
Moving the bottom outside this range can make the object invisible.
GraphicObject.Width
GraphicObject.Width is a read/write long integer value that defines the current width of an object. Use this property to make an object narrower or wider. If the graphic object is a text object, changing the width moves the text but does not make it any wider.
Sample Code:
‘Make the ellipse wider
Ellipse01.Width = Ellipse01.Width + 200
294 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
If the object has an animation type with Bar animation, changing this value makes the bar fill value incorrect for horizontal bars. The bar uses its original size when calculating the amount to fill.
Similarly, if the object has chart animation, changing the width causes horizontal charts to properly use the new width while drawing. Vertical charts still scale to the original size.
GraphicObject.Height
GraphicObject.Height is a read/write long integer value that defines the height of an object. Use this property to make a graphic object shorter or taller. If the graphic object is a text object, changing the height alters both the width and the height.
Sample Code:
‘Make the parabola shorter
Parab.height = parab.height - 100
22
GraphicObject.Text
GraphicObject.Text is a read/write string value that holds the text contained in a text object. This property is only valid for text object variables. One use of this property is to read the unprocessed text in a text object that has input animation attached.
Sample Code: msgbox “Input field contains “ & InputFld.text
‘now clear the input field
InputFld.text = “ “
If this property is used on a non-text object, the current sub procedure stops executing at the line that contains the GraphicObject.Text statement.
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
FactoryLink 6.6.0 / Application Editor Guide / 295
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.Font
GraphicObject.Font is a read/write string value that contains the name of the font used for a text object. This property is valid only for text object variables and is restricted to the fonts on your system.
Sample Code:
‘Change to Courier New font
InputFld.font = “Courier New”
If this property is used on a non-text object, the current sub procedure stops executing at the line that contains the GraphicObject.Font statement.
Font substitutions on your system might result in a point-size change. The text is displayed in the previous font if the font name is changed to a valid one.
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
GraphicObject.Bold
GraphicObject.Bold is a read/write integer string value. The text is bold when this property value is true (non-zero). The text is not bold if the property value is false.
This property is valid only for text object variables.
Sample Code:
‘Toggle the bold attribute of the text object if Txt.bold then else
Txt.bold = False ‘bold off
Txt.bold = True ‘bold on end if
If this property is used on a non-text object, the current sub procedure stops executing at the line that contains the GraphicObject.Bold statement.
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
296 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.Italic
GraphicObject.Italic is a read/write integer property that italicizes text if the property value is true (non-zero). The text is not italicized if the value is false.
This property is valid only for text object variables.
If this property is used on a non-text object, the current sub procedure stops executing at the line that contains the GraphicObject.Italic statement.
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
Sample Code:
‘Make the text italicized
Txt.italic = True
GraphicObject.Underline
GraphicObject.Underline is a read/write integer value. If the property value is true, the text is underlined. This property is valid for only text object variables. If this property is used on non-text objects, the current sub procedure stops executing.
Sample Code:
‘Make the text underlined
Txt.underline = True
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
22
FactoryLink 6.6.0 / Application Editor Guide / 297
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.LineColor
GraphicObject.LineColor is a read/write integer value used to set or retrieve the line color of a graphics object.
Sample Code:
‘Make the line color red
Box.linecolor = 0 ‘zero is red
The valid range of colors is 0 to 63, which corresponds to the color palette in the color dialogs in the Application Editor. Any value less than 0 or more than 63 is read as 0 or 63, respectively. These limits are the same for all …Color properties.
Pre-defined constants are available for the more common colors, so you need not reference them using their numbers. These constants are
• RED
• ORANGE
• YELLOW
• GREEN
• CYAN
• BLUE
• MAGENTA
• PURPLE
• BLACK
• GRAY (or GREY)
• SILVER
• WHITE
Any color property used with a composite object affects all of the child objects of the composite.
298 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.FillColor
GraphicObject.FillColor is a read/write integer value used to set or retrieve the fill color of a graphics object.
Sample Code:
‘Make the fill color white for the composite and all its ‘child objects
Comp.fillcolor = WHITE
If the object has bar animation or symbol animation, this property is read only. If it has paint animation, the attribute can be changed but is overwritten by the first paint animation color change. On objects with chart animation this property can be changed; but, as the trend line is redrawn, the original fill color is redrawn.
GraphicObject.BackColor
GraphicObject.BackColor is a read/write integer value used to set or retrieve the background color of a graphics object.
Sample Code:
‘Make the background color black
Box.backcolor = BLACK
22
FactoryLink 6.6.0 / Application Editor Guide / 299
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.TextColor
GraphicObject.TextColor is a read/write integer value used to set or retrieve the text color for a graphics object. This property is valid only for text object variables.
The current sub procedure stops executing if this property is used on non-text objects.
Sample Code:
‘If this script is attached to a text object, change the
‘object’s text color if this.type = FL_TEXT then this.textcolor = GREY else msgbox “Not a text object - can’t change text color” end if
If the text object has symbol animation, this property can be changed but the changes are not reflected on the screen.
GraphicObject.Name
GraphicObject.Name is a read-only string value used to retrieve the basic name of a graphic object.
Sample Code:
‘Let the user know this object’s name
MsgBox “Hi, I am object” & This.Name
300 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.Parent
GraphicObject.Parent is a read-only property used to reference the composite object to which the named object belongs. The parent object can be abbreviated as
.p in the code.
Sample Code:
Move composite object which contains the selected object to location mouseX, mouseY.
this.p.left = mouseX this.p.bottom = mouseY
Note: If the parent object is part of a composite object, this relationship is identified as .p.p in the code.
GraphicObject.BackgroundUpdate
GraphicObject.BackgroundUpdate is a read/write integer value used to set or retrieve the BackgroundUpdate flag value for a text graphics object with input text animation. If this property is set to true (non-zero), the object responds to background updates.
Sample Code:
‘Toggle background update setting if InputFld.BackgroundUpdate then
InputFld.BackgroundUpdate = false else
InputFld.BackgroundUpdate = true end if
22
FactoryLink 6.6.0 / Application Editor Guide / 301
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Properties
GraphicObject.ActionValue
GraphicObject.ActionValue is a read/write string value used to set or retrieve the value field for objects with button or function key animation. It is only valid for objects with these animation types. Function key animation is not attached to an object but rather directly to the drawing. To reference the property for function key animation, use the function name, entered during the animation configuration. If the object does not have button or function key animation, the current sub procedure will stop executing.
Note: Button or function key animation have either source value or a source tag. This field only returns the source value; the source tag can be handled via the normal tag functions.
Sample Code:
‘If an object has button animation with action set to DRW,
‘the actionvalue property can be changed to load different
‘drawings
\Button1.ActionValue = “RUNMGRS”
302 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Methods
G RAPHIC O BJECT M ETHODS
Graphic object methods are used to affect a particular graphics object during run time.
GraphicObject.Rotate
GraphicObject.Rotate is a subroutine used to rotate a graphics object around a specified point by a specified number of degrees.
Refer to Chapter 23, “Rotating Objects” for information about rotating graphic
objects.
Sample Code:
‘This RTDB event is triggered once per second private center_x as long, center_y as long sub Drawing_Object_onesecond
‘determine the center of the clock center_x = \Clock.left + (\Clock.width / 2) center_y = \Clock.bottom + (\Clock.height / 2)
‘move the second hand on the clock one second
6 degrees out of 360 degrees.
\SecondHand.rotate center_x, center_y, 6 end sub
‘forward, which is
Note: Rotating complex objects can be processor-intensive and may adversely affect system performance.
22
FactoryLink 6.6.0 / Application Editor Guide / 303
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Graphic Object Methods
GraphicObject.Reset
GraphicObject.Reset is a subroutine that returns a graphics object to its original state as it was drawn in the Application Editor. This undoes the effects of moving and rotating an object.
Sample Code:
‘move the box back to its starting position
Box.reset
GraphicObject.HasAnimation
GraphicObject.HasAnimation is an integer function used to show if a given graphics object has a certain type of animation. The return value is true
(non-zero) if the object has the type of animation passed as the argument to this function.
Use pre-defined constants as the argument to this function, such as
• FL_PAINT
• FL_BAR
• FL_SYMBOL
• FL_INPUT_TEXT
• FL_OUTPUT_TEXT
• FL_BUTTON
• FL_CHART
• FL_LEGEND
• FL_PEN
• FL_POWERVB
Sample Code:
‘Don’t try to set the ActionValue property of this
‘object unless it has button animation. Otherwise,
‘a run time error will occur.
if this.hasanimation (FL_BUTTON) then this.actionvalue = “ALOG” end if
304 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Drawing/Window Object Properties
D RAWING /W INDOW O BJECT P ROPERTIES
This section details when to use a drawing or window property in PowerVB code.
Drawing Object Variable
Because drawing objects cannot be selected as an object on the screen like a graphic object, a predefined variable called drawing is used to access the properties of the drawing the PowerVB code is attached to. These properties are specific to a drawing within one window and do not affect the same drawing when it is loaded in other windows.
The drawing variable is not available for code in PowerVB libraries; however, subroutines in PowerVB libraries can have a drawing variable passed to them as in the following example:
Sub ChangeColor (d as DrawingObject) d.BackColor = RED
End Sub
22
The window variable is also not available for code in PowerVB libraries except when explicitly passed as an argument, as shown in the following example.
Sub FormatWindowTitle (W as Window Object) w.Title = “FactoryLink” & w.Title
End Sub
Drawing.BackColor
Drawing.BackColor is a read/write integer property used to set or retrieve the background color of a drawing. The color value limits are 0 to 63 as in the
Application Editor and they work like the color values for graphic object color properties.
Sample Code:
‘set the drawing’s background to white
Drawing.backcolor = WHITE
FactoryLink 6.6.0 / Application Editor Guide / 305
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Drawing/Window Object Properties
Window Object Variable
The predefined variable window is used to access the properties of the window
PowerVB code is attached to, because window objects cannot be selected as an object on the screen like a graphic object.
The window variable is not available for code in PowerVB libraries except when explicitly passed as an argument, as in the following example:
Sub FormatWindowTitle (w as Window Object) w.Title = “FactoryLink” & w.Title
End Sub
Window.Title
Window.Title is a read/write string property used to set or retrieve the text in the title bar of the window.
Sample Code:
‘Change the title of the FL_MAIN window to “Main Window”
‘if this subroutine is running on a graphic object in a
‘drawing in the FL_MAIN window.
if Window.title = “FL_MAIN” then
Window.title = “Main Window” end if
306 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Miscellaneous Statements
M ISCELLANEOUS S TATEMENTS
Miscellaneous statements are not attached to variables but are used in PowerVB code to perform global actions.
Critical/EndCritical
Normally, FactoryLink allows several active event routines to run concurrently.
Refer to “Multi-threading” on page 359 for more information. Critical/EndCritical
is used to give one event subroutine the right to run uninterrupted by any other event routines. For example, one line from one event routine might run, followed by one line from a different routine, and so on unless the Critical statement is in effect.
When a Critical statement is issued in PowerVB code, only the statements from the current event routine runs. Lines from other event routines will not run until the EndCritical statement in the code is reached or until the event routine ends.
An EndCritical statement must be issued for every Critical statement in the subroutine or lines from other event routines will not run until the event routine ends.
Critical/EndCritical applies only to other PowerVB routines; other FactoryLink tasks or applications are not affected.
22
FactoryLink 6.6.0 / Application Editor Guide / 307
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Miscellaneous Statements
Sample Code: sub drawing_object_SomeTagEvent dim I as Integer
‘We want this section of code to run, and we don’t want
‘any other PowerVB code running while this code runs.
Critical
For I = 1 to 100
SomeTag = I * 1000
Next I
‘Now we want other PowerVB code to run
EndCritical
‘Again, only this part of the code should run
Critical set_another_tag ‘call subroutine defined below
For I = 1 to 1000
SomeOtherTag = I ** 2
Next I
‘I squared
‘Issuing the following EndCritical statement will NOT let
‘other PowerVB code run, because the set_another_tag
‘subroutine contains a Critical statement.
EndCritical
End Sub ‘The event is over; exclusive running ends.
Sub set_another_tag
Critical
Another_Tag.Value = 25
‘No End Critical to match the Critical
End Sub
308 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Miscellaneous Statements
LockRTDB/UnlockRTDB
Normally, FactoryLink allows several different tasks to read and write tag values to the RTDB at the same time. Use LockRTDB/UnlockRTDB statements to give one event routine exclusive access to the RTDB. When the LockRTDB statement is issued in PowerVB code, the routine used to issue the statement has exclusive access to the RTDB. Execution of other PowerVB code is suspended inside
LockRTDB/UnlockRTDB statements (same as Critical/EndCritical). Other tasks and other animation in Run-Time Graphics cannot read or write tags. This event routine has exclusive access to tags until the UnlockRTDB statement is reached or until the event routine ends.
An UnlockRTDB statement must be issued for every LockRTDB statement in the subroutine or the RTDB will be locked until the event routine ends.
Sample Code:
LockRTDB
Some_Tag = 20
UnlockRTDB
22
FactoryLink 6.6.0 / Application Editor Guide / 309
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Public Variables
P UBLIC V ARIABLES
Public variables, also referred to as global variables, are variables available to all
PowerVB scripts in an application. It is a good idea to avoid the use of public variables. Private variables together with access subroutines and functions usually suffice.
Sample Code:
Public SetVal As Integer
PowerVB Variables and FactoryLink Tag Types
PowerVB has several variable types that can represent the value property of certain FactoryLink tag types.
Table 22-0
PowerVB Variable Types
String
Boolean
Integer
Long
Double
FactoryLink Tag Types
Message
Digital
Analog
LongAnalog
Float
310 / FactoryLink 6.6.0 / Application Editor Guide
USING PROPERTIES AND METHODS IN POWERVB
Private Variables
P RIVATE V ARIABLES
Private variables are variables assigned exclusively within a graphic object or library script. Declare private variables in the beginning of the routine, as shown in the following subroutine:
Sample Code: private mbtn as graphicobject private mact as graphicobject private mact2 as graphicobject private mx as graphicobject private my as graphicobject sub mouse_rectangle1_DrawLoad set mbtn = Drawing.Child(“txtMouseButton”) set mact = Drawing.Child(“txtMouseAction”) set mact2 = Drawing.Child(“txtMouseAction2”) set mx = Drawing.Child(“txtMouseX”) set my = Drawing.Child(“txtMouseY”) mbtn.text
= " mact.text
= " mact2.text
= " mx.text
= "
"
"
"
" my.text
= " " drawing.c(“txtScrollValue”).text = “52” end sub
If the same variable name is used privately in multiple scripts, those variables are completely independent. If a script has a private variable with a name used in other scripts as a public variable, those variables are completely independent, and the script with the private variable cannot access the public variable with the same name.
Both public and private variables must be declared before they are referenced.
Refer to the PowerVB Language Reference Guide for more information on declaring variables.
22
FactoryLink 6.6.0 / Application Editor Guide / 311
•
•
•
•
USING PROPERTIES AND METHODS IN POWERVB
Private Variables
312 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 23
Rotating Objects
O VERVIEW
FactoryLink allows rotation of graphic objects during development time or run time. Run-time rotation can occur on the following types of graphic objects:
• Primitive objects
• Composites
• Sub-objects of composites
Text or objects containing text cannot be rotated. The following types of objects cannot be rotated and are considered illegal objects:
• Text objects
• Legend objects
• Objects with bar animation
• Objects with chart animation
• Objects with symbol animation
• Composite objects containing one or more of the above objects
Definitions
Primitive
Objects
Composite
Sub-objects
Original
Orientation
Current
Orientation
Rotation Angle
A single drawn object such as a polygon, line, box, ellipse, arc, parabola, or spline.
A container of primitive objects and/or other composites.
Either primitive objects or other composites inside a composite object.
The initial orientation of the object before rotation, translation, or scaling.
The orientation of an object or composite at the present time.
Pivot Point
The degree of rotation of an object relative to its current orientation.
The central point an object or composite is rotated about.
FactoryLink 6.6.0 / Application Editor Guide / 313
23
•
•
•
•
ROTATING OBJECTS
GraphicObject.Rotate
Legal Rotation
Object
Illegal Rotation
Object
A primitive object or composite not one of the illegal rotation objects previously listed.
Any object not a legal rotation object. The objects in this list.
G RAPHIC O BJECT .R
OTATE
The syntax for rotating an object at run time is as follows: objectname.rotate x, y, degrees where: x Horizontal center of rotation y Vertical center of rotation degrees Rotation amount
Specifying a positive value for degrees results in clockwise rotation; a negative value for degrees results in counter-clockwise rotation.
Rotation is cumulative, not absolute, which means a value of 30 for degrees does not necessarily rotate the object to 30 degrees. If the object has been rotated previously, this rotates the object an additional 30 degrees clockwise.
If a rotation amount greater than 360 degrees is given, it is divided by 360 and the remainder is used. For example, rotation amounts of 10 degrees and 370 degrees have the same result. To use an absolute value for rotation, use the Reset method prior to rotate. The following example illustrates how a line could be used as an analog meter: sub Drawing_Object_tempchange
’ Set this object back to original rotation
\Meter.Reset
’ Rotate this object to the degree value in
‘the tag temp_value
\Meter.Rotate x_pivot, y_pivot, temp_value end sub
314 / FactoryLink 6.6.0 / Application Editor Guide
ROTATING OBJECTS
Implementing Rotation in PowerVB
I MPLEMENTING R OTATION IN P OWER VB
Perform the following steps to implement rotation in PowerVB:
1 Create an object in the Application Editor.
2 Select the object.
3 Open the PowerVB animation editor.
4 Enter the necessary PowerVB code to rotate the object. The following example rotates the graphic object 180 degrees clockwise in 20-degree increments and then back to the original orientation:
Private x_pivot As Integer, y_pivot As Integer sub Drawing_Object_DrawLoad
’ Determine the center of the object x_pivot = this.left + (this.width / 2) y_pivot = this.bottom + (this.height / 2) end sub sub Drawing_Object_Click(Button As Integer, X As Long,_
Y As Long) dim i as Integer
‘Rotate 180 degrees clockwise at 20 degree increment
For i = 1 to 9 this.rotate x_pivot, y_pivot, 20
Next i
‘Rotate 180 degrees counter-clockwise in 20 degree increment
For i = 1 to 9 this.rotate x_pivot, y_pivot, -20
Next i end sub
23
The smoothness of object rotation depends on the rotation angle and the system hardware. A small rotation angle makes the rotation appear smooth but may be slower and more processor intensive.
5 Choose File>Validate to test the script. A message displays if the script is executable.
FactoryLink 6.6.0 / Application Editor Guide / 315
•
•
•
•
ROTATING OBJECTS
Implementing Rotation in PowerVB
6 Choose File>Save to save the script.
7 Run the application to test the animation. An error message is displayed if the object, sub-object, or composite is not legal for rotation.
The bounding box changes sizes for an object as it is rotated. This could make the object rotate and move around on the screen simultaneously. To prevent this, calculate the pivot point once as in the following DrawLoad event example instead of in the event that triggers the rotation.
Sample Code:
‘Use this code –
Private x_pivot As Integer, y_pivot As Integer sub Drawing_Object_DrawLoad x_pivot = this.left + (this.width / 2) y_pivot = this.bottom + (this.height / 2) end sub sub Drawing_Object_Click(Button As Integer, X As Long, Y_
As Long) this.rotate x_pivot, y_pivot, 20 end sub
‘Instead of this – sub Drawing_Object_Click(Button As Integer, X As Long, Y_
As Long) x_pivot = this.left + (this.width / 2) y_pivot = this.bottom + (this.height / 2) this.rotate x_pivot, y_pivot, 20 end sub
316 / FactoryLink 6.6.0 / Application Editor Guide
ROTATING OBJECTS
Implementing Rotation in PowerVB
Calculate the rotation point of an object based on another object. For example, to create a clock, draw a circle for the clock face and a line for a second hand and rotate the second hand about the center of the clock face:
Private x_pivot As Integer, y_pivot As Integer sub Drawing_Object_DrawLoad
’ Determine the center of the circle Clockface x_pivot = \ClockFace.left + (\ClockFace.width / 2) y_pivot = \ClockFace.bottom + (\ClockFace.height / 2) end sub sub Drawing_Object_onesecondevent this.rotate x_pivot, y_pivot, 6 end sub
Composite Object Rotation
Composite graphic objects can be rotated only if all of their child objects are legal rotation objects.
Sub-object Rotation
PowerVB subroutines can be attached to sub-objects inside a composite or inside another sub-object. Multiple rotations utilizing objects, sub-objects, and composites can occur in any order.
Rotating large or complex objects might have adverse affects on system performance.
RedrawOn/RedrawOff
Use RedrawOff/RedrawOn statements to make object movement appear smoother
if several objects are being rotated. Refer to “RedrawOn and RedrawOff” on page
23
FactoryLink 6.6.0 / Application Editor Guide / 317
•
•
•
•
ROTATING OBJECTS
Development Rotation
D EVELOPMENT R OTATION
Objects can be rotated in 90-degree clockwise increments during development time in the Application Editor.
Perform the following steps to rotate an object during development time:
1 Create an object, sub-object, or composite in the Application Editor or open an existing object.
2 Select the object, sub-object, or composite to be rotated.
3 Rotate the selected object using one of the following methods:
• Press Ctrl-R
• Choose Edit>Rotate
• Click on the rotate icon on the toolbar
If the selected object is a legal rotation object, it rotates clockwise by 90 degrees; otherwise, an error message displays. To rotate an object more than 90 degrees, repeat this step until the object is rotated to the desired orientation.
The pivot point for development rotation is the center of the object bounding box.
318 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 24
PowerVB User-Defined
Sub Procedures and
Functions
Event sub procedures are the backbone of any PowerVB application; however,
PowerVB also allows you to create sub procedures and functions. These user-defined sub procedures and functions must be called from an event procedure to get executed. This chapter outlines the syntax and provides examples of user-defined sub procedures and functions.
S UB P ROCEDURES
The following sub procedure takes a Single and a GraphicObject as parameters. It examines the Single parameter and sets the graphic object color:
Sub SetColor (Temperature As RTDBObject, Gobject as GraphicObject)
Select Case Temperature.Value
Case 0 to 100
Gobject.FillColor = GREEN
Case 101 to 200
Gobject.FillColor = BLUE
Case 201 to 300
Gobject.FillColor = YELLOW
End Select
End Sub
The syntax to call this sub procedure is
Call SetColor(temp,\STATUSCIRCLE) or
SetColor temp,\STATUSCIRCLE
The variables must have the same type as the procedure definition.
The sub procedure must be declared if the sub procedure is called before it has been defined. The declaration for the preceding sub procedure is
Declare Sub SetColor(X as RTDBObject, Y as GraphicObject)
24
FactoryLink 6.6.0 / Application Editor Guide / 319
•
•
•
•
POWERVB USER-DEFINED SUB PROCEDURES AND FUNCTIONS
Functions
F UNCTIONS
A function generally does not execute operations on your data. It returns a value based on the data without changing the data.
After creating a function, it is used like a built-in PowerVB function. Functions you create are called user-defined functions. User-defined functions, like procedures, allow you to create functions that operate according to the needs of the application but which can be used throughout the code just like built-in functions.
For example, in a point-of-sale application, a script can compute a standard discount based on price. Any item priced under ten dollars is not discounted, anything priced between ten and twenty dollars is discounted ten percent, items priced between twenty and fifty dollars are discounted fifteen percent, and anything priced over fifty dollars is discounted twenty-five percent. The function could be as follows:
Function ComputeDiscountedPrice (FullPrice As Currency) As Currency if FullPrice < 10.00 then
ComputeDiscountedPrice = FullPrice elseif FullPrice < 20.00 then
ComputeDiscountedPrice = FullPrice * .9
elseif FullPrice < 50.00 then
ComputeDiscountedPrice = FullPrice * .85
else
ComputeDiscountedPrice = FullPrice * .75
endif end Function
To compute a discounted price, use the function with an assignment statement , such as:
Price = ComputeDiscountedPrice (FullPrice)
A value can be returned from a function by assigning the variable that holds the value to the name of the function (as previously shown). It is not necessary to declare the function name as a variable because this has already been done in the function declaration.
The end of the function declaration indicates the function’s return-type. The example above returns a Currency value. If a return-type is not specified, the function returns a Variant value. If this value is assigned to a variable, it is converted to the type of the variable.
320 / FactoryLink 6.6.0 / Application Editor Guide
POWERVB USER-DEFINED SUB PROCEDURES AND FUNCTIONS
Functions
Most functions have parameters because they need some data to evaluate. Unlike sub procedures, function parameters must be placed in parentheses when calling the function. A function can also read the data it needs from a form, for example:
Function ComputeDiscountedPrice () As Currency dim FullPrice As Currency
FullPrice = Val(frmMain.txtFullPrice.Text) if FullPrice < 10.00 then
ComputeDiscountedPrice = FullPrice elseif FullPrice < 20.00 then
ComputeDiscountedPrice = FullPrice * .9
elseif FullPrice < 50.00 then else
ComputeDiscountedPrice = FullPrice * .85
ComputeDiscountedPrice = FullPrice * .75
endif end Function
The original example, which receives data as a parameter, can be used from any form and re-used in other applications. Because this example ties the function to the form to read the data it is not as flexible as the original example which gets the data as a parameter. This example could be used with a form called frmMain , which must contain a text box called txtFullPrice .
Of course, to use the function from any form in the application, you must create the function in a code module rather than in a form’s general code section.
However, if you are certain the function will only be called from one form, you can create the function in that form’s code window.
For a complete listing of the built-in functions available with PowerVB, refer to the PowerVB Language Reference Guide.
24
FactoryLink 6.6.0 / Application Editor Guide / 321
•
•
•
•
POWERVB USER-DEFINED SUB PROCEDURES AND FUNCTIONS
Functions
322 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 25
Creating PowerVB
Libraries and
Templates
P OWER VB L IBRARIES
A PowerVB Library, comparable to a module in Microsoft Visual Basic
®
, is used to store PowerVB functions and/or subroutines that may be called from a PowerVB script attached to any graphic object within the application. Libraries are used to store simple calculations and basic subroutines that are used many times throughout several applications. Library scripts can also contain their own private variables.
Library routines are loaded at run-time when the application starts. Libraries are accessible from any script on any object on any drawing; however, drawings are not directly accessible from a library.
As with drawings, libraries can be exported from one application and imported into another. To open an existing PowerVB library not created in the current application, it must first be imported — choose File>Import and then choose file type Exported Libraries (*.plx) .
25
FactoryLink 6.6.0 / Application Editor Guide / 323
•
•
•
•
CREATING POWERVB LIBRARIES AND TEMPLATES
PowerVB Libraries
Creating a PowerVB Library
The following procedure outlines how to create a PowerVB library. Refer to the other PowerVB chapters and to the PowerVB Language Reference Guide for more specific information on syntax, commands, and variables.
1 Choose File>Open PowerVB Library from the Application Editor to display a window with the names of all accessible libraries. The Open PowerVB Library dialog displays.
324 / FactoryLink 6.6.0 / Application Editor Guide
CREATING POWERVB LIBRARIES AND TEMPLATES
PowerVB Libraries
2 Enter the name of the new library and choose Open to display the PowerVB library editor.
25
3 Enter the PowerVB variables, subroutines, or functions to be included in the library.
Unlike event routines, beginning and ending statements for functions and subroutines must be manually entered in libraries. Verify each statement has a matching end statement.
For example, to implement a function to convert Fahrenheit temperatures to
Celsius in a library, enter the following code:
Function FtoC (Fdegrees as Integer) As Integer
‘Convert Fahrenheit to Celsius
FtoC = (Fdegrees - 32) * 5/9
End Function
FactoryLink 6.6.0 / Application Editor Guide / 325
•
•
•
•
CREATING POWERVB LIBRARIES AND TEMPLATES
PowerVB Libraries
4 Choose File>Validate from the PowerVB library editor. A message displays if a syntax error is detected.
5 Choose File>Save .
Using the PowerVB Library Editor
The PowerVB library editor works very much like the PowerVB Animation Editor.
The main differences are in the options on the menu bar. The File Menu has an extra option and the Event menu does not exist because event routines cannot be defined in a PowerVB library.
An additional option in the File menu is Save As. Also, the Save option works differently. Since a PowerVB library is held in a separate file, Save writes the
PowerVB code to the file as opposed to putting the code into a drawing when editing graphic object PowerVB animation. The Save As option brings up a File
Save dialog similar to the one used for exporting text from the PowerVB editor. A separate copy of a PowerVB library can be created under a new name using this option.
Calling a Library Function or Subroutine
To use a library function or subroutine in an object’s event routine, first declare it in the object script outside of an event subroutine; then it can be used anywhere in the object code. The function or subroutine must be declared in each script it is referenced in.
The only difference between a function and a subroutine is a function returns a value and a subroutine does not. Both functions and subroutines can pass arguments when the function or subroutine is called. See the PowerVB Language
Reference Guide for more information on defining and calling functions and subroutines.
326 / FactoryLink 6.6.0 / Application Editor Guide
CREATING POWERVB LIBRARIES AND TEMPLATES
PowerVB Libraries
For example, if the following function and subroutine are in an existing library,
Function FtoC (Fdegrees As Integer) As Integer
’ Convert fahrenheit to celsius
FtoC = (Fdegrees - 32) * 5/9
End Function
Sub SetAlarmTrigger
‘ Set a digital tag that has been configured as
‘ an alarm trigger
AlarmTrig.Force 1
End Sub they could be called from an object script as follows:
Declare Function FtoC(FDegrees As Integer) As Integer
Declare Sub SetAlarmTrigger ( ) sub drawing_object_Click(Button As Integer, X As_ Long, Y As Long)
\txtCelsiusTemp.text = str$(FtoC(intFahrenheitTemp))
If \txtCelsiusTemp.text > 100 then
SetAlarmTrigger
End If end sub
25
FactoryLink 6.6.0 / Application Editor Guide / 327
•
•
•
•
CREATING POWERVB LIBRARIES AND TEMPLATES
PowerVB Templates
P OWER VB T EMPLATES
When creating PowerVB code for an object in a Power Pack, templates can be used as placeholders for specific values provided when the object is pasted into a drawing. Common code can also be set up for use as a template. This is helpful when attaching code to an object that will be used in several different applications because the code can be copied and pasted with the object.
Templates are applicable in PowerVB code or in a tag event trigger list. The format for a template variable in PowerVB is the same as with other types of animation ( {variablename} ).
Template Variables
As with other types of animation, the same template variable can be used multiple times within an object animation. For example, if the template variable {alarmtag} is used in paint animation, it can also be used in a tag event trigger list.
Note: Template variables cannot be used in PowerVB libraries.
Template Variables in Tag Event Definitions
When defining a tag event, specify one or more template variables in the tag list instead of tags. When the object code is saved, you are prompted to define the template variables. When the object containing the tag event is pasted, you are prompted to enter values for the template variables. If values entered for the template variables are not valid tags, they are ignored.
Template variables in PowerVB Code
Sample Code: sub Drawing_Object_Click(Button As Integer, X As Long,_ Y As Long) this.fillcolor = {newcolor} end sub
If a template variable is specified in PowerVB code, you are prompted to define the template variables when the code is saved.
When an object containing the code is pasted, you are prompted to enter values for the template variables.
Template variables in PowerVB code are always displayed as variable names.
Choose Animation>Template to view the values of template variables.
The maximum length of a template variable name is 30 characters.
328 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 26
Hierarchical Graphic
Object Naming
26
O VERVIEW
Since graphic objects can be combined to create new objects, all objects in the
Application Editor are part of a hierarchical graphic object naming system. Each object has an assigned ID and name.
An object is a parent, child, or sibling, depending on its relationship to other objects. Definitions of these three types of objects are
Parent A composite object.
Child
Siblings
An object that is part of a composite; sub-object; a composite object.
Objects at the same hierarchical level.
Object names do not change unless the object is pasted into a drawing that has a top-level object with the same name as the object in the paste buffer or unless the user changes the name in the Application Editor (CTRL-N).
O BJECT N AMES
As discussed earlier, FactoryLink assigns objects with a default name in the form of hxxxx where the x ’s are a number assigned to the object. Object names can be changed using the Attributes>Object Name menu or by pressing CTRL+N and entering the new object name. FactoryLink changes an object name if it is pasted into another drawing that has an object by the same name at the same level. The object IDs, as mentioned earlier, cannot be changed.
An understanding of the Object Name and Object ID is important because an
Object Name can be used in the body of the PowerVB code while the Object ID is used to generate.
FactoryLink 6.6.0 / Application Editor Guide / 329
•
•
•
•
HIERARCHICAL GRAPHIC OBJECT NAMING
Graphical Object Hierarchy
Naming Objects in the Application Editor
Specify the following information to name an object in the Application Editor:
1 Create an object in the Application Editor or open an existing drawing containing the object to be named.
2 Select the object to be named.
3 Choose Attributes > Object Name .
4 Name the object and click on
OK
to accept the new name.
This is the object’s ID.
G RAPHICAL O BJECT H IERARCHY
All the graphic objects in a drawing form an object hierarchy with the drawing at the top of the hierarchy and the rest of the objects falling somewhere below the top; therefore, all objects have a parent. Objects contained in a composite object have the composite as a parent; objects that are not members of a composite have the drawing as their parent. All references to an object depend upon where the code using the reference resides in the hierarchy as well.
The MS-DOS file structure uses a similar hierarchy with the root directory being at the top and all other files falling somewhere below. All files have a parent directory, either the root directory or a sub directory. If you think of directories as composite files, it is easy to see how referring to a graphical object is similar to referring to a file in DOS.
330 / FactoryLink 6.6.0 / Application Editor Guide
HIERARCHICAL GRAPHIC OBJECT NAMING
Referencing Graphic Objects in PowerVB Scripts
R EFERENCING G RAPHIC O BJECTS IN P OWER VB S CRIPTS
Implicit Referencing
Refer to an object in the context of the current object (object this script is attached to) or in its context as a descendant of the drawing top level when referencing it in a PowerVB script. The following diagram illustrates this concept.
26
Drawing
Object1 Object2 Object3
ObjectA ObjectB ObjectC ObjectD ObjectA ObjectB
• Object2 is a parent to ObjectC and ObjectD.
• ObjectC and ObjectD are child objects of Object2.
• Object1, Object2, and Object3 are siblings. ObjectA and ObjectB are siblings, but ObjectA is not a sibling to Object1.
All objects are descendants of the drawing. Object1, Object2, and Object3 are composite objects each with two sub-objects. Both Object1 and Object3 have child objects named ObjectA and ObjectB (names of sub-objects must be unique only to the parent object, not the drawing).
If ObjectC were a composite object, it would be a parent relative to its child objects but a child relative to Object2.
Syntax
Syntax is important when referencing an object in PowerVB code because it tells
PowerVB the path to the object. The correct syntax for referencing objects is:
• .. — move one level up the hierarchy
• \ — separator for object names
FactoryLink 6.6.0 / Application Editor Guide / 331
•
•
•
•
HIERARCHICAL GRAPHIC OBJECT NAMING
Referencing Graphic Objects in PowerVB Scripts
The following code samples illustrate changing the fillcolor property of an object from another object code in the context of the previous diagram. The same syntax is applicable to read or write other object properties.
Code in Object1:
‘Declare an object variable for a sibling dim g as GraphicObject set g=..\Object2
‘Declare an object variable for a child dim g as GraphicObject set g=ObjectA
‘Declare an object variable for a child of a sibling dim g as GraphicObject set g=..\Object2\ObjectC
‘Reference a property of a child
ObjectA.FillColor=20
‘Reference a property of a top-level object (child of
‘a drawing)
\Object3.FillColor=20
‘Reference a property of a parent
...FillColor=20
‘Reference a property of a child of a sibling
..\Object2\ObjectC.FillColor=20
Code in ObjectA (sub-object of Object1):
‘Declare an object variable for a sibling dim g as Graphic Object set g=..\ObjectB
‘Declare an object variable for a parent dim g as GraphicObject set g=..
‘Reference a property of a parent (Object1)
...FillColor=20
It is better to use the keyword this instead of the specific object name if referencing the current object in a script.
332 / FactoryLink 6.6.0 / Application Editor Guide
HIERARCHICAL GRAPHIC OBJECT NAMING
Referencing Graphic Objects in PowerVB Scripts
Explicit Referencing
This alternate method of referencing objects requires more typing than the previous method but provides the ability to use string variables to specify object names. Since the string variables can be generated in code, any errors in object names are not detected until run time.
Sample Code:
‘In a script for a composite object that has child
‘objects Object1, Object2, Object3, Object4, and
‘Object5 dim i as Integer
For i = 1 to 5
' Change child object fillcolors this.c("Object" & trim(str$(i))).fillcolor = i
Next i
26
FactoryLink 6.6.0 / Application Editor Guide / 333
•
•
•
•
HIERARCHICAL GRAPHIC OBJECT NAMING
Referencing Graphic Objects in PowerVB Scripts
Syntax for Explicit Referencing Method:
.
Separator for parent/child references
P (or Parent) Move one level up the hierarchy (note that the object name is not specified for the parent since an object only has one parent)
C (or Child) Move one level down the hierarchy (note that the object name must be specified for the child since an object could have several children)
Code in Object1: drawing.c("Object2").c("ObjectC").FillColor = BLUE this.c("ObjectA").fillcolor = BLUE
Code in ObjectA (sub-object of Object1): this.p.Fillcolor = BLUE ’change fillcolor of Object1 drawing.c("Object3").c("ObjectB").Fillcolor = BLUE
‘same as
..\..\Object3\ObjectB.Fillcolor = BLUE
Graphic object references must begin with drawing or this or some explicit graphic object variable when using the alternate method.
334 / FactoryLink 6.6.0 / Application Editor Guide
HIERARCHICAL GRAPHIC OBJECT NAMING
Referencing Graphic Objects in PowerVB Scripts
The following table includes examples of correct hierarchical object naming in
PowerVB.
Table 26-0 Hierarchical Object Names
Object Hierarchical Syntax dim g as GraphicObject set g = ..\shadow myComp\ell3.FillColor = 21
Comment to Explain Hierarchy
‘This has a sibling named
‘shadow.
J% = ..\..\c1\c2\b3.Height
\topComp\twirly.reset
kiddo.rotate 6000 7000 15
‘This is a composite, with a
‘composite child named myComp.
‘myComp has a child named ell3.
‘This has a composite parent
‘who has a composite sibling
‘named c1. c1 has a composite
‘child named c2, and c2 has a
‘child named b3.
‘topComp is a top-level
‘composite, with a child named
‘twirly.
‘this is a composite, with a
‘child named kiddo.
\TopObj or ..\brother cannot be used in PowerVB libraries; however, graphic objects and drawing objects can be passed into library routines and used with the explicit method using .parent
and .child
. For example, the following PowerVB library subroutine could manipulate a child object of the given drawing:
Sub MakeObjectRed (dwg as DrawingObject, name as string) dwg.child(name).fillcolor = RED
End Sub
This library function is called from an object’s script with the following:
MakeObjectRed (drawing, “TopLevelObject”)
26
FactoryLink 6.6.0 / Application Editor Guide / 335
•
•
•
•
HIERARCHICAL GRAPHIC OBJECT NAMING
Performance Considerations
P ERFORMANCE C ONSIDERATIONS
Hierarchical graphic object names must be bound to objects on the drawing at run time. This binding takes some time. Knowing this, performance of some operations can be improved, as illustrated in the following example:
‘Slower for i% = 1 to 500
\obj1\obj2\obj3.left = \obj1\obj2\obj3.left + 10 next i%
‘Faster dim obj as GraphicObject set obj = \obj1\obj2\obj3 for i% = 1 to 500 obj.left = obj.left + 10 next i%
336 / FactoryLink 6.6.0 / Application Editor Guide
HIERARCHICAL GRAPHIC OBJECT NAMING
Object IDs
O BJECT ID S
Each object is assigned an ID when it is created. Object IDs are unique within a drawing and you cannot change them. Unlike object names, new object IDs are always assigned when an object is pasted. Event subroutine names in the pasted object are automatically updated with the new object ID. Object IDs are used in the names instead of object names to keep event routines names unique throughout a drawing. This is the only place PowerVB uses object IDs.
Finding an Object
Within a Script
Search for either ID in an event name, object name, or any other text using the text searching capabilities in the PowerVB animation editor.
Note: Remember that object IDs are only used in event routine names. All other references to objects are by their names.
Within a Cross Reference
The cross-reference list is used only for finding references to tags (RTDB elements). Search for the object ID, not its name, to find where tags are used in
PowerVB tag event trigger lists or PowerVB code.
Within a Drawing
Choose Edit > Find in the Application Editor to display a list of all object IDs and go to a specific object based on its ID. Use Find by Name to find the first object having a given name and then use Find Next to find other objects on the drawing with the same name.
Note: PowerVB does not allow you to change an object ID.
26
FactoryLink 6.6.0 / Application Editor Guide / 337
•
•
•
•
HIERARCHICAL GRAPHIC OBJECT NAMING
Object IDs
338 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 27
Debugging a PowerVB
Script
27
R EVIEWING P RINTED P OWER VB C ODE
Two ways to review PowerVB code in printed form are
• Use the Document PowerVB menu option in the Application Editor
• Print a single script or part of a single script
D OCUMENT P OWER VB
The Document PowerVB command writes a text file to show the PowerVB code for all objects in a drawing. Choose File>Document PowerVB in the Application Editor to create a text file listing the following information:
• All of the objects in the current drawing that have PowerVB animation defined
• The event subroutines defined for each object
• Trigger tags for tag events
• Other types of animation defined for each object
• All of the variables and/or tags referenced in each object code
• Listing of code by object with line numbers
This text file is named drawingname.src
and is saved in the FLAPP\USER\DRW directory. A window is displayed to confirm the name and location of the file.
Note: The Document PowerVB report is export only—it cannot be edited and imported back into an application.
FactoryLink 6.6.0 / Application Editor Guide / 339
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Printing a Single Script or Part of a Single Script
The Document PowerVB report does not include routines in libraries. Choose
File>Export on the PowerVB animation editor after opening the library to create a listing of the code in a library.
Highlight the desired code and choose File>Export in the PowerVB animation editor to create a text file listing all or part of the code in an object.
The Document PowerVB report and exported code listings are in ASCII text format and can be viewed and printed from any text editor.
P RINTING A S INGLE S CRIPT OR P ART OF A S INGLE S CRIPT
1 Select the text to be printed.
2 Choose File>Export to export the file to a text file with a name you specify.
3 Open the file through a text editor.
4 Print the code.
O THER D EBUGGING M ETHODS
Several tools are available to assist with resolving problems in PowerVB code:
• Error message box
• Handling run-time errors with the On Error statement
• Using Print statements
340 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Error Message Box
E RROR M ESSAGE B OX
Use a message box to show the values of variables at run time. Be sure to remove or comment out any message boxes added for debugging purposes before implementing the application.
Sample Code:
Global Setting1, Setting2 As Integer sub Drawing_Object_Click(Button As Integer, X As Long, Y As Long)
If Setting1 > 50 then
Setting2 = 100
End If
MsgBox “Setting1: “ & str$(Setting1) & “Setting2: “ &_ str$(Setting2) end sub
27
Message boxes are system-modal. When a message box displays, other
FactoryLink tasks, including run-time graphics, are suspended until the message box is dismissed. Be careful when using message boxes in applications that run unattended.
Message boxes are only available on Windows NT, Windows 95, and OS/2 platforms. Refer to the PowerVB Language Reference Guide for more information on the Msgbox statement.
Variations on this method include:
• Writing this data to the Window.Title
instead of a message box
• Writing this data to a message tag and adding this tag to a Watch List in
Run-Time Monitor
• Creating a temporary text field on a drawing and write status information in the text field
FactoryLink 6.6.0 / Application Editor Guide / 341
•
•
•
•
DEBUGGING A POWERVB SCRIPT
On Error Statement at Run Time
O N E RROR S TATEMENT AT R UN T IME
Trap run-time errors using the On Error and Resume BASIC statements. The following example shows the basics of using these statements:
Sub SomeDrawing_SomeObjectID_Click(Button As Integer, X_
As Long, Y As Long)
On Error Goto Error_Handler_Section
’ regular code goes here
Exit Sub
Error_Handler_Section:
’Handle the error however you like. You can "Resume Next"
‘to continue working or "Exit Sub" to stop the event or do
‘something else...
End Sub
Refer to the PowerVB Language Reference Guide for a detailed explanation of run-time error trapping with the On Error and Resume statements.
If run-time errors are not trapped in code with the On Error statement, PowerVB detects these errors. When PowerVB detects a run-time error, it stops the event routine the error occurred in and displays a message box listing the details of the error. This message box is modal. Unless someone is monitoring the application, it could wait a long time for a response to this message box. So, by trapping these errors yourself, you control whether the event routine continues or not. You also control where error information is logged so users of the application are not presented with cryptic error information they do not understand. The application is not hung up waiting for you to respond to the error.
342 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using Print Statements
U SING P RINT S TATEMENTS
Overview
The Print statement in the PowerVB version of BASIC prints to a file named vbdebug.log
. Use the Print statement to provide primitive debugging capabilities for a FactoryLink application and for putting Print statements in an application that prints information at run time about the current state of the application.
Using the BASIC Print Statement
The syntax of the Print statement is
Print [[{Spc(n) | Tab(n)}][expressionlist][{; | ,}]]
Output from the Print statement is sent to the vbdebug.log
file.
Table 27-0 Data Output Formats
Data Type Description
String
Boolean
Date
Printed in its literal form, with no enclosing quotes.
Any numeric type Printed with an initial space reserved for the sign. If the number is positive, a space is left before the digits of the number. If the number is negative, a negative sign is printed before the digits of the number. Also, a space is printed after each number.
Printed as True or False.
Printed using the short date format. If either the date or time component is missing, only the provided portion is printed. This is consistent with the general date format used by the Format and Format$ functions.
Empty
Null
User-defined errors
Nothing is printed.
Prints Null.
Printed as Error <code>, where <code> is the value of the user-defined error. The word Error is not translated.
27
FactoryLink 6.6.0 / Application Editor Guide / 343
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Each expression in expressionlist is separated with either a comma or a semicolon.
A comma means the next expression is output in the next print zone. A semicolon means the next expression is output immediately after the current expression.
Print zones are defined every 14 spaces.
If the last expression in the list is not followed by a comma or a semicolon, a carriage return is printed to the file. The next Print statement outputs information on the next line of the file.
If the last expression ends with a semicolon, no carriage return is printed. The next Print statement outputs information immediately following the expression on the same line of the file.
If the last expression in the list ends with a comma, the next Print statement outputs information at the start of the next print zone on the current line.
The Tab and Spc functions provide additional control over the column position.
The Tab function moves the output position to the specified column. The Spc function outputs the specified number of spaces. Refer to the PowerVB Language
Reference Guide for more information on the Print, Tab, and Spc functions.
344 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Examples of Print Statements and the Output Generated
The following examples illustrate the output for the vbdebug.log
file for several different print statements in PowerVB code:
Statement:
Print “Hello”; “world”
Output:
Helloworld
Statement:
Print “Hello”, “world”
Output:
Hello world
Statement:
Print “The value of i=”;i%,”The value of s=”;s$
Output:
The value of i= 10 The value of s=This is a test.
27
FactoryLink 6.6.0 / Application Editor Guide / 345
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Statement:
Print i%,,s$
Output
20 This is a test too.
Statement:
Print i%; Spc(10); s$
Output:
30 Testing...
Statement:
Print i%; Tab(30); s$
Print i%; Tab(10); j%; Tab(30); s$
Output:
50
50 500
PowerVB
PowerVB
Statement:
Print i%; s$,
Print 67;
Print "Goodbye"
Output:
-1001 computer 67 Goodbye
346 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Print Statements with Multiple Running Events
PowerVB code for two or more PowerVB-animated graphic objects can run at the same time. For example, suppose two box objects on a drawing both have tag events triggered by the same tag. When the tag value changes, the tag subroutines for both boxes start running at approximately the same time. This has an impact on the Print statement. If two or more PowerVB subroutines execute a Print statement at about the same time, the output from the Print statements are not normally intermingled.
For example, suppose object box1 has the following event routine triggered by changes in the A_SEC tag: sub Drawing_1001_ASecChanged print “ABCDEFG” end sub
Also, suppose object box2 has the following event routine also triggered by
A_SEC.
sub Drawing_1003_ASecChanged print “TUVWXYZ” end sub
If both of these event routines run at the same time, the output to vbdebug.log
could be
ABCDEFG
TUVWXYZ or it could be
TUVWXYZ
ABCDEFG but it could not be this
ABCTUVDEFWGXYZ
27
FactoryLink 6.6.0 / Application Editor Guide / 347
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using Print Statements
In one circumstance the Print statement output from two or more routines can intermingle on the same line in vbdebug.log
: when one or more of the Print statements ends with a comma or semicolon that tells PowerVB to start printing the output of the next Print statement on the same line.
For example, if you change the previous box1’s tag event code to the following: sub Drawing_1001_ASecChanged
’ end the following Print statement with a semicolon so the
’ next print statement prints on the same line print "ABCDEFG("; print “)HIJKLMNOP” end sub the output to vbdebug.log
could be
ABCDEFG()HIJKLMNOP
TUVWXYZ or it could be
TUVWXYZ
ABCDEFG()HIJKLMNOP or it could be
ABCDEFG(TUVWXYZ
)HIJKLMNOP
The output from the two Print statements running at the same time can only intermingle at the position where the comma or semicolon occurs. For example, the output from the previous sample code could not be
ABCDEFG()HIJKTUVWXYZLMNOP because the two Print statements in box1 tag event code are separated between
ABCDEFG and HIJKLMNOP .
348 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Use Critical and EndCritical statements to prevent intermingling and still use
Print statements ending with a comma or semicolon. For example, if you wrap box1 tag event Print statements from the previous example with Critical and
EndCritical statements as follows, sub Drawing_1001_ASecChanged
’ end the following Print statement with a semicolon so the
’ next print statement prints on the same line.
By
’ enclosing the two Print statements in
’ Critical/EndCritical statements,
’ no intermingling of output can occur.
Critical print “ABCDEFG”; print “HIJKLMNOP”
EndCritical end sub no intermingling can occur. The output from this tag event routine’s Print statements would always occur on the same line with no other Print statement output between these statements’ output. Recall that the Critical and EndCritical statements tell PowerVB that the code between them must be allowed to run without being interrupted by code from any other event routines.
27
FactoryLink 6.6.0 / Application Editor Guide / 349
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using Print Statements
Header Information In Debug Output File
Every time FactoryLink application executes its first Print statement, header information is appended to the vbdebug.log
file. This information shows where each separate run of the application occurs. The information written in each header section includes a row of asterisks to visually separate output from different application runs and the date and time. For example, a header section might look like the following: output from previous run of FactoryLink application
****************************************************************
Logging session started: Sun Jan 14 13:09:38 1996 output from new run of FactoryLink application
Location of Debug Output File
As stated earlier, the output from the Print statements goes to a file named vbdebug.log
. The location path of this file is
{FLAPP}\{FLNAME}\{FLDOMAIN}\{FLUSER}\log\vbdebug.log
The {FL...} portions of this path are environment variables defined for every
FactoryLink application. For example, suppose a FactoryLink application is in directory C:\ECS\APPS , the FLAPP value. Suppose the values of FLNAME,
FLDOMAIN, and FLUSER are FLAPP1 , USER , and JOHN , respectively. In this case, the full path to the vbdebug.log
file is
C:\ecs\apps\flapp1\user\john\log\vbdebug.log
If a different user named SALLY used the same application, thus changing
FLUSER to SALLY, this user’s vbdebug.log file would be in the following path:
C:\ecs\apps\flapp1\user\sally\log\vbdebug.log
Including the domain FLDOMAIN in the path allows different vbdebug.log
files for graph to be running in different domains. Including the user name FLUSER in the path lets different users of the same application have different vbdebug.log
files.
350 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using Print Statements
If one of the environment variables used to create the path to the vbdebug.log
file does not exist, trying to use the Print statement in PowerVB code causes a run-time error. The exception to this rule is if the FLUSER environment variable is not defined, a default value of shared is used in its place.
Disabling Debug Output
Once the PowerVB code in the application is debugged, the Print statement output may no longer need to go to the vbdebug.log
file. PowerVB has a way to turn off the output of Print statements so they can remain in the code and dormant debugging is not necessary. Two global tags are defined for every
FactoryLink application. Their names are VBLOGDISABLE_S and
VBLOGDISABLE_U. Their default values are zero. When VBLOGDISABLE_S is set to one, Print statement output for graph running in the SHARED domain is disabled. Nothing will go to the vbdebug.log
file. When graph is running in the
USER domain, setting VBLOGDISABLE_U to 1 disables Print statement output to vbdebug.log
. For example, suppose the following code is executed by graph running in the USER domain:
VBLOGDISABLE_U.Value = 0 ’turn on output
Print “Line 1"
VBLOGDISABLE_U.Value = 1 'turn off output
Print “Line 2"
VBLOGDISABLE_U.Value = 0 'turn on output
Print “Line 3"
The output from this PowerVB code to vbdebug.log
is
Line 1
Line 3
27
FactoryLink 6.6.0 / Application Editor Guide / 351
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using Print Statements
The Print statement that tries to output Line 2 is disabled because the tag
VBLOGDISABLE_U has the value 1 when the Print statement executes.
After debugging, set the default value of these two tags in the Application Editor or Configuration Manager to 1 so the Print statements are ignored.
Note: When graph is running in the USER domain, changing the value of tag VBLOGDISABLE_S has no impact. Likewise, changing the value of tag VBLOGDISABLE_U when graph is running in the SHARED domain has no effect. Remember to change the correct tag to turn off Print statement output for the domain graph is running in. To be safe, set both tags to 1 to make sure Print statement output is disabled for any domain.
Examples of the Print statement used with objects unique to FactoryLink include:
• RTDBObject:
• GraphicObject:
• DrawingObject:
• WindowObject:
Refer to Chapter 22, “Using Properties and Methods in PowerVB,” for more
information on PowerVB variables and FactoryLink tag types.
352 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
U SING L OG V IEW TO D ISPLAY D EBUG O UTPUT
LogView provides a convenient means for viewing the vbdebug.log
files created in
PowerVB.
Overview
Any text editor can be used to view a vbdebug.log
file; however, LogView is designed specially for this task. It offers the following advantages over most text editors:
• The view of the vbdebug.log
file is periodically updated to show any new output from Print statements in a running FactoryLink 6.6.0 application.
• LogView has the ability to view files of any size.
• The GUI interface for LogView is user friendly.
• LogView is a file viewer and not an editor, so it is impossible to accidentally overwrite information in the vbdebug.log
file.
• LogView is available on all platforms FactoryLink 6.6.0 runs on and operates the same on each of these platforms.
Starting LogView
LogView can be started using the GUI method appropriate to the operating system you are using.
Windows NT Double-click the LogView icon in the FactoryLink program group in Program Manager
Windows 95 Select the LogView icon from the FactoryLink section of the
Programs section of the Start menu
OS/2 Double-click the LogView icon in the FactoryLink folder
LogView can also be launched from the command line by entering the following command at the command line: logview [filename(s)] [-refresh nnn]
The optional filename(s) part of the command identifies one or more files to select.
The optional -refresh nnn part of the command lets you define the refresh rate to use. The refresh rate is described further below.
27
FactoryLink 6.6.0 / Application Editor Guide / 353
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
When you start-up LogView, the first window you see identifies LogView and displays copyright information followed by LogView’s main window.
This window has a menu bar and toolbar for selecting performance commands. It has a files area in the middle with horizontal and vertical scroll bars to display icons for the files selected for viewing. The menus on the main window and their options are detailed on the following pages.
File Menu
Use the File menu to open a file in LogView and to exit LogView.
Open Brings up the Open File dialog to open a file for viewing.
Exit Exits the LogView application.
354 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
Options Menu
The Options menu allows you to change the name of the file icons to the full path name or the file name. A check mark is displayed next to Full Path Name when it is enabled.
27
Full Path Name Displays the full name of the file icons shown in the LogView main window files area.
Help Menu
The Help menu option About LogView re-displays the window giving copyright and version information for the LogView application.
Selecting a File to View
1 Choose File>Open in the main LogView window to display the Open File dialog.
2 Select a file for viewing from the Open File dialog. Usually, you select the vbdebug.log
file in the appropriate directory, but you are not limited to viewing vbdebug.log
. Any text file can be viewed with LogView. The Open File dialog looks very similar to the Import and Export dialogs in the PowerVB animation editor.
Refer to Chapter 18, “PowerVB Editor,” for descriptions of each menu item.
If you select a file with the Open File dialog and click on Open, an icon for the file displays in the main LogView window’s file area. You can open several files using the Open File dialog, which puts several icons in the files area of the LogView main window.
FactoryLink 6.6.0 / Application Editor Guide / 355
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
Using the Full Path Names Option When Viewing File Icons
If several files are opened and have the same name but reside in different directories, the names of their icons are the same, which can be confusing. If you select Full Path Name from the Options menu, the full paths of the files display under their icons as in the following example.
This lets you see exactly which file is represented by each icon. Choosing
Options > Full Path Name again changes the icon names back to the basic name and extension.
Viewing a File
Once one or more file icons are in the main window files area, double click an icon and view the file contents. The sections of this window are detailed in the following paragraphs.
Title Bar
This has the text LOGVIEW: filename in it where filename is the full name of the file being viewed.
356 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
Menu and Toolbar
The following commands are available on the menu and toolbar:
Refresh If automatic refreshing is off indicated by a clock on the toolbar button, this menu option turns it on. If the button has a stop sign on it, automatic refreshing is enabled. When you click on the button, its appearance changes to the clock image to indicate automatic refreshing is disabled. Clicking on the button again changes it back to a stop sign to indicate automatic refreshing is enabled.
Help About LogView — displays the window showing copyright information for the LogView application.
File Contents Area
Displays the contents of the file being viewed. A vertical scroll bar lets you scroll to lines in other parts of the file. A horizontal scroll bar lets you scroll sideways to see more of a line when lines in a file are longer than the contents area. Select and copy lines in the file to the clipboard so they can be pasted into another application.
Status Area
Tells the number of the first line selected in the viewer and the total number of lines in the file being viewed. If you have not selected any lines in the file, the first number is zero.
Refresh Rate
Adjusts how often the viewer file information is refreshed. This rate is specified in seconds with a valid range of 1 to 100 seconds.
To use the Refresh Rate section of the window, drag the rate indicator to the left or right to decrease or increase the rate or press the left and right arrows. If you click on the left or right arrow once, the refresh rate decreases or increases by one second.
If you click on the left or right arrow with the left mouse button and hold the button down, the refresh rate constantly decreases or increases until you release the button or reach an end of the valid range.
27
FactoryLink 6.6.0 / Application Editor Guide / 357
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Using LogView to Display Debug Output
Heart Beat Indicator
This section of the viewer window updates the color of the bars periodically to show the LogView viewer window is not locked up. Like a heart beat monitor, this section shows the application is running correctly. The Heart Beat indicator stops if automatic file refreshing is disabled. It does not restart until automatic refreshing is enabled again.
Refresh Rate and Updating Viewer Window
’
s File Contents Area
If you are viewing the contents of the vbdebug.log
file while the FactoryLink application is running, Print statements might still be changing the file. So,
LogView has an automatic refresh ability — the ability to periodically refresh its view of the file contents. In other words, it periodically rereads the file contents and displays them in the file contents area of the viewer window. Without this ability, you will have to close and reopen the file every time you want to see changes in it.
Control the rate LogView refreshes at by using the Refresh Rate section of the viewer window and/or specifying a refresh rate on the command line when you start LogView. The default refresh rate is 10 seconds meaning LogView checks for changes in the file every ten seconds. The refresh rate can change from 1 second to
100 seconds.
When automatic refreshing is turned on and the viewer window detects the file has changed, it re-reads the contents of the file and forces you to view the last section of the file. This is where the changes are in a vbdebug.log
file. Turn off automatic refreshing by pressing the stop sign button on the viewer window toolbar. Turn off automatic refreshing to scroll up in the file contents and not be forced to the bottom of the file when changes are detected in the file. Turn automatic refreshing back on by clicking the toolbar button again. When automatic refreshing is off, the button contains a picture of a clock to let you know.
358 / FactoryLink 6.6.0 / Application Editor Guide
DEBUGGING A POWERVB SCRIPT
Troubleshooting
T ROUBLESHOOTING
The following paragraphs outline troubleshooting tips for programming code in
PowerVB.
Case Sensitivity Issues
Code executes verbatim at run time. Watch for spacing. Note that PowerVB is not case-sensitive except for object names in explicit declarations.
Reserved Words
All statement and function names in the PowerVB Command Reference as well as the properties and methods described here are considered reserved words. These words cannot be used as variable names in PowerVB code.
PowerVB Code Attached to Sub-Objects
Care must be taken when using PowerVB on the sub-objects of a composite object.
When a mouse event occurs, only the top-most object that responds to mouse events are notified of the event. For example, if a composite object has a child that responds to mouse down events and the child has a child that responds to them as well, the grandchild never receives any mouse down events.
Multi-threading
Multi-threading is when PowerVB lets more than one event routine execute at the same time. This is different from Visual Basic where only one event routine executes at a time. Allowing multi-threading makes PowerVB more flexible but also makes coding more complicated in several ways.
Do not rely on a specific execution order for events on different objects in a drawing. Even if you create object A in the Application Editor before you create object B, this does not mean object A’s DrawLoad event runs before object B’s
DrawLoad event. Even if drawing X loads before drawing Y, you cannot be sure that DrawLoad events for objects on drawing X execute before those on drawing Y.
To ensure a certain execution order for statements in DrawLoad events, put all the statements in one DrawLoad event on one object.
27
FactoryLink 6.6.0 / Application Editor Guide / 359
•
•
•
•
DEBUGGING A POWERVB SCRIPT
Troubleshooting
Just as multiple events for different objects can run at the same time, multiple events for a single object can run at the same time with some restrictions. All tag events for an object can run at the same time; however, all other types of events
(drawing, mouse — commonly referred to as GUI events) occur one at a time in the order they are detected.
Endless Loops
Watch for endless loops. A FactoryLink application will not shut down until all active event routines end. So, an application could be frozen until you forcibly terminate it using whatever method the operating system provides. The same problem can occur when you try to unload a drawing from memory. The application waits for the PowerVB event routines running on that drawing to end before closing the drawing.
For example, the following code creates an endless loop (since A_SEC is a counter for the number of seconds since the last minute, its value is always less than 61):
While A_SEC.value < 61 ‘A bad thing x = x + 1
Wend
Execution Order at Run Time
A drawing does not unload until all PowerVB scripts in all of its objects terminate.
Multiple DrawLoad event procedures can exist in multiple objects. If multiple
DrawLoad events exist for a drawing, they are executed in the order the objects are saved in the .g
file. If the execution order of the DrawLoad code is important, put all of the DrawLoad code in a single object. It then executes sequentially as expected.
360 / FactoryLink 6.6.0 / Application Editor Guide
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Chapter 28
Graphic Object
Security Overview
As you set up applications in FactoryLink, you may want to control who has access to the functions within the application. For example, you may want to ensure a particular part of your application is not available to all users.
FactoryLink’s Security feature allows you to restrict access so unauthorized users cannot access certain functions, while authorized users are granted access to these functions.
In FactoryLink, security focuses on graphic input objects—that is, when you create a FactoryLink graphic object, you can enter a specific security class for the graphic object. If a user does not have access to the specified security class, the user cannot access the graphic object.
Security can be assigned to each of the three input object types:
• Buttons
• Text input fields
• Function keys
These objects have one thing in common—they are objects an operator uses to interact with an application.
In addition, Security allows you to determine the type of user required to access a graphic object or application screen and the type of feedback displayed if a user is not authorized to access it. It also allows you to record information about who is accessing—or attempting to access—the application.
To control application security, you must be familiar with the following:
• The concepts of being an application administrator, being an application user, and using security classes
• The FLADMIN function, which allows the administrator to set up application security
• The Security options available from the Application menu within the
Application Editor
• How to plan Security for your application
28
FactoryLink 6.6.0 / Application Editor Guide / 363
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
This chapter introduces you to the concepts you must understand to configure
Security for your applications.
364 / FactoryLink 6.6.0 / Application Editor Guide
GRAPHIC OBJECT SECURITY OVERVIEW
Key Concepts
K EY C ONCEPTS
To understand how FactoryLink’s Security features work, you need to understand the following basic concepts:
• Application administrator
• Application user
• Security class
Application Administrator
The application administrator is responsible for establishing and maintaining
FactoryLink Security for an application. The application administrator
• Creates and maintains records for all application users
• Creates and maintains records of all security classes
By controlling who can access the system (application users) and what type of access the users have (security classes), the application administrator plays the key role in maintaining security within a FactoryLink application.
To ensure only the application administrator can access security information, the administrative part of the security function (called FLADMIN) is password-protected. The administrator can modify the administrator password as needed.
Application User
A application user is anyone authorized to access FactoryLink screens. The application administrator establishes who is an application user by creating a security record for each user. This security record includes:
• The user’s name
• The user’s password
• The security classes the user can access
If at run-time a user tries to access a graphic object assigned to a security class, the system verifies the user has access to this security class. If the user does not have access to the security class, the user cannot access the graphic object. In this way, FactoryLink controls who can access the different parts of the application.
Before a user can access any security class, the user must log in (by entering a user name and password).
28
FactoryLink 6.6.0 / Application Editor Guide / 365
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
Key Concepts
Users can be assigned to multiple security classes. For example, an employee might be assigned to only one security class to limit the employee’s access to the application. At the same time, a supervisor might be assigned to all available security classes, so the supervisor can access all features within the application.
Security Class
A security class is defined by the application administrator. Each input graphic object can be assigned to one security class. Each application user then can be granted access to any or all security classes.
A class may be created:
• For a particular kind of operation
• To control a single machine
• To access a particular screen or set of screens
• To control any other aspect of your application security
The precise meaning of each security class is determined by the needs of the application. Since users can be assigned to any set of classes, you can use this approach to create a hierarchical security scheme, where users with higher access have access to the same classes as users who have lower access. Or, if desired, you can tailor security so each user has access only to an appropriate set of classes.
You can even set up a hierarchical structure and allow deviations to the hierarchy as needed.
In a simple scenario, an application administrator may decide to create two classes of Security: one class named Operator and another class named
Supervisor. When the application is created, the application developer assigns input graphic objects to a particular security class. For example, a particular menu button may be assigned to the Operator security class while a specific text input field might be assigned to the Supervisor security class. When the application runs, only those users who have access to the security class associated with the object can access the object.
The application administrator can create up to 32 security classes.
Note: You need a development license with Application Editor to assign security classes. You need a run-time license to associate users with security classes.
366 / FactoryLink 6.6.0 / Application Editor Guide
GRAPHIC OBJECT SECURITY OVERVIEW
FLADMIN
FLADMIN
FLADMIN is the FactoryLink function that allows the application administrator to set up application security. FLADMIN provides options that allow you to
• Define security classes
• Define application users
• Specify the type of password to be used for the application
• Change the application administrator password
FLADMIN can be accessed from the Application Editor, from the FLADMIN icon,
or from the command line. Refer to Chapter 29, “Configuring Security Using
FLADMIN,” in this manual to see how to access FLADMIN and use its options.
Note: You must first run the Application Editor before you run
FLADMIN for the first time.
28
FactoryLink 6.6.0 / Application Editor Guide / 367
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
Security Options
S ECURITY O PTIONS
Along with the Security functions available within FLADMIN, FactoryLink also provides some Security options that can be accessed from the Application Editor.
These Security options allow you to
• Define login options for your application
• Define error messages that display after a failed security login
• Define login messages
• Log security events within your application
These Security options are available from the Application menu within the
Application Editor. Refer to Chapter 30, “Setting up Security Options,” in this
manual to see how to use these options.
368 / FactoryLink 6.6.0 / Application Editor Guide
GRAPHIC OBJECT SECURITY OVERVIEW
Planning Security for your Application
P LANNING S ECURITY FOR YOUR A PPLICATION
To configure Security for your application, you must develop a plan to ensure your application provides the proper level of security. Specifically, you need to
• Decide how authorized users will log in and out
• Determine object security requirements
Deciding How Authorized Users Will Log in and Out
Users need to be able to log in to show that they have the proper Security access to use anything in an application that is Security-protected. Users can log in three ways:
• You can assign keys on the keyboard as hot-keys for Security. When the user presses the key or key combination defined as the hot-key, a login dialog box displays, prompting the user to log in. These hot-keys are used to log in any time from any part of the running application.
• A login dialog box can be assigned to the object. When the user tries to access the object, the system displays a dialog box prompting the user to log in.
• A trigger tag can be defined to log in a user and password, specified in the name
tag and the password tag, when triggered. Refer to “Setting up Security
Options” on page 387 for more information about trigger tags.
You also need to set up a logout process to prevent authorized access to objects or actions that have Security attached. The logout process can be defined as follows:
• As with logging in, users can use hot-keys to log out. If you assign hot-keys, you can optionally include a dialog box that will confirm that the user really wants to log out.
• You can configure logout to occur after a certain amount of time has passed.
This prevents unauthorized access to the application if a user forgets to log out.
• A trigger tag can be defined to log out the current user.
If desired, you can use a combination of the above logout procedures—for example, by setting up hot-keys for normal logout but also configuring automatic logout in case users forget to logout.
28
FactoryLink 6.6.0 / Application Editor Guide / 369
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
Planning Security for your Application
Determining Object Security Requirements
After you have determined how login and logout will occur, you need to identify which objects need to have Security added. This step allows you to identify the windows (screens) you may want to disable through buttons, and the keys or fields you want to disable.
To determine your object Security requirements, you need to
• Plan your Security classes
• Determine actions that will occur if unauthorized access occurs
Planning Security Classes
As discussed earlier, security classes are a key to specifying who has access to a particular object. Remember the following key points about security classes:
• An object can only have one security class assigned to it
• All users that have access to the object must be a member of the security class.
• Up to 32 security classes may be defined in an application
Also, remember that FactoryLink security classes provide great flexibility in allowing users to have common security classes assigned or completely unique security privileges. Instead of using a strict hierarchical structure (for example, where Level 1 users get access to all functions and Level 10 users get access to only a few functions), FactoryLink allows you to tailor security to meet your application needs.
Determining Access Error Actions and Logging
Once Security is added to an object, the authorized security class is assigned. The next question is what happens if an unauthorized user tries to access the object.
FactoryLink provides security attributes that allow you to determine this. You can also keep a log of unauthorized access attempts, if desired.
FactoryLink security attributes fall into two categories:
• Class Logging—Allows you to specify if you want to log attempts to access a graphic object (failed or successful accesses).
• Access Error Action—Allows you to determine what will happen when an access attempt fails. You can choose to provide a dialog box, a prompt, a beep, or no action.
Remember you can combine Class Logging and Access Error Action options to provide the type of security information you want.
370 / FactoryLink 6.6.0 / Application Editor Guide
GRAPHIC OBJECT SECURITY OVERVIEW
Implementing Security in your Application
I MPLEMENTING S ECURITY IN YOUR A PPLICATION
When you are ready to set up Security for your application, you may want to use the following steps to guide you:
Note: The Security options are available from the Application menu within the Application Editor. Specific steps for using the
Security options are provided in Chapter 29, “Configuring
Security Using FLADMIN,” and Chapter 30, “Setting up
1 Select Assign Users and Classes from the Application menu in the Application
Editor.
• Change the Administrator Password for Security
• Set the Password Verification Type (local or system)
2 Create and define application classes.
• Assign access error action
• Assign class logging
3 Create and define application users.
• Set up user passwords
• Assign class(es) to users
4 Set up login/logout options.
• Optionally, define login hot-keys (if using hot-keys for login)
• Optionally, define the user Name tag, Password tag, and Trigger tag for logging in
For example, the Name tag, Password tag, and Trigger tag allows users with touch screens to log in the system.
• Optionally, define Logout hot-keys and indicate whether to confirm logout with a dialog
• Optionally, define the logout Trigger tag
• Optionally, define the window and drawing to return to upon logout, thus preventing unauthorized access to drawings. If nothing is specified, the window and drawing the user logs out from remain active.
• Change the contents of the files that contain the text if you want to change the text used in either login or error dialog boxes.
28
FactoryLink 6.6.0 / Application Editor Guide / 371
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
Implementing Security in your Application
5 Set up the event logging configuration.
• Select the events to log, including user login/logout and system start-up/shutdown.
• Define the Mailbox tag, optional Disable tag, and Database Alias.Logging Table if you are logging any of the above events.
6 Assign Security to objects.
Note: When developing Security for an application, you may want to disable the Security function while you are developing the application (using the Disable Security option available from the FLADMIN menu). Otherwise, you will need to constantly sign in to each object as you create your application.
Once you complete your application, enable Security (using the
Enable Security option on the FLADMIN menu) and test the application to ensure you implemented Security correctly.
372 / FactoryLink 6.6.0 / Application Editor Guide
GRAPHIC OBJECT SECURITY OVERVIEW
Security and Stacked Buttons
S ECURITY AND S TACKED B UTTONS
Stacked buttons are multiple button objects stacked on top of each other to perform specific tasks within your application. Before you begin adding Security to stacked buttons within your application, you need to consider how Security affects operation of the stacked buttons.
Consider the following information related to Security and stacked buttons:
• Avoid adding security to stacked buttons within an application. If stacked buttons contain different security classes, the buttons may not operate properly
(if the user login fails for some buttons in the stack but not for other buttons in the stack).
• Do not add security to stacked buttons that include momentary action buttons.
The momentary action button may begin to operate properly but then stop operation when the security login displays.
• Ensure all buttons in the stack have the same security class if you must have security on stacked buttons. Also, use classes that do not require display of a login or error dialog.
28
FactoryLink 6.6.0 / Application Editor Guide / 373
•
•
•
•
GRAPHIC OBJECT SECURITY OVERVIEW
Security and Stacked Buttons
374 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 29
Configuring Security
Using FLADMIN
The FLADMIN function allows the application administrator to set up application security. Through FLADMIN, the administrator can
• Define security classes
• Define application users
• Set the password type for the application
• Set the administrator password
This chapter describes how to access FLADMIN and configure each of these
FLADMIN options.
29
FactoryLink 6.6.0 / Application Editor Guide / 375
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Accessing FLADMIN
A CCESSING FLADMIN
You must access FactoryLink’s FLADMIN function to set up security. You can access FLADMIN in any of three ways:
• Select Assign Users/Classes from the Application menu within the Application
Editor
• Select the FLADMIN icon
• Enter FLADMIN from the command line
The FLADMIN menu displays when you access FLADMIN.
The FLADMIN menu allows you to choose the Security option you want to perform.
In this chapter, the first method shown—accessing FLADMIN from the
Application Editor—is used. Remember you can use either of the other two methods, as desired.
376 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING SECURITY USING FLADMIN
Defining a Security Class
D EFINING A S ECURITY C LASS
The application administrator must set up the security classes that control security within the FactoryLink application. Each graphic object to be secured must be assigned to a security class. The Application Classes option within
FLADMIN allows you to set up your security classes.
Perform the following to define a security class:
1 Choose Assign Users/Classes from the Application menu of the Application Editor.
The system asks you to enter your administrator password.
29
The default administrator password is Password. Passwords are not case-sensitive.
Note: Remember: you can also access FLADMIN by selecting the FLADMIN icon or by entering FLADMIN from the command line.
FactoryLink 6.6.0 / Application Editor Guide / 377
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Defining a Security Class
2 Enter your administrator password and click on OK to display the FLADMIN menu.
3 Click on Application Classes to display the Application Security Classes dialog.
378 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING SECURITY USING FLADMIN
Defining a Security Class
4 Enter the new security class name, and click on New to display the Security Class
Attributes dialog.
5 Provide the following information for the Security Class Attributes dialog:
Log Access
Failure
Click this button if you want the system to keep a record of every failed attempt to access a graphic object within this security class. If a user attempts to use an input object with this class and does not have correct privilege, the system writes a message to the Historian mailbox (if configured) and last event tag.
Log User
Action
Click this button if you want the system to log successful attempts to access a graphic object within this security class. If a user attempts to use an input object with this class and has the correct privilege, the system writes message to the Historian mailbox (if configured) and last event tag.
Error Dialog Click on this button if you want the user to receive an error dialog when failing to access a graphic object.
Login Prompt Click on this button if you want the user to receive a login prompt when failing to access a graphic object.
FactoryLink 6.6.0 / Application Editor Guide / 379
29
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Defining a User
Beep Click on this button if you want the system to beep when the user fails to access a graphic object.
None Click on this button if you don’t want to provide any feedback when the user fails to access a graphic object.
6 Click on OK when you finish entering information to create the security class and display the Application Security Classes dialog.
D EFINING A U SER
The application administrator sets up security records for each authorized application user. These records are set up using an option within FLADMIN.
Complete the following instructions to set up a security record and define an application user.
1 Choose Assign Users/Classes from the Application menu of the Application Editor.
The system asks you to enter your administrator password.
2 Enter your administrator password and click on OK to display the FLADMIN menu.
3 Click on Application Users to display the Application Users dialog.
380 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING SECURITY USING FLADMIN
Defining a User
4 Click on New to display the New Application User dialog.
5 Specify the following information in the New Application User dialog.
User Name Enter the name of the user you want to create.
User names can be up to 32 characters, but certain operating systems may only support a limited number of characters as a user name. Thus, user names should normally be limited to eight characters, including spaces.
Valid Entry: Alphanumeric string of up to 32 characters
Description Enter the user’s full name (up to 32 characters, optional).
Valid Entry: Alphanumeric string of up to 32 characters
Auto Logout (in minutes):
Enter the number of minutes the system will sit idle before the user is automatically logged out. The system automatically logs out the user if the user does not select an input object within this time period.
If you enter 0 or leave this field blank, the user will not be logged out automatically.
Valid Entry: 0-99
FactoryLink 6.6.0 / Application Editor Guide / 381
29
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Defining a User
Modify Password Click in this box if you want to modify the user’s password.
This field is not available if you have selected System Password
New: If you choose to modify the user’s password, enter the new password here.
The system saves the password with case preserved, but
FactoryLink ignores case. Certain operating systems may use case-sensitive passwords.
This field is not available if you have selected System Password
Valid Entry: Alphanumeric string of up to 32 characters
Confirm: If you choose to modify the user’s password, enter the new password again here. This field is used to verify your input in the
New field.
Valid Entry: Alphanumeric string of up to 32 characters
Available Class(es) Lists the available security classes so you can specify the security class (or classes) you want to assign to the user. Highlight the security class you want to assign and click on the forward arrow button to move the class to the Assigned Class(es) list box. You can also use the ALL forward arrow to move all security classes to the Assigned Class(es) list box.
Assigned
Class(es)
Shows the security class(es) you have assigned to the user. If you want to delete the user’s access to one of these security classes, highlight the security class and click on the backward arrow button to move the class back to the Available Class(es) box. You can also use the ALL backward arrow to delete all security classes from this list box and move them back to the Available
Class(es) box.
6 Click on OK when you finish entering information. The user record is created, and the Application Users dialog displays.
382 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING SECURITY USING FLADMIN
Setting the Password Type
S ETTING THE P ASSWORD T YPE
The Password Verification Type option allows the application administrator to change the password verification type from local (internal FactoryLink verification) to system (platform system dependent). System password verification may be allowed depending on the operating system you are using.
This option is not user-specific but is applicable to the entire FactoryLink application. For example, if you choose system password verification, all users are subject to system password verification to access FactoryLink graphic objects.
Complete the following instructions to set the password verification type:
1 Choose Assign Users/Classes from the Application menu of the Application Editor.
The system asks you to enter your administrator password.
2 Enter your administrator password and click on OK to display the FLADMIN menu.
3 Click on Password Verification Type to display the Password Verification Type dialog.
29
4 Complete the following to fill out the Password Verification Type dialog.
Local Password
Verification
Click on this button if you want Security to recognize the user’s
FactoryLink password.
System Password
Verification
Click on this button if you want Security to recognize the user’s system password. This option may be used if your operating system allows use of a system password.
5 Click OK when you finish entering information to display the FLADMIN.
FactoryLink 6.6.0 / Application Editor Guide / 383
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Setting the Administrator Password
S ETTING THE A DMINISTRATOR P ASSWORD
The application administrator must enter a application administrator password to access the FLADMIN features. This password ensures only the application administrator can access system security features, such as defining users and setting up security classes.
The default administrator password is Password. As an administrator, you must change this password as soon as possible to prevent unauthorized system access.
Complete the following instructions to change your administrator password:
1 Choose Assign Users/Classes from the Application menu of the Application Editor.
The system asks you to enter your administrator password.
2 Enter your administrator password and click on OK to display the FLADMIN menu.
3 Click on Administrator Password to display the Administrator Password dialog.
4 Complete the following information to fill out the Administrator Password dialog.
Old password Enter your current administrator password.
New password
Enter the new administrator password you want to use. A valid password is a string of alphanumeric characters with no embedded spaces.
Valid Entry: Alphanumeric string of 6 to 32 characters
384 / FactoryLink 6.6.0 / Application Editor Guide
CONFIGURING SECURITY USING FLADMIN
Setting the Administrator Password
Confirm password
Enter the new administrator password again that you want to use to confirm the new password. This field is used to verify your input in the New Password field.
Valid Entry: Alphanumeric string of up to 32 characters
5 Click on OK When you finish entering information to save the new password and display the FLADMIN menu.
29
FactoryLink 6.6.0 / Application Editor Guide / 385
•
•
•
•
CONFIGURING SECURITY USING FLADMIN
Setting the Administrator Password
386 / FactoryLink 6.6.0 / Application Editor Guide
Chapter 30
Setting up Security
Options
Along with the FLADMIN options, FactoryLink also provides some security options available from the Application menu within the Application Editor. These
Security options allow you to control how security works within your application.
You can use these options to
• Set the login options
• Define error messages
• Define login messages
• Log security events
This chapter describes how you can configure these Security options.
30
FactoryLink 6.6.0 / Application Editor Guide / 387
•
•
•
•
SETTING UP SECURITY OPTIONS
Using Keywords
U SING K EYWORDS
The usefulness of security dialogs and logging text can be extended with key words. These keywords are translated to text values at run-time.
Security keywords can be used in these locations:
Login and error dialogs (titles and dialog text, including prompts)
Input object log messages
Predefined events
Keywords have the form %KEYWORD, where KEYWORD is one of the following:
USER, VAL, OLD, CLASS, ACTION, DATE, and TIME.
Keyword ................Meaning
USER.....................Current logged in operator name
VAL.........................Tag value (meaningful only for input objects. If the operation changes the tag, VAL is the value after the operation)
OLD.........................Tag value-like VAL, but the value of the tag before the operation
CLASS.....................Object’s security class-meaningful only for input objects
ACTION..................Action performed on object
DATE.......................Current date
TIME........................Current time
Additionally, any system environment variable can be represented using %(ENV), where ENV is the environment variable name.
ACTION will be ON, OFF, TOGGLE, SET, ADD, SUB, FILE, QUIT, TOP, DRAW,
ENABLE, PAN, ZOOM, CHANGE, STOP, DRWTOP, MOM ON, or MOM OFF.
Events are logged to the Security Event Log in these columns:
TMSTMAP................-Time of event
OPERNAME.............-Current operator name
EVNTYPE.................-Event type
EVNTMSG..................-Event message
Event codes are:
FAILTEXT.................-Failed to update text object*
UPDTEXT..................-Updated text object*
UPDINP.....................-Updated input object*
RTGSTART................-Graphics task starting
RTGSTOP...................-Graphics task shutting down
SECVIOL...................-Operator failed to log in*
388 / FactoryLink 6.6.0 / Application Editor Guide
SETTING UP SECURITY OPTIONS
Using Keywords
SECLOGOUT.................-Operator logged out
SECLOGIN.....................-Operator logged in
FAILLOGIN.......................-Operator attempted to log in, but failed*
*-includes the object’s log message as the event message
**-uses the operator name in the login attempt as the current operator
30
FactoryLink 6.6.0 / Application Editor Guide / 389
•
•
•
•
SETTING UP SECURITY OPTIONS
Setting Security Login Options
S ETTING S ECURITY L OGIN O PTIONS
FactoryLink’s Security options allow you to control how users log in and log out of the security system. These options are controlled through the Login Options dialog.
You can use Login Options to
• Allow users to login and/or logout via a hotkey combination
• Allow users to login and/or logout automatically via a tag trigger
• Display a particular window after the user logs out
Complete the following instructions to configure your security login options.
1 Choose Security Options from the Application menu of the Application Editor.
2 Choose Login Options to display the Login Options dialog.
390 / FactoryLink 6.6.0 / Application Editor Guide
SETTING UP SECURITY OPTIONS
Setting Security Login Options
3 Specify the following information:
Login Hotkey Specify a keystroke combination the user can use to begin the security login process. This keystroke will be active no matter what graphics screen is currently displayed. If you choose a login hotkey, the user can press the hotkey combination and then complete a dialog to login to the application.
If you want to permit use of a hotkey to allow security login, select a key from the drop-down list and then press ALT, CTRL, and/or SHIFT as needed to specify the hotkey combination.
The hotkey login method works independently from the tag trigger login method. Specify one or both methods, as desired.
Name Tag Used in conjunction with the Password Tag and Trigger fields to allow automatic login based on a tag trigger. Enter the name of the tag that contains the user name. See Trigger field for more information.
Valid Entry: Standard tag name
Valid Data Type: message
Password Tag Used in conjunction with the Name Tag and Trigger fields to allow automatic login based on a tag trigger. Enter the name of the tag that contains the user password. See Trigger field for more information.
Valid Entry: Standard tag name
Valid Data Type: message
Trigger Used in conjunction with the Name Tag and Password Tag fields to allow automatic login based on a tag trigger. Enter the name of the tag used to trigger the login process. When the value of this tag changes to 1, the user/password specified in the Name Tag and
Password Tag is used to log in a new user. After the login attempt is complete, the Name Tag and Password Tag are cleared.
The tag trigger login method works independent from the hotkey login method. Specify one or both methods, as desired.
Valid Entry: Standard tag name
Valid Data Type: digital
Logout Hotkey Specify a keystroke combination the user can use to log out.
If you want to permit use of a hotkey to allow logout, select a key from the drop-down list and then press ALT, CTRL, and/or SHIFT as needed to specify the hotkey combination.
30
FactoryLink 6.6.0 / Application Editor Guide / 391
•
•
•
•
SETTING UP SECURITY OPTIONS
Setting Security Login Options
A confirmation message displays if the Confirm Logout box is checked.
The hotkey logout method works independent from the tag trigger logout method. Specify one or both methods, as desired.
Trigger Enter the name of the tag used to log out the user. When the value of this tag changes to 1, the user will be logged out without a confirmation.
The tag trigger logout method works independent from the hotkey logout method. Specify one or both methods, as desired.
Valid Entry: Standard tag name
Valid Data Type: digital
Home Display Enter the name of the window you want displayed when the user logs out. When the user logs out (either voluntarily or by timing out), this window becomes the top window, and the drawing is loaded, if necessary.
If this field is blank, the current display does not change when the user logs out.
Valid Entry: WINDOW:DISPLAY
4 Click on OK when you finish entering information. The login/logout options you specified are saved, and the Application Editor displays.
392 / FactoryLink 6.6.0 / Application Editor Guide
SETTING UP SECURITY OPTIONS
Defining Error Messages
D EFINING E RROR M ESSAGES
The Error Dialog option allows you to control the error message that will display after a failed security login. The error message will display on five lines; this option allows you to specify the content of each line.
Complete the following instructions to specify the Error Dialog message.
1 Choose Security Options from the Application menu of the Application Editor.
2 Choose Error Dialog to display the Error Dialog .
30
3 Specify the following information:
Lines 1-5 Enter the format line for each line in the graph.txt
file that corresponds to the line you want to display in the error message.
Optional Value
Tag 1
Graph.txt
is the standard FactoryLink graphics translation file in
FLINK\msg\graph.txt
. Create an application graphics translation file in FLAPP\msg\graph.txt
by copying all of the lines begin with
SERLINEx or SLGLINEx from the FLINK file. The lines that begin with SERLINE1 - SERLINE5 define the error dialog. The translated line can contain up to three format specifiers.
Line 1 represents the first line of the error message, Line 2 represents the second line of the error message, etc.
Enter the name of the first tag used to insert some information into the appropriate line of the error message.
Valid Entry: Standard tag name
FactoryLink 6.6.0 / Application Editor Guide / 393
•
•
•
•
SETTING UP SECURITY OPTIONS
Defining Error Messages
Optional Value
Tag 2
Optional Value
Tag 3
Enter the name of the second tag used to insert some information into the appropriate line of the error message.
Valid Entry: Standard tag name
Enter the name of the third tag used to insert some information into the appropriate line of the error message.
Valid Entry: Standard tag name
4 Click on OK when you finish entering information. The error dialog options you specified are saved, and the Application Editor displays.
394 / FactoryLink 6.6.0 / Application Editor Guide
SETTING UP SECURITY OPTIONS
Defining Login Messages
D EFINING L OGIN M ESSAGES
The Login Dialog option allows you to control the message that displays during a user login attempt. The message displays on five lines; this option allows you to specify the content of each line.
Complete the following instructions to specify the Login Dialog message:
1 Choose Security Options from the Application menu of the Application Editor.
2 Choose Login Dialog to display the Login Dialog .
30
3 Specify the following information:
Lines 1-5 Enter the format line for each line in the graph.txt
file that corresponds to the line you want to display in the login message.
Graph.txt
is the standard FactoryLink graphics translation file in
FLINK\msg\graph.txt
. Create an application graphics translation file in FLAPP\msg\graph.txt
by copying all of the lines begin with
SERLINEx or SLGLINEx from the FLINK file. The lines which begin with SLGLINE1 - SLGINE5 define the login dialog. The translated line can contain up to three format specifiers.
Line 1 represents the first line of the login message, Line 2 represents the second line of the login message, etc.
Optional Value
Tag 1
Enter the name of the first tag used to insert some information into the appropriate line of the login message.
Valid Entry: Standard tag name
FactoryLink 6.6.0 / Application Editor Guide / 395
•
•
•
•
SETTING UP SECURITY OPTIONS
Defining Login Messages
Optional Value
Tag 2
Optional Value
Tag 3
Enter the name of the second tag used to insert some information into the appropriate line of the login message.
Valid Entry: Standard tag name
Enter the name of the third tag used to insert some information into the appropriate line of the login message.
Valid Entry: Standard tag name
4 Click on OK when you finish entering information. The login dialog options you specified are saved, and the Application Editor displays.
396 / FactoryLink 6.6.0 / Application Editor Guide
SETTING UP SECURITY OPTIONS
Logging Security Events
L OGGING S ECURITY E VENTS
The Event Log Config option allows you to control what security-related events can be recorded in a Historian file. You can use this option to specify the system events you want to record and the Historian file that will store the log records.
Complete the following instructions to set the security logging options:
1 Choose Security Options from the Application menu of the Application Editor.
2 Choose Event Log Config to display the Security Event Logging Configuration dialog.
30
3 Specify the following information:
User Login Click this box if you want to record all user login events.
User Logout Click this box if you want to record all user logout events.
System Startup Click this box if you want to record when the Run-Time Graphics task is started.
System Shutdown Click this box if you want to record when the Run-Time Graphics task encounters a shutdown request.
FactoryLink 6.6.0 / Application Editor Guide / 397
•
•
•
•
SETTING UP SECURITY OPTIONS
Logging Security Events
Historian Mailbox Enter the name of the Historian mailbox where you want to store the log records. If you do not enter a mailbox in this field, event logging is disabled.
Valid Entry: Standard tag name
Valid Data Type: mailbox
*Disable Enter the tag name or numerical constant used to enable or disable event logging. If this tag has a FALSE value (0 or not defined), event logging is written to the Historian. If this tag has a TRUE value (any value other than 0), event logging is not written to the Historian. If no tag is defined and a Historian mailbox is identified, event logging is always written to the
Historian.
Valid Entry: Standard tag name or numeric constant
Valid Data Type: digital
Event log Table Enter the name of the Alias.Table used within the Historian mailbox to store the event logging information. This table corresponds to an entry in the Historian Mailbox Information panel for the selected mailbox.
4 Click on OK when you finish entering information. The event logging options you specified are saved, and the Application Editor displays.
398 / FactoryLink 6.6.0 / Application Editor Guide
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Chapter 31
Converting and
Importing DXF Files
FactoryLink allows you use AutoCAD drawings in your FactoryLink application.
The DXF Converter is used to convert original AutoCAC drawings into a .gx
file
(an ASCII text-based file) that FactoryLink can import. FactoryLink does not directly import DXF drawing files. After conversion, you can import the .gx
file into your FactoryLink application.
You can edit an imported drawing just as you would any other FactoryLink drawing.
This chapter contains information about the following topics:
• Conversion Considerations
• Installing the FactoryLink DXF Converter
• Converting Colors, Fonts, and Line Styles
• Converting a Drawing
• Conversion Defaults
• Customizing the Conversion Settings
• Creating and Using a Translate File
• Troubleshooting and Error Messages
31
FactoryLink 6.6.0 / Application Editor Guide / 401
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Conversion Considerations
C ONVERSION C ONSIDERATIONS
Most AutoCAD drawings appear just as you drew them after you convert and import them into FactoryLink. Use the default conversion settings discussed in
the section “Using the Default Conversion Settings” on page 405, or you can
customize how the Converter converts colors, fonts, and so on as discussed in the
section “Customizing the Conversion Settings” on page 408.
Keep the following limitations in mind when you prepare to convert an AutoCAD drawing to use in FactoryLink:
• Only AutoCAD files through Version 12 are converted. If AutoCAD 12 cannot import and open your drawing, the Converter cannot convert it.
• DXF drawings created with products other than AutoCAD, Generic CADD, and
AutoSketch may not convert properly.
• Set the viewport before exporting the DXF file from AutoCAD.
• Extended entity data is not converted.
• Lines less than one pixel are converted to one pixel.
• Only solid fills are converted. Hatch patterns, for example, are not converted.
• Objects that were mirrored (flipped over) or rotated in the original AutoCAD drawing might be misplaced in the converted drawing.
• Drawings with nested inserts are not converted.
• Dimensions on drawings are not converted.
• Symbol files cannot be converted unless the text version of the file exists.
• Text less than one pixel in height is not converted.
• Layers are flattened so all objects are placed on a single layer.
Installing the FactoryLink DXF Converter in Windows
Refer to the Windows NT and Windows 95 Installation Guide for details on adding supplemental tasks. After you install the Converter, complete the following steps to add the icon to the FactoryLink program group:
1 Double click the FactoryLink program group icon to open the FactoryLink program group.
2 Open the File menu and select New to open the New Program Object dialog.
3 Select Program Item and click on OK.
4 Type the description DXF Converter to label the icon. Press Tab.
402 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Converting a Drawing
5 Type the path and file name of the Converter utility. The utility filename is dxfwrap.exe
and resides in /{FLINK}/BIN . For example: c:\flwin\bin\dxfwrap.exe.
6 Click on OK . The Converter icon displays in the FactoryLink program group.
7 Double click the DXF Converter icon to start the Converter.
C ONVERTING A D RAWING
Convert drawings from DXF format so you can import them into FactoryLink using FactoryLink’s .gx
format.
To convert a drawing:
1 Double click the DXF Converter icon in the FactoryLink program group to open the DXF Converter.
2 Change to the drive and directory of the AutoCAD drawing you want to convert.
3 Select the files in the File area you want to convert. To deselect a file, click on it again.
4 Type the translate path and filename in the Translate file box to customize the
conversion settings. See the section “Creating a Translate File” on page 408 for
more details about using translate files to customize conversion settings. Leave this box blank to use the default settings.
31
FactoryLink 6.6.0 / Application Editor Guide / 403
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Converting a Drawing
5 Click on Convert to convert the selected files and place them in the current directory. For example, in the previous screen, the converted files are placed in the c:\acad directory.
If errors occur during the conversion of any of the files, the Converter creates a separate error file for each drawing that caused a conversion error. See
“Conversion Errors” on page 411 for more information.
To import a drawing into your FactoryLink application:
1 Double click Graphics Editor in the Configuration Manager Main Menu to open the Graphics/Animation editor (if necessary).
2 Open the File menu and select Import to open the Import dialog.
3 Select Exported Drawings as the file type.
4 Change to the drive and directory of the converted drawings.
5 Select the files in the File area you want to convert. To deselect a file, click on it again.
6 Click Import to import the drawings into your application.
404 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Using the Default Conversion Settings
U SING THE D EFAULT C ONVERSION S ETTINGS
FactoryLink maintains the original AutoCAD file drawing characteristics whenever possible. For example, the color red converts to red and solid lines stay solid.
FactoryLink substitutes the closest available style if it cannot reproduce a style found in the original drawing. For example, the AutoCAD color light red converts to the FactoryLink color orange-red, and AutoCAD’s phantom line style converts to dash-dot.
Use a translate file to change the conversion settings for graphics and text. See
the section “Customizing the Conversion Settings” on page 408 for more
information about customizing the conversion settings.
Conversion Defaults
The conversion defaults are shown in the charts below. The default screen width and height is 1023 x 767 pixels.
Text Conversions
FactoryLink converts text into non-text graphic elements, such as lines and arcs
unless you use customize the conversion settings (see “Customizing the
Conversion Settings” on page 408).
31
FactoryLink 6.6.0 / Application Editor Guide / 405
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Using the Default Conversion Settings
Color Conversions
The following table shows the default conversions for AutoCAD colors. Each program uses numbers to designate colors. For example, the Converter changes
AutoCAD’s color number 6 (magenta) to FactoryLink’s color number 20 (magenta).
Table 31-0 Default Conversions for AutoCAD colors
10
11
13
7
8
9
15
4
5
6
1
2
3
AutoCAD color number and description
Red
Yellow
Green
Cyan
Blue
Magenta
White
Black or Gray
Light Red
Brown
Light Green
Light Blue
Light Gray
26
7
13
63
48
1
59
12
16
20
0
4
8
FactoryLink color number and description
Red
Yellow
Green
Cyan
Blue
Magenta
White
Black
Orange-Red
Brown
Pale Green
Light Blue
Light Gray
If you want to see exactly how AutoCAD colors convert, use the FactoryLink color palette. For example, AutoCAD color 11, light green, converts to FactoryLink’s color number 7, light green. Compare FactoryLink’s color 7 in the color palette to your original AutoCAD drawing to be sure the conversion is acceptable. Although basic color conversions are usually very close to the original, there may be some differences—especially with non-primary colors.
406 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Using the Default Conversion Settings
View the FactoryLink color palette in most Graphics Editor Attributes dialogs where color is one of the attributes. For example, open the Attributes menu and choose Fill. The Fill Attributes dialog opens with the FactoryLink color palette displayed twice.
0-7
8-15
16-23
24-31
32-39
40-47
48-55
56-63
The FactoryLink color palette contains 64 colors. The colors are numbered beginning with zero (red) at the upper left corner, and ending with 63 (white) at the lower right corner.
Line Conversions
The following table shows the default conversions for AutoCAD line styles.
Table 31-0
AutoCAD line style:
Continuous (any thickness)
Border, Border2, BorderX2
Center, Center2, CenterX2
Dashdot, Dashdot2, DashdotX2
Dashed, Dashed2, DashedX2
Divide, Divide2, DivideX2
Dot, Dot2, DotX2
Hidden, Hidden2, HiddenX2
Phantom, Phantom2, PhantomX2
FactoryLink line style:
Solid
DashDot
DashDot
DashDot
Dash
DashDot
Dot
Dash
DashDot
31
FactoryLink 6.6.0 / Application Editor Guide / 407
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Customizing the Conversion Settings
C USTOMIZING THE C ONVERSION S ETTINGS
Specify how FactoryLink converts some or all of the drawing and text styles in an
AutoCAD drawing. For example, specify that green converts to white.
Create a standard (ASCII) text file to customize the conversion settings, called a translate file, that contains the customizations. Then, whenever you want to use those, enter the translate file filename in the Translate file area of the
FactoryLink DXF Import dialog.
Creating a Translate File
A translate file contains a collection of conversion customizations. Create a translate file using any (ASCII) text editor. Also, give the file any name and extension.
A translate file can contain up to four sections corresponding to the four types of styles that can be customized: font, color, screen, and lines. The sections can be organized in any order and you only need to include the ones that you want to customize, the rest use the defaults.
Use the translate file to convert fonts whenever possible. It speeds the conversion, and the final text quality is usually superior.
The following is an example of a translate file:
FONT
Helv,txt,20;
Helv,complex,10;
Times,romans,20;
Courier,monotext,20
COLOR
48,7;
63,8;
SCREEN
1023,767;
LINES solid,hidden; dash,phantom;
Start the font section with the word “FONT” and enter the conversion instructions on the next lines. The format for conversion instructions is:
FactoryLink FONT,AUTOCAD FONT,HEIGHT;
Height is the maximum height of the text to convert. Text above this height is converted to line segments and arcs.
Start the color section with the word “COLOR”. The format is:
FactoryLink COLOR,AUTOCAD COLOR;
See the tables on pages 406 and 407 for color numbers.
Start the screen section with the word “SCREEN”. It defines the display screen’s width and height in pixels. The format is:
SCREEN HEIGHT,SCREEN WIDTH;
The Lines section begins with the word “LINES”. The format is:
FactoryLink LINE STYLE,AUTOCAD LINE STYLE;
See the table on page 407 for a list of line styles.
408 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Customizing the Conversion Settings
Translate File Guidelines
Use the following guidelines when you create a translate file:
• Do not insert blank line spaces between sections or after the last section.
• The FactoryLink font is case-sensitive. Be sure to type it using the original capitalization of the font. For example, Courier, not COURIER or courier. Use the Font Attributes dialog box to view the correct case and spelling.
• The section names (FONT, COLOR, SCREEN, and LINES), AutoCad fonts, and
AutoCad lines are not case-sensitive.
• Type the FactoryLink font using the original spacing of the font. For example,
Times New Roman, not TimesNewRoman.
To create a translate file:
1 Open a text editor.
2 Type the sections and styles you want to translate. Use the example on the previous page as a guide. Be sure to spell the section heading correctly and end each style conversion with a semi-colon (;).
Enter several conversions on one line, instead of using a different line for each (do not use spaces). For example:
Helv,txt,20;Helv,complex,10;Times,romans,20;
Table 31-0 Standard AutoCAD Fonts
Standard AutoCAD Fonts italicc txt monotxt romans italict romand romanc scripts scriptc greeks romant greekc gothice gothicg gothici cyrillic cyriltlc syastro symap synath symeteo symusic complex
31
FactoryLink 6.6.0 / Application Editor Guide / 409
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Customizing the Conversion Settings
3 Save the translate file as an ASCII text file. Use any filename and extension. For example, CUSTOM.XLT
If you do not specify a method for converting fonts in a translate file, they are converted and imported as graphics.
Using the Translate File
The custom conversions you set up in a translate file are only used when you specify the file in the DXF Converter dialog.
Type the full pathname of the translate file if you want to use it to specify how AutoCAD styles are converted to
FactoryLink styles.
If you only type the translate file filename, the Converter uses the current path shown in the Directory box. If you leave the Translate file box blank, the
Converter uses the default conversion settings. The DXF Converter uses the translate file for all of the DXF files you highlighted.
410 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Troubleshooting
T ROUBLESHOOTING
Conversion Errors
Errors can occur during a file conversion if there is a discrepancy in the DXF file format, such as missing information, or if the DXF file contains unknown data elements. If errors occur, the DXF Converter creates a file that contains the conversion errors. The name of the file is filename.err
where filename is the name of the DXF file being converted.
The error file is located in the same directory as the original DXF file and gives the DXF filename, FactoryLink filename, and error message for each error.
Possible error messages and their descriptions below.
Open an error file in an ASCII text editor to view it.
Error Messages
One or more of the following error messages display in the error file if there is a conversion error.
Abnormal End of File Encountered
Cause: The DXF file ends abnormally.
Action: Save the file again in AutoCAD; then try to convert it.
Cannot Find DXF File
Cause: The DXF file indicated could not be found.
Action: Be sure the path and filename are correct.
Cannot Find Response File
Cause: The response file indicated could not be found.
Action: Correct the name of the file.
Could Not Find Blocks Section
Cause: The Blocks section of a DXF file is missing.
Action: No action is necessary.
31
FactoryLink 6.6.0 / Application Editor Guide / 411
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Troubleshooting
Could Not Find Entities Section
Cause: The Entities section of a DXF file is missing.
Action: The file is corrupt and cannot be converted.
Could Not Find Header Section of DXF File
Cause: The Header section of the DXF file is missing.
Action: No action is necessary; the DXF Converter uses the default values.
Could Not Find Table Section of DXF File
Cause: The Table section of DXF file is missing.
Action: No action is necessary; the DXF Converter uses the default table values.
Could Not Open File
Cause: The DXF Converter could not open a file. The path may not exist or the filename may be wrong.
Action: Correct the name of the file.
Memory Allocation Error
Cause: The system ran out of memory while trying to convert the DXF file.
Action: Close any unnecessary windows or programs. Add more memory to the system if this error persists.
No APPID Table Found
Cause: The APPID table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
No DIMSTYLE Table Found
Cause: The Dimension Style table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
No LAYER Table Found
Cause: The Layer table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
412 / FactoryLink 6.6.0 / Application Editor Guide
CONVERTING AND IMPORTING DXF FILES
Troubleshooting
No LTYPE Table Found
Cause: The Line Style table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
No STYLE Table Found
Cause: The Style table in the DXF file is missing.
Action: No action is necessary. This is an information message only.
No VIEW Table Found
Cause: The View table of the DXF File is missing.
Action: No action is necessary. This is an information message only.
No VPORT Table Found
Cause: Viewport table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
No UCS Table Found
Cause: The User Coordinate System Table of the DXF file is missing.
Action: No action is necessary. This is an information message only.
Unknown Entity Encountered
Cause: An unknown AutoCAD drawing entity was encountered. The
DXF Converter ignores the entity.
Action: Contact Customer Support.
Unknown Group Code Encountered
Cause: An unknown AutoCAD drawing group code was encountered.
Action: The DXF Converter ignores the group code, but the conversion might be corrupted. Contact Customer Support.
Unknown Table Type Encountered
Cause: An unknown AutoCAD table was encountered.
Action: The DXF Converter ignores the table, but the conversion might be corrupted. Contact Customer Support.
31
FactoryLink 6.6.0 / Application Editor Guide / 413
•
•
•
•
CONVERTING AND IMPORTING DXF FILES
Troubleshooting
414 / FactoryLink 6.6.0 / Application Editor Guide
6.6.0
Part VII
Error Messages
415
Chapter 32
Application Editor
Messages
If any problems are encountered by the Application Editor during run time, an error message is displayed in the Run-Time Manager screen next to the name of the Application Editor task.
This chapter lists all messages that can occur during run time, describes their possible causes, and provides corrective actions.
Can’t locate options key
Cause: The option key may not be installed, or the license may not be enabled.
Action: Check to ensure the key is installed. Run the KEYINST and
FLKEYVAL utilities to make sure that the license is enabled.
Can’t open FL.OPT file
Cause: The FL.OPT
file has become corrupt or has been deleted, or the
FLINK environment variable is not set.
Action: Check the value of the FLINK environment variable. Check to see that the FL.OPT
file exists in the directory /FLINK/OPT .
Can’t read options key
Cause: The option key file FL.OPT
has become corrupt.
Action: Copy the file FLNEW.OPT
from the install diskette to the file
FL.OPT
in the directory /FLINK/OPT .
Drawing has unsaved changes
Cause: You made changes to a drawing and are trying to close the drawing or exit the Application Editor without saving the changes.
Action: Choose Save to close the drawing or exit the Editor and save the changes. Choose Discard to close the drawing or exit the Editor without saving the changes. Choose Cancel to cancel the close or exit and remain in the current drawing.
32
FactoryLink 6.6.0 / Application Editor Guide / 417
•
•
•
•
APPLICATION EDITOR MESSAGES
Error deleting file.
File not part of current application.
Cause: You attempted to delete a file not part of the current application.
The Application Editor can only delete files that are part of the current application.
Action: Exit the Application Editor and delete the file from the operating system prompt or from a file management utility to delete a graphic file that is not part of the current application.
Error importing file.
Cannot delete open drawing drawing file_name
Cause: You tried to import an open file.
Action: Close the open file and retry the import operation.
Error importing file.
Error opening file file_name for xref update
Cause: There may not be enough free disk space to delete both a file and its cross-reference. The file was successfully deleted, but not the cross-reference.
Action: Delete unneeded files to free up disk space.
Flags must be vbru
Cause: A flag of other than v, b, r, or u was found in the .AC file.
Action: Delete the invalid flag.
Grace period has expired. Software must be registered
Cause: FactoryLink was installed without registering it within the 10 day grace period.
Action: Run FLKEYVAL and follow the instructions for registration.
Missing KEY file
Cause: The system cannot find the KEY file /FLINK/KEY/XXX.KEY.
Action: Enter the correct key file name in .AC or create the required key file.
418 / FactoryLink 6.6.0 / Application Editor Guide
APPLICATION EDITOR MESSAGES
No RAM for options key
Cause: There is not enough memory to read the options key.
Action: Close any unnecessary windows or programs.
Object name
Object must have a name.
Cause: You have assigned a blank name to an object. The object does not have a name.
Action: Assign a unique name to the object.
Out of RAM
Cause: Not enough memory is available.
Action: Close any unnecessary windows or programs. If this occurs often, add memory to the system.
Run-time only license. Development option not installed.
Cause: A task may not be loaded and/or configured because it is not in the option key.
Action: Check the master and option key contents by typing UKEY -l.
Software has not been enabled
Cause: An error has occurred with the f1.key
file in the opt directory.
Action: Run KEYINST and if an invalid or archaic agreement is found, re-enter the configuration information.
Action: Run FLKEYVAL and follow the instructions for registration.
Warning: Name: Copy Ctrl + Ins, Class XmPushButtonGadget, Illegal mnemonics character; Could not convert X KEYSYM to a keycode.
Cause: Your keyboard cannot use the keyboard combination you selected.
Action: None. Do not use the selected keyboard combination.
32
FactoryLink 6.6.0 / Application Editor Guide / 419
•
•
•
•
APPLICATION EDITOR MESSAGES
420 / FactoryLink 6.6.0 / Application Editor Guide
Index
A accessing
Administrator Password dialog 384
alarm definitions
animating objects
animation
assigning a pen to a trend chart 167
beep
real-time only chart object 164
Animation menu
Beep
assigning a pen to a trend chart 167
combining template objects 202
converting and importing DXF files 401
Define Template Variable dialog 198
displaying template configuration 202
Input Text Animation dialog 153
object animation 32 object attributes
Index I-421
Output Text Animation dialog 159
simulating object rotation 193
unresolved template variables 203
Application Security Classes dialog 378
default conversion settings 405
B
Bar Animation dialog 184 bar objects 184
blink rate animation
BTB - Back Tab (Shift plus Tab) 231
Button Animation dialog 175 button object animation 175
C
calling functions/libraries 326
chart object
combining
configuring run-time windows 61
conversion settings, AutoCAD 405
converting
creating
I-422 FactoryLink 6.6.0
customizing
D
DALOG definitions 97 data-poing logging definitions 97
Define Template Variable dialog 198
defining
device communications
configuring, testing, troubleshooting 19
display scale
changing 57 selecting whole 57
displaying template configuration 202
drawing file
associating with a view window 58
closing
saving 41 saving with new name 41 saving with original name 41
setting the default window size 59
sharing between applications 45
drawing grid
drawings
duplicating template objects 200
DXF installing FactoryLink converter (Windows)
DXF files
conversion considerations 402 converter (Windows) 402
customizing conversion settings 408
Index I-423
E
Edit Window Selection dialog 62
error messages
Event Logging Configuration dialog 397
events
text events 269 text input routines menu 269
Export dialog 46 exporting files 46
F files
Frame Window Selection dialog 57
functions, calling in PowerVB 326
G
graphic object security
graphics
H
Hierarchical Graphic Object Naming 329
I
implicit variables, arrays as 277
importing
Input Text Animation dialog 153
installing
FactoryLink DXF converter (Windows)
I-424 FactoryLink 6.6.0
L
libraries
logging
Security events
Security
Login Dialog dialog 395 login messages 395
LogView
M methods
miscellaneous PowerVB statements 307
N
New Application User dialog 381
O object
objects
Output Text Animation dialog 159
P
Paint Animation dialog 181 paint objects 181
Password Verification Type dialog 383
pens
Application Editor
Index I-425
assigning to a trend chart 167
Power Packs
PowerVB
arrays as explicit variables 280
arrays as implicit variables 277
calculating object movement 255
creating a rotation script 315
explicit vs. implicit variables 284
LogView
properties, drawing 305 properties, window object 305
public
Print Screen Animation dialog 228
printing scripts to debug files 339
I-426 FactoryLink 6.6.0
properties
RTDB object 289 using in PowerVB 289
R
run-time windows
S
Scale/Deadband tab 99 scaling definitions 99 scaling/deadband definitions 99
scripts
debugging 339 document PowerVB 339
te
Security
overview
FLADMIN
application administrator duties 365
applications
Security Class Attributes dialog 379
Select Function Key dialog 230
setting
administrator password (Security) 384
simulating object rotation 193
starting Application Editor
Index I-427
using Configuration Manager 34 using icon 34 using start menu 34
sub-routines
Symbol Animation dialog 190 symbol objects 190
T
Tab
tag events
tag persistence definitions 88
tags
new
template animation
template variables, PowerVB 328
templates
testing
text events 269 text input routines menu 269
U
unresolved template variables 203
V variables
"this"
I-428 FactoryLink 6.6.0
View Window Selection dialog 65
W
Window Management Control panel 66
windows
object
X
X Position
Z zoom
Index I-429
Advertisement