Using a macro to write values, Reading data point smartshape values, Using an add-on to read values – Echelon IzoT Commissioning Tool User Manual

Page 210

Advertising
background image

In the X cell of the Scratch section, enter a formula. For example, to create a formula that
brightens a lamp when you double-click the Visio shape, enter the following:
=FORMAT(MODULUS("<Data Point SmartShape ID>!User.MonValue"+10,110), "0").

Using a Macro to Write Values

To write to a value to a Data Point SmartShape using a Macro, follow these steps:

1. Click the Developer tab, and then click Macros. The Macros dialog box opens.

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).

194

Monitoring and Controlling Networks

Advertising