PDMS PML二次开发-Pipe Flow Indicator

PDMS PML二次开发-Pipe Flow Indicator

AVEVA PDMS中管路流向显示程序:

 

PML程序源代码如下:

---------------------------------------------------------------------------------
--
-- (c) Copyright 2010 to Current Year 
-- Shanghai Hoto Petrochemical Engineering Co., Ltd
-- eryar All rights reserved.
--
--  File:          pipeflow.pmlfrm
--  Type:          Form Definition
--  Group:         General Application
--  Keyword:       GEN
--  Module:        DESIGN
--
-- Author:          eryar@163.com
-- Created:         2010-09-17 15:15
--
-- Description:     Indicate pipe media flow direction.
--
---------------------------------------------------------------------------------
setup form !!pipeflow
        !This.FormTitle         =       'Pipe Flow Indicator'
        !This.Cancelcall        =       '!This.close()'
        !This.FormRevision      =       '1.0v'
 
        frame .pipeFlowFrame
                button  .bCE    'CE'   
                para    .ceName                 at      xmax            ymin    width 16 line 1
 
                toggle  .turn   'On/Off'        at      xmax            ymin                    
        exit
                
exit
 
---------------------------------------------------------------------------------
--
-- Method:      pipeflow()
--
-- Description:  
--
-- Method Type: Function/Procedure
-- Arguments:
--   [#] [R/RW] [Data Type] [Description]
-- Return:
--   [Data Type] [Description]
--
---------------------------------------------------------------------------------
define method .pipeflow()
        !this.bCE.callback      =       '!this.getCE()'
        !this.turn.callback     =       '!this.apply()'
endmethod
---------------------------------------------------------------------------------
--
-- Method:      getCE()
--
-- Description:  get current element for indicate pipe media flow
--
-- Method Type: Function/Procedure
-- Arguments:
--   [#] [R/RW] [Data Type] [Description]
-- Return:
--   [Data Type] [Description]
--
---------------------------------------------------------------------------------
define method .getCE()
        --
        !currentElement =       ce
        !elementName    =       !currentElement.Name
        !this.ceName.val=       !elementName
 
endmethod
---------------------------------------------------------------------------------
--
-- Method:      apply()
--
-- Description:  
--
-- Method Type: Function/Procedure
-- Arguments:
--   [#] [R/RW] [Data Type] [Description]
-- Return:
--   [Data Type] [Description]
--
---------------------------------------------------------------------------------
define method .apply()
        -- remember where we came in
        !memory =       ce
        
        -- turn on pipe media flow
        if(!this.turn.val) then
                -- collect all branches 
                var !branches collect all bran for $!this.ceName.val
                
                do !i index !branches
                        -- handle every branch
                        !branch =       !branches[$!i].dbref()
                        !hPos   =       !branch.hPosition
                        !tPos   =       !branch.tPosition
                        !hDir   =       !branch.hDirection
                        !tDir   =       !branch.tDirection
                        !hBore  =       !branch.hBore
                        !tDir   =       !tDir.Opposite()
                        !arrow  =       !hBore.real() * 2
 
                        -- add two aid arrow at head and tail
                        AID ARROW AT $!hPos DIR $!hDir HEIGHT $!arrow PROPORTION 0.35
                        AID ARROW AT $!tPos DIR $!tDir HEIGHT $!arrow PROPORTION 0.35
 
                        -- add aid arrow on elbow
                        var !elbows collect all elbow for $!branch
                        do !j index !elbows
                                !elbow          =       !elbows[$!j].dbref()
                                !arrive         =       !elbow.Arrive
                                !leave          =       !elbow.Leave
                                $!elbow
                                var !arrivePos  P$!<arrive>     position wrt world
                                handle (2,201)
                                        -- element does not have attribute PPOS
                                        skip
                                endhandle
                                var !leavePos   P$!<leave>      position wrt world
                                handle (2,201)
                                        -- element does not have attribute PPOS
                                        skip
                                endhandle
                                var !arriveDir  P$!<arrive>     direction wrt world
                                var !leaveDir   P$!<leave>      direction wrt world
                                !arriveDir      =       !arriveDir.Direction().Opposite().string()
                                --
                                AID ARROW AT $!arrivePos DIR $!arriveDir  HEIGHT $!arrow PROPORTION 0.35
                                AID ARROW AT $!leavePos  DIR $!leaveDir   HEIGHT $!arrow PROPORTION 0.35
                        enddo
 
                        -- add aid arrow on valve
                        var !valves collect all valve for $!branch
                        do !h index !valves
                                !valve  =       !valves[$!h].dbref()
                                !vPos   =       !valve.Position
                                --
                                AID ARROW AT $!vPos DIR $!arriveDir  HEIGHT $!hBore PROPORTION 0.8
                        enddo
 
                        -- add aid arrow on tubi
                        var !tubes collect all tubi for $!branch
                        do !k index !tubes
                                !tube   =       !tubes[$!k].dbref()
                                !itsLen =       !tube.itLength
                                !itsPos =       !tube.itPosition
                        enddo
                enddo
        else
                -- turn off pipe media flow, clear all aid arrow
                AID CLEAR ALL
        endif
 
        -- go back 
        !!ce    =       !memory
endmethod
---------------------------------------------------------------------------------
--
-- Method:      close()
--
-- Description:  
--
-- Method Type: Function/Procedure
-- Arguments:
--   [#] [R/RW] [Data Type] [Description]
-- Return:
--   [Data Type] [Description]
--
---------------------------------------------------------------------------------
define method .close()
        -- after close the form, clear all aid arrow
        AID CLEAR ALL
endmethod
---------------------------------------------------------------------------------

				
时间: 2024-08-01 15:44:45

PDMS PML二次开发-Pipe Flow Indicator的相关文章

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

AVEVA PDMS PML 二次开发之模糊查找工具FuzzySearch 在AVEVA Plant(PDMS)/AVEVA Marine中,要查找一个不是很清楚的元素可能有些不便,使用PML开发了一个模糊查找的小工具,如下图所示: 使用方法: 1. 在key word中输入需要查找的部件的名字或名字的一部分: 2. 也可输入通配符,如*表示求知的任意几个字符, ?表示求知的一个字符: 3. 查找到的元素将会在列表中显示出来,在列表中选择,将会在模型中定位到选择的元素:   2012.12.6看

AVEVA PML二次开发之标注样式设置

AVEVA Draft Dimension Style eryar@163.com 在AVEVA Draft中可以标注尺寸,尺寸的标注也有一些样式.通过PML二次开发的小程序可以方便设置尺寸标注的样式.设置内容与AutoCAD中的大致相同,肯定没有AutoCAD中那么多,如下图所示: 使用方法: 选中需要设置的尺寸标注,可以是一个DEPT,REGI,DRWG,SHEE,也可以是单独的一个标注: 设置样式: 确定.   源码下载: DimensionStyle.pmlfrm

AVEVA Draft自动出图二次开发

AVEVA Draft Auto Drawing Customisation AVEVA Draft自动出图二次开发 eryar@163.com 摘要Abstract:本文简要描述了CAD软件自动出图的意义,详细说明AVEVA Draft模块的PML二次开发步骤,并给出了PML实例,便于理解及工程应用.通过对Draft的二次开发,可以根据需要对指定模型进行自动出图,提高工作效率. 关键字Key Words:AVEVA Draft.PDMS.PML.Automatical Drawing 一.引言

json-ecshop二次开发,JSON功能的使用

问题描述 ecshop二次开发,JSON功能的使用 想在ecshop二次开发中,想在提交订单页添加一个优惠券功能,输入优惠券编号点击"更新"即可修改所付金额,在此我是用的是JSON无刷新功能,但输入优惠券编号,点击 "更新" 始终没有反应,恳请高手大哥指点小弟一下,谢谢! flow.dwt flow.php

UCenter Home二次开发指南_php技巧

前言本文将就UCH二次开发这个核心主题,以各种实现的代码为主,辅助部分说明概略的讲解如何针对UCH进行二次开发.过段时间UCH就开源了,准备到时候再详细的写篇UCH机制分析. 顺便说下,这篇文件写在大约两周以前,但是一直没有时间整理发布,今天听说UCH会在最近一段时间开源,到时候再发反而对大家帮助不大,所以决定不再整理,虽然文中一些说明还不详细,但是已经基本成文. 数据调用这里的数据调用是使用UCenter Home内置的数据调用,在后台的"高级应用"里有"数据调用"

长连接-c#腾讯企业邮箱二次开发实现新邮件提醒

问题描述 c#腾讯企业邮箱二次开发实现新邮件提醒 新邮件提醒,需要维持长连接,图片是API文档关于长连接的描述, 但是我获取到token,传入参数ver=0,返回错误,无效的请求,有做过这个功能的吗,求助啊!! private bool GetPostData(string url, string pars, ref string json) { System.GC.Collect(); //url=请求的地址,pars= "var=0" string ret = "&quo

cad-CAD二次开发如何与Excel之间通信

问题描述 CAD二次开发如何与Excel之间通信 AutoCad中利用Ole已经包含了导入Excel表格功能,但我想自己编写一个小软件导入Excel表格,请问如何利用CAD提供的接口去开发?

ae-AE 二次开发 请问:已经有个feature,怎么找离它最近的点要素?求帮助,急需。新手,求代码

问题描述 AE 二次开发 请问:已经有个feature,怎么找离它最近的点要素?求帮助,急需.新手,求代码 AE+C# 二次开发 请问:已经有个feature,怎么找离它最近的点要素?求帮助,急需.或者说:怎么找距离某个面要素最近的那个点要素.求代码~~ 解决方案 http://bbs.csdn.net/topics/391078057?page=1

微信二次开发问题 无法调用分享至朋友圈的接口

问题描述 微信二次开发问题 无法调用分享至朋友圈的接口 项目使用thinkphp开发 js安全接口之类的已经在公众号里面配置过了 但是没有设置启用服务器配置. 代码是按照微信给的demo的 wx.config()里面开了debug之后是显示ok的 但是微信的接口调用却不能用 其他接口也试过了 $timestamp=time(); $nonceStr='suyano827sa0asd2'; $url="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]&