PDMS管线出图前处理程序 话说项目进入出图阶段,管线设计过程中各种小问题也都暴露了出来,如管线编号不正确、管件压力等级误选、直管段长度不满足要求以及各种冗余信息等等。一条条改起来非常繁琐,而且容易出现遗漏。根据近期实战经验,编制了一段批处理程序,实现以下功能: (1)自动检查并更正管线号编码,主要修改英寸符号问题; (2)自动检查管线分支实际压力等级与管线号指定等级是否一致; (3)自动关闭支架SREF出料,清理ISO图中冗余信息; (4)检查管线头尾是否与设备管嘴相连,如果是,则自动关闭与之配对的法兰、垫片和螺栓的出料信息; (5)检查所有直管段创度,如果小于最小允许值,则在模型中标出长度并提示修改。 --CODED BY HANYF, EDI OF CPOE Onerror CONTINUE --onerror GOLABEL /ReportERR !MINTUBILEN = 75 !curCE=!!CE Var !pipes COLLECT ALL PIPE for CE -- 检查管线号命名,主要检查英寸符号 DO !Pipe VALUES !Pipes !!CE=Object DBREF(!Pipe) !Name=!!CE.Name.TRIM() !Pos=!Name.match('-') !aftName=!Name.substring(!pos) !preName=!Name.substring(1,!pos - 1 ) !tmpStr='/' !endPos=!pos - 1 DO !i from 1 to !endPos by 1 !Num=!preName.substring(!i,1) if (Match('0123456789',!num) GT 0) Then !tmpStr=!tmpStr + !Num endif ENDDO !!CE.Name=!tmpStr.Trim() + '"' + !aftName ENDDO !!CE=!curCE Var !brans COLLECT ALL BRAN for CE -- 检查分支实际使用等级与管线号中指定等级是否匹配 DO !bran VALUES !brans !!CE=Object DBREF(!bran) !realSpec=!!CE.Pspec.name.substring(2) if (Match(!!ce.Owner.name,!realSpec) EQ 0) then $P $!!ce.name 's rating not matched. else --$P $!realSpec is OK endif ENDDO !!CE=!curCE Var !supps COLLECT ALL ATTA for CE --清除ISO图中冗余支吊架信息 DO !supp VALUES !supps !!CE=Object DBREF(!supp) !Name=!!CE.Name.trim() if (Match(!Name,'SREF') ne 0) then MTOC OFF endif ENDDO !!CE=!curCE Var !brans COLLECT ALL BRAN for CE --检查管线头尾是否连接到设备管嘴,如果是,则关闭配对法兰、垫片、螺栓出料 DO !bran VALUES !brans !!CE=Object DBREF(!bran) if (Unset(!!CE.Href)) then $P $!!CE.Name Href is not set else if (BadRef(!!CE.Href)) then $P !!CE.Name has bad Href,check it endif if (!!CE.Href.type eq 'NOZZ') then if (!!CE.Href.Owner.type eq 'EQUI' or !!CE.Href.Owner.type eq 'SUBE') then if( !!CE.member[1].type eq 'GASK') then !!CE.member[1].MTOC='OFF' endif if( !!CE.member[2].type eq 'FLAN') then !!CE.member[2].MTOC='OFF' endif $P $!!CE.Name : Head Flan GASK MTO set off endif endif endif !lstPos=!!CE.member.MaxIndex() if (Unset(!!CE.Tref)) then $P $!!CE.Name Tref is not set else if (BadRef(!!CE.Tref)) then $P !!CE.Name has bad Tref,check it endif if (!!CE.Tref.type eq 'NOZZ') then if (!!CE.Tref.Owner.type eq 'EQUI' or !!CE.Tref.Owner.type eq 'SUBE') then if( !!CE.member[!lstPos].type eq 'GASK') then !!CE.member[!lstPos].MTOC='OFF' endif !scdPos=!lstPos - 1 if( !!CE.member[!scdPos].type eq 'FLAN') then !!CE.member[!scdPos].MTOC='OFF' endif $P $!!CE.Name : Tail Flan GASK MTO set off endif endif endif ENDDO !!CE=!curCE -- 检查直管段长度,是否满足最小直管段的要求 Var !Tubis COLLECT ALL TUBI for CE !aid = 1 DO !Tubi VALUES !Tubis !!CE=Object DBREF(!Tubi) if (!!CE.badref() ) then skip endif if (!!CE.itLen LT !MINTUBILEN ) then !frmPos=!!CE.aPos !toPos=!!CE.lPos !midPos=!frmPos.midPoint(!toPos) !msg=!aid.string() + ':Too short,' & !!CE.itLen.STRING('D2') AID LINE NUMBER $!aid $!frmPos TO $!toPos AID TEXT NUMBER $!aid |$!msg| at $!midPos !aid=!aid + 1 endif ENDDO Label /ReportErr handle ANY $P ----------Error------------ $P $!!Error.Text $P $!!Error.Command $P $!!Error.Line $P --------------------------- endhandle |