eryar

PipeCAD - Plant Piping Design Software.
RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
posts - 603, comments - 590, trackbacks - 0, articles - 0

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

Posted on 2012-08-15 19:58 eryar 阅读(4727) 评论(7)  编辑 收藏 引用 所属分类: 4.AVEVA Solution

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

Feedback

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2012-08-15 23:24 by tb
不错的工具 下载了 谢谢博主

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2012-08-18 14:55 by dsmilely
无法下载?

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2012-08-19 20:01 by eryar
可以发邮件给我, 我发给你......@dsmilely

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2012-08-25 16:33 by xiaoxin
收录你的文章到www.3d-sharp.com pdms论坛了 请多多支持

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2012-09-09 17:30 by eryar
欢迎转载,注明出处即可。@xiaoxin

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2014-03-21 11:02 by 王德军
您好,可以请教个问题吗?PDMS的数据库文件支持不安装PDMS就能访问他的数据吗?还是需要先转一下。

# re: AVEVA PDMS PML 二次开发之模糊查找工具  回复  更多评论   

2014-03-21 12:54 by eryar
你好,
可以使用AVEVA提供的Dars, C#的SDK等二次开发库来直接访问他的Design及其他类型数据库,这样就可以不安装PDMS。
@王德军

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理