Reading from a data point shape value, Using an add-on, Using a macro – Echelon LonMaker User Manual
Page 207

LonMaker User’s Guide
191
9. Open
the
Windows menu and click Show ShapeSheet. The ShapeSheet of the selected Visio
shape opens.
10. 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 from a Data Point Shape Value
You can use a Visio shape to read a value in a Data Point shape. You can read a Data Point shape
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 the lighting HMI example, the color and text (with the Macro only) of a Visio shape is updated
when the value in the Data Point shape monitoring the Feedback output network variable on the
digital output functional block changes.
Using an Add-On
To use an Add-On to have a Visio shape read from a value in a Data Point shape, follow these steps:
1. Click a Visio shape that is reading a Data Point shape monitoring an input or output network
variable.
2. Open
the
Windows menu and click Show ShapeSheet. The ShapeSheet of the selected Visio
shape opens.
3. Enter the following function the FillForegnd cell of the FillFormat section: (“<Data Point
Shape ID>!User.MonValue”). For a Visio shape that is reading the state of a lamp, the color of
the Visio shape will toggle between black (off) and white (on).
• To change the color for the “on” state, you can perform some arithmetic function on the Data
Point shape value. For example, to change the color of the Visio shape to yellow when the
lamp is on, enter the following function: (“<Data Point Shape ID>!User.MonValue”)*5.
• If you are monitoring the lamp value, you can change the color of the Visio shape based on
the brightness of the lamp. To do this, enter the following function: (“<Data Point Shape
ID>!User.MonValue”)/10.
4. Press
ENTER.
Using a Macro
To read from a Data Point shape value using a Macro, follow these steps:
1. Open
the
Tools menu, point to Macros, and then click Macros on the shortcut menu. The Macros
dialog box opens.
2. In
the
Macros Name: dialog box, enter a name for the Macro. Click Create. The Network
Passwords dialog appears if this is the first time you are creating a Macro or entering VBA code
in your LonMaker drawing.
3. Enter
enumerate in the Password box.
4. The Visio VBA editor appears.
5. In the right pane, enter VBA code for the Visio shape to read from a data point. The following
code is used to change the text in the Visio shape to “On” and the shape color to yellow when the
state of the lamp is on (1). If the state of the lamp is off (0), the text in the Visio shape changes to
“Off” and the shape color changes to black.
Sub LAMP_ON_OFF()
Dim vsoPage As Visio.Page
Dim myshape As Shape