Connect Automatically components to the changed Gasket thickness

 
  • Guys,  
    Do you have any idea or simple macros that helps for connecting automatically the components like (FLG/Valve/Spectacle blind) to the changed gasket thickness? for some reason after design of project the thickness of gasket changed and we have to connect all the model components to the gaskets again. I was thinking to make a list and use 'Conn CE Next' command for connecting the components but How can we deal with forward/backward of components if using that list?

    Thanks,
  • may do loop on the components within the branch will help.
    with command
    Conn CE Next.
  • The example here below is a very easy and simple macro.
    I show it during my training courses when I change the overall length of a parametric valve/inst
    You need to run it when your valve/inst is the CE

    NEX
    CONN
    NEX
    CONN
    PREV
    PREV
    PREV
    BACK
    CONN
    NEX
    CONN
    FORW
    NEX
    NEX
  • [QUOTE=corrado;107241]The example here below is a very easy and simple macro.
    I show it during my training courses when I change the overall length of a parametric valve/inst
    You need to run it when your valve/inst is the CE

    NEX
    CONN
    NEX
    CONN
    PREV
    PREV
    PREV
    BACK
    CONN
    NEX
    CONN
    FORW
    NEX
    NEX


    wow! it's realy helpful [COLOR=#3E3E3E]Corrado [/COLOR]


    (Another simple Idea) If we can let the macro checking the valve connections firstly before the execution by PML.


    so, if the valve flanged will run the macro. If not, will get a message that says "Valv/Inst incompatible!"


    How can I do that by PML. Thanks in advance.
  • Thanks Corrado, How about if we have any spectacle blind between FLG/VALVE?
  • I had to write a report for a project one time that might lead you into a direction that might help. The project wanted to check and see if there was a gasket and flange up/downstream from a valve. You could modify this code to search for the gasket that was changed and do the connections that way.


    !PipesFile = OBJECT FILE(|C:\temp\FMCValveReport.csv|)
    !PipesFile.open(|OVERWRITE|)
    !PipesFile.WriteRecord(|SITE,PIPE,UPSTREAM FLANGE,UPSTREAM GASKET,VALVE,DOWNSTREAM FLANGE,DOWNSTREAM GASKET|)


    $Pcollecting Pipes
    !pipe = !!collectallfor('VALV', 'PURP OF SITE EQ |PIPE| AND MATCHW(:CMCode OF SPREF, |FCAY4(N)*|)', World)
    !pipe.appendarray(!!collectallfor('VALV', 'PURP OF SITE EQ |PIPE| AND MATCHW(:CMCode OF SPREF, |GCAX4(N)*|)', World))
    !pipe.appendarray(!!collectallfor('VALV', 'PURP OF SITE EQ |PIPE| AND MATCHW(:CMCode OF SPREF, |GCAY4(N)*|)', World))


    do !I values !pipe
     $!I
     -- Misc. fields
     !Sit = name of SITE of $!I
     -- Component
     !Nam = :CMCODE of SPREF of $!I
     !Pip = name of pipe of $!I
     !UpFlange = :CMCODE of SPREF of PREV FLAN of $!I
     handle(2,113)
     --no flanges on upstream
       !UpFlange = |No Upstream Flange|
     endhandle
     !UpGasket = :CMCODE of SPREF of PREV GASK of $!I
     handle(2,113)
     --no gasket on upstream
       !UpGasket = |No Upstream Gasket|
     endhandle
     !DownFlange = :CMCODE of SPREF of NEXT FLAN of $!I
     handle(2,113)
     --no flanges on downstream
       !DownFlange = |No Downstream Flange|
     endhandle
     !DownGasket = :CMCODE of SPREF of NEXT GASK of $!I
     handle(2,113)
     --no flanges on downstream
       !DownGasket = |No Downstream Gasket|
     endhandle
     $* Output line
     !PipesFile.WriteRecord(|$!Sit,$!Pip,$!UpFlange,$!UpGasket,$!Nam,$!DownFlange,$!DownGasket|)
    enddo
    !PipesFile.close()
  • Try run the below code at branch level in forward mode.

    If !!CE.type NEQ 'BRAN' then
       !!Alert.Error('Not at branch!')
         return
      endif

    VAR !GAS COLLECT ALL GASK FOR CE
    DO !X VALUES !GAS
      $!X
        IF TYPE OF PREV EQ 'VALV' OR TYPE OF PREV EQ 'PCOM' THEN
         CONN NEX CONN
        ELSE
             NEX CONN
        ENDIF
    ENDDO