https://aveva.dev-verintcommunity.com/cfs-file/__key/communityserver-discussions-components-files/1630/273926GGOreodatta.pmlfnc
!ref = !!CE --запоминаем текущий элемент
BRAN --переходим на вышестоящий бранч
handle any --обработка ошибки
!!alert.error('Бранч не найден!')
return error 1 noalert
endhandle
!bran = !!CE.Name - запоминаем имя
$!ref - возвращаемся на элемент
код......
Hi Walmic, well because in your sample, you have only one ATTA. You have to get at least 2 ATTAs, one after another, for the script works. I have never use his macro but there a little explanation (without the russia comment). So like you said, this macro do nothing in your sample.
Hope this will help you !
Thank a lot, next week I'll tried, and I will keep you update if you like.
Regards
HI Yann, seems runs correctly but nothing happens, I reviewed a bit the script maybe I make a mistake in code. I highlighted that if you create a atta (command line) you can see the tail connection moved at it, this is another issue. The scenario is: first from Caesar I get the nodes (position and type of restrain) then I can realize a simple macro to import in E3D or PDMS, final with your pml I can reorder the attas ready inserted on Design. Do you think that will be a realizable dream?
define function !!ReorderATTA() forward --- ordinamento della gerarchia degli elementi ATTA -- In yererchia è necessario stare non più in basso di BRAN -- ordinando non più di 100 supporti su una sezione diritta della condotta, ma -- È possibile impostare il numero corrispondente nell'ottava riga (invece di 50) o eseguire il programma più volte -- al termine del programma, la riga di comando visualizza il messaggio "Gli elementi di tipo Atta sono ordinati!" !tempCE = !!CE if (!!CE.type neq 'BRAN') then owner endif VAR !listBRAN COLLECT ALL BRAN FOR CE -- contatore per l'intero elenco di supporti (per creare un unico elenco per tutte le BRAN) do !i from 1 to !listBRAN.size() $!listBRAN[$!i] -- creare una matrice contenente tutti gli elementi del ramo della pipeline (BRAN) VAR !ListATTA COLLECT ALL BRAN MEM WITH (type neq 'TUBI') FOR CE if (!ListATTA.size() neq 0) then !choder = false var !GeneralEL CE var !GeneralType TYPE CE do !countATTA from 1 to 100 -- Nel ciclo, controlla l'ordine do !v from 1 to !ListATTA.Size() --Passaggio al componente successivo nella gerarchia BRAN $!ListATTA[$!v] -- Se questo elemento non è il primo con la gerarchia dei rami, controllalo: if (sequ of ce neq 1) then -- controllare il tipo di elemento corrente e precedente var !TypeCE TYPE CE PREV var !TypePrev TYPE CE if (!TypePrev NEQ 'ATTA') then -- Ricordare il componente da cui inizia la sezione diritta della tubazione var !GeneralEL CE var !GeneralType TYPE CE endif NEXT -- Se entrambi gli elementi del tipo ATTA procedono al controllo delle distanze if (( !TypePrev EQ 'ATTA') and ( !TypeCE EQ 'ATTA') ) then if ( !GeneralType EQ 'BRAN') then var !DistCE CONST DIST PA OF CE TO PH OF $!GeneralEL var !DistPrev CONST DIST PA OF PREV TO PH OF $!GeneralEL else var !DistCE CONST DIST PA OF CE TO PL OF $!GeneralEL var !DistPrev CONST DIST PA OF PREV TO PL OF $!GeneralEL endif -- Se le distanze non corrispondono all'ordine nella gerarchia, procedere a modificare l'ordine degli elementi nella gerarchia if (real(!DistPrev) GT real(!DistCE) ) then !Felements = prev of CE !Lelements = CE owne -- Modificare l'ordine REORDER $!Felements After $!Lelements $!Felements !choder = true endif endif else ------- Primo elemento endif enddo owne enddo endif if (!choder eq true) then $P Branch Member Elements type "ATTA" on Branch: $!listBRAN[$!i] Reorder done! !choder = false endif enddo -- Torna all'elemento originale $!tempCE endfunction