Project

General

Profile

Feature #441

增加ehmi的获取当前图元名称代码lua界面脚本

Added by yufeng wu almost 5 years ago. Updated almost 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
Start date:
02/28/2020
Due date:
% Done:

100%

Estimated time:
Defect version:

Description

当前站、专业、二级图菜单的图元名称,采用车站组号代码复用、专业代码-专业目录复用、svm图名代码复用方式工程组态设计,当点击触发时,需要获取当前点击的图元名称,并设置相应标志,调取相应svm图
GCG顾村公园站名组号代码,PSCADA电力专业代码,SYCT车站一次图svm文件名
例如,1#站○按钮图元名为GCG,电力专业按钮图元名PSCADA,电力专业的二级菜单中的‘一次主接线’文本图元名SYCT
当点击"‘一次主接线’文本图元"时,触发调用GCG/PSCADA/SYCT.svm图,同时‘SYCT’图元变色,并记录好被点击标志,
当另外一个新的菜单被点击时,需要把‘SYCT’被点击标志去除,并颜色变回正常。

History

#1

Updated by yufeng wu almost 5 years ago

应用场景举例:当前图元,指单个图元本身,当本图元被点击时,使用脚本获取当前图元的名称
例如选站按钮被点击时:n个站的车站图元点击触发脚本,需要逐个分别设置车站宏设置【sta ="NDL"】;自动获取图元名getsymbolname(),则可以所有车站图元采用同一语句sta =getsymbolname()
---选站点击触发脚本
sta ="NDL" ---站组代码---后改自动获取图元名getsymbolname()
StaNo=27 ---站id
intScno = getscreenno()
setvdatastr(10*(intScno-1)+1, getvdatastr(100+StaNo))
setvdataint(10*(intScno-1)+1, StaNo)
SS1 = getvdatastr(10*(intScno-1)+1)
SS2 = getvdatastr(10*(intScno-1)+2)
SS= SS1.."/"
SS= SS..SS2
SS= SS.."/"
SS= SS..getvdatastr(10*(intScno-1)+3)
openwnd(SS,0,0,0,0,intScno)

#2

Updated by yufeng wu almost 5 years ago

已测试验证OK
static int GetSymbolName(lua_State *L)//获取当前图元名 {
CGWnd pGWnd;
CBaseObj *pObj = GetGlobal(L)->GetObjByName(NULL, pGWnd);
if (pObj)
lua_pushlstring(L, pObj->GetObjectName(), strlen(pObj->GetObjectName()));
return 1; /
返回值的个数 */
}

#3

Updated by xiangyang li almost 5 years ago

  • Assignee set to zhixue wei

需要增加异常处理:pObj==NULL

#4

Updated by zhixue wei almost 5 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF