Reading data point smartshape values, Using an add on to read values, Using an add-on to read values – Echelon OpenLNS Commissioning Tool User Manual

Page 208

Advertising
background image

192

Monitoring and Controlling Networks

2. In the Macros Name: dialog box, enter a name for the Macro. Click Create. The Network

Passwords dialog opens if this is the first time you are creating a Macro or entering VBA code in
your OpenLNS CT drawing.

3. Enter enumerate in the Password box.

4. The Visio VBA editor opens. The left pane of the editor displays the OpenLNS CT drawing; the

right pane displays the VBA code associated with the Macro you are creating.

5. To insert a Macro to write to a scalar data point, enter the following VBA code:

Set myaddon = Application.Addons("LMW Set Value")

myaddon.Run ("/doc=<document ID> /page=<page ID> /SelOverride
/SmartShapeOverride=<Data Point SmartShape ID> /Value= n")

Document ID is the document in which the Visio shape resides.

Page ID is the page in which the Visio shape resides.

6. To insert a Macro to write to a field in a structured data point, enter the following VBA code:

Set myaddon = Application.Addons("LMW Set Field Value")

myaddon.Run ("/doc=<document ID> /page=<page ID> /SelOverride
/SmartShapeOverride=<Data Point Shape ID> /Value= n")

7. Enter additional code for any other functions to be performed when you double-click the Visio

shape.

8. In the OpenLNS CT drawing, right-click the Visio shape, and then click Show ShapeSheet on the

shortcut menu. The ShapeSheet of the selected Visio shape opens.

9. In the EventDblClick cell of the Events section, enter the following function:

RUNMACRO("<Macro name>"), where Macro Name is the name of the Macro you entered in
step 2.

Reading Data Point SmartShape Values

You can use a Visio shape to read a value in a Data Point SmartShape. You can read a Data Point
SmartShape using an Add-On or a Macro. If you want to perform a function based on the data point
value, create a Macro; otherwise, use an Add-On.

Using an Add-On to Read Values

To use an Add-On to have a Visio shape read from a value in a Data Point SmartShape, follow these
steps:

1. Click a Visio shape that is reading a Data Point SmartShape monitoring an input or output

network variable.

2. Right-click the Visio shape, and then click Show ShapeSheet on the shortcut menu. The

ShapeSheet of the selected Visio shape opens.

3. Enter the following function the FillForegnd cell of the FillFormat section: Sheet.<Data Point

SmartShape ID index>!User.MonValue. For a Visio shape that is reading the state of a lamp, the
color of the Visio SmartShape will toggle between yellow (on) and white (off).

Data Point SmartShape ID index refers to the numeric digits at the end of the Data Point
SmartShape name. For example, if the name of Data Point SmartShape is Data Point.53, you will
enter Sheet.53!User.MonValue (essentially, replace “Data Point” with “Sheet”).

• To change the color for the “on” state, you can perform some arithmetic function on the Data

Point SmartShape value. For example, to change the color of the Visio SmartShape to yellow
when the lamp is on, enter the following function: Sheet.<Data Point SmartShape ID
index
>!User.MonValue *5.

Advertising