AVEVA PDMS PML 二次开发之模糊查找工具

简介: AVEVA PDMS PML 二次开发之模糊查找工具FuzzySearch 在AVEVA Plant(PDMS)/AVEVA Marine中,要查找一个不是很清楚的元素可能有些不便,使用PML开发了一个模糊查找的小工具,如下图所示: 使用方法: 1.

AVEVA PDMS PML 二次开发之模糊查找工具FuzzySearch

在AVEVA Plant(PDMS)/AVEVA Marine中,要查找一个不是很清楚的元素可能有些不便,使用PML开发了一个模糊查找的小工具,如下图所示:

Main GUI

使用方法:

1. 在key word中输入需要查找的部件的名字或名字的一部分;

2. 也可输入通配符,如*表示求知的任意几个字符, ?表示求知的一个字符;

3. 查找到的元素将会在列表中显示出来,在列表中选择,将会在模型中定位到选择的元素;

 


2012.12.6
看很多人比较喜欢这个工具,将其源代码陈列如下:

  1 -------------------------------------------------------------------------------
  2 -- Copyright (C) 2010 eryar@163.com All Rights Reserved.
  3 --
  4 -- File:            FuzzySearch.pmlfrm
  5 --   Type:          Form Definition
  6 --   Group:         Application
  7 --     Keyword:     MDS
  8 --   Module:        DESIGN
  9 --
 10 -- Author:          eryar@163.com
 11 -- Created:         2012-8-15 19:22
 12 --
 13 -- Description:     Fuzzy search element.
 14 --
 15 -------------------------------------------------------------------------------
 16 setup form !!fuzzysearch
 17     !this.formtitle     =  ' Fuzzy Search '
 18     !this.cancelCall    =  ' !this.OnCancel() '
 19     !this.formRevision  =  ' 0.1v '
 20 
 21     frame .fuzzySearchFrame
 22         text    .tKeyWord    ' Key Word: ' width 18  is string
 23         button  .bGo         ' Go '    callback     ' !this.OnOk() '
 24         button  .bHelp       ' ? '     callback     ' !this.OnHelp() '
 25         list    .lResult    at xmin.tKeyWord ymax+0.2    width 36 height 16
 26     exit
 27 
 28     path down
 29 
 30     button  .bCancel     ' Cancel '    callback     ' !this.OnCancel() '
 31 
 32 exit
 33 -------------------------------------------------------------------------------
 34 --
 35 -- Method:      fuzzySearch()
 36 --
 37 -- Description: default constructor.
 38 --
 39 -- Method Type: Function/Procedure
 40 -- Arguments:
 41 --   [ # ] [R/RW] [Data Type] [Description]
 42  -- Return:
 43 --   [Data Type] [Description]
 44 --
 45 -------------------------------------------------------------------------------
 46 define method .fuzzysearch()
 47     !this.lResult.callback  =    ' !this.zoomSelection() '
 48 endmethod
 49 -------------------------------------------------------------------------------
 50 --
 51 -- Method:      apply()
 52 --
 53 -- Description: apply the operation.
 54 --
 55 -- Method Type: Function/Procedure
 56 -- Arguments:
 57 --   [ # ] [R/RW] [Data Type] [Description]
 58  -- Return:
 59 --   [Data Type] [Description]
 60 --
 61 -------------------------------------------------------------------------------
 62 define method .OnOk()
 63     -- 1. Check the input name;
 64      if(!this.tKeyWord.val.Empty()) then
 65         !!alert.message( ' Please input the key word! ')
 66          return 
 67     endif
 68 
 69     -- 2. Collect all elements  for the whole world;
 70     var !allElements collect all  for world
 71 
 72     -- 3. Search the element include the keyword;
 73     -- If include the keyword, add the element to
 74     -- the result list.
 75     !dtext  = array()
 76     !rtext  = array()
 77     !strName= string()
 78     !strKeyWord = !this.tKeyword.val
 79 
 80     do !element values !allElements
 81         -- 
 82         !current    = object dbref(!element)
 83         !strName    = !current.namn
 84         
 85          if(!strName.MatchWild(!strKeyWord)) then
 86             !dtext.append(!strName)
 87             !rtext.append(!element)
 88         endif
 89         
 90     enddo
 91 
 92     -- 4. Add to the result list.
 93     !this.lResult.dtext = !dtext
 94     !this.lResult.rtext = !rtext
 95 
 96 endmethod
 97 -------------------------------------------------------------------------------
 98 --
 99 -- Method:      ZoomSelection()
100 --
101 -- Description: Zoom to the selected element.
102 --
103 -- Method Type: Function/Procedure
104 -- Arguments:
105 --   [ # ] [R/RW] [Data Type] [Description]
106  -- Return:
107 --   [Data Type] [Description]
108 --
109 -------------------------------------------------------------------------------
110 define method .ZoomSelection()
111     !selection  = !this.lResult.Selection()
112     !selected   = object dbref(!selection)
113     
114     -- Zoom to selection.
115     add $!selected
116     auto $!selected
117 
118 endmethod
119 -------------------------------------------------------------------------------
120 --
121 -- Method:      OnCancel()
122 --
123 -- Description: 
124 --
125 -- Method Type: Function/Procedure
126 -- Arguments:
127 --   [ # ] [R/RW] [Data Type] [Description]
128  -- Return:
129 --   [Data Type] [Description]
130 --
131 -------------------------------------------------------------------------------
132 define method .OnCancel()
133     !this.hide()
134 endmethod
135 -------------------------------------------------------------------------------
136 --
137 -- Method:      OnHelp()
138 --
139 -- Description: Show how to use information.
140 --
141 -- Method Type: Function/Procedure
142 -- Arguments:
143 --   [ # ] [R/RW] [Data Type] [Description]
144  -- Return:
145 --   [Data Type] [Description]
146 --
147 -------------------------------------------------------------------------------
148 define method .OnHelp()
149     !!alert.message( ' In the KeyWord * for any number of characters and ? for any single chararcter. ')
150 endmethod
151 -------------------------------------------------------------------------------
目录
相关文章
|
C# C++ Windows
PDMS call Operating System Command
PDMS call Operating System Command eryar@163.com 1.Introduction AVEVA提供了三种二次开发的方式:DARs, PML和AVEVA .Net(C#)。
2751 0
|
6月前
|
存储 人工智能 API
2026年阿里云计算巢部署OpenClaw保姆级流程:从0到1打造AI Agent
OpenClaw是一款轻量、开源的AI智能体运行框架,可快速对接大模型能力,实现自主任务规划、工具调用与多端交互。2026年,阿里云计算巢提供OpenClaw官方部署模板,支持一键式、可视化部署,无需复杂环境配置,即可快速搭建专属AI Agent。以下从前置准备、核心部署、模型对接、功能配置、运维优化五大环节,提供保姆级实操流程,覆盖从0到1的全步骤,确保零基础用户也能顺利完成部署。
313 0
|
JSON JavaScript Android开发
原生与 Uniapp 的通信机制是如何实现双向调用的?
原生与 Uniapp 的通信机制是如何实现双向调用的?
1427 137
|
12月前
|
Java 关系型数据库 Docker
Docker + Spring Boot:天生一对的完美部署
使用Docker部署Spring Boot项目能极大简化环境配置和应用分发。要将Spring Boot项目部署到Docker,主要流程是:准备项目、创建Docker镜像、运行Docker容器。
633 0
|
Web App开发 Ubuntu 安全
Ubuntu操作系统全解析:桌面、服务器与风格详解
Linux Mint同样源自Ubuntu操作系统,并针对现代用户需求,预装了众多照片和多媒体应用程序。该系统秉承开源社区的理念,为用户提供安全、稳定且易于使用的操作系统。想要深入了解Linux Mint,不妨访问其官方网站。
|
存储 安全 Java
如何优雅地回答HashSet与HashMap的区别?看这里!
哈喽,大家好!我是小米,29岁程序员。本文聚焦Java开发中经典的面试题——HashSet和HashMap的区别。HashSet基于HashMap实现,存储唯一值;HashMap存储键值对。两者在数据结构、使用场景、操作方法等方面有显著差异。HashSet无序且依赖元素的hashCode和equals方法保证唯一性,而HashMap需注意线程安全问题。掌握这些知识点,助你轻松应对面试。更多技术干货,欢迎关注我的微信公众号“软件求生”。
931 4
|
Java 应用服务中间件
Process exited with an error: 1 (Exit value: 1) 问题处理
本文介绍了在本地启动项目时遇到“Process exited with an error: 1”错误的解决过程。作者首先排除了配置文件修改的影响,通过分析错误信息,推测为端口占用问题,并使用 `netstat -ano` 命令检查端口占用情况,最终通过终止占用端口的进程解决了问题。
|
数据库 项目管理 安全
AVEVA Plant(PDMS)数据库的保护
AVEVA Plant(PDMS)数据库的保护 eryar@163.com   以下内容摘自一网友邮件: ----- Original Message ----- Sent: Tuesday, September 25, 2012 9:46 PM Subject: PDMS项目管理 你好,看了你写的很多文章,大部分都是关于程序出图的设置,我想咨询你一个关于PDMS项目管理的问题,希望能够赐教。
2749 0
|
存储 算法
最短路径算法( Dijkstra + Bellman-Ford + SPFA + Floyd)
最短路径算法( Dijkstra + Bellman-Ford + SPFA + Floyd)
3483 0
|
C# 数据库 C++
AVEVA PDMS数据接口开发
AVEVA PDMS数据接口的开发 eryar@163.com          摘要:本文简要介绍AVEVA Plant/PDMS数据接口的开发方式。        关键字:AVEVA Plant、PDMS、DARs、二次开发、数据接口   一、概述 Overview AVEVA提供了三种二次开发的方式:DAR(Data Access Routines)、C#、PML(AVEVA Programmable Macro Language)。
4066 0