xwang

如何自动在悬浮框里加入点“描述”属性

Discussion created by xwang Employee on Apr 10, 2013

很多用户需要在PI ProcessBook的鼠标悬浮框中显示点的描述属性“discriptor"。这个方案是使用VBA程序的方式,当有任何的组件,如”value“ 或 ”trend"被加入到.pdi图中时,这些组件所包含的点的“discriptor"属性将会被自动的添加

 

方法:
1.    打开一个.pdi文件
2.    打开VBA编辑器 (Tools --> Macro --> Visual Basic Editor)
3.    计入PI SDK引用 (Tools --> References --> PISDK 1.x Type Library)
4.    双击 "ThisDisplay"
5.    选择需要编辑的.pdi文件(左边的下拉框)
6.    选择 "ToolTipText" (右边的下拉框)
7.    编辑程序如下:

 
Private Sub Display_ToolTipText(ToolTip As String, valSymb As Symbol)                       
Dim ptPoint As PISDK.PIPoint                                                                
Dim tagName() As String                                                                     
' Parse the pi tag into an array using '\' as a delimiter
tagName = Split(valSymb.GetTagName(1), "\", -1)
' Is it a pi tag (\\server\tag --> split into three strings: Nothing, server, tagname)
If UBound(tagName) = 3 Then
Set ptPoint = PISDK.Servers(tagName(2)).PIPoints(tagName(3))
ToolTip = ToolTip & " " & ptPoint.PointAttributes("descriptor") & ""
End If

End Sub

 

Outcomes