*#
*#
*#
*Intformat "%i"
// MAXMONITORS
*#
*# Vynulovat vsechno
*# WarningBox Warning: pred iniciaci TK_InitSelectionName
*tcl(TK_InitSelectionName)*\
*#
*#
*# pri prvnim pruchodu naplnim pole UniqueSelectionName()
*# WarningBox Warning: pred 1.pruchodem loop Intervals TK_CreateArraysSelectionName

*Set Cond MaxMonitor_for_Volume   *nodes *or(1,Real) *or(2,Real) *CanRepeat 
*Add Cond MaxMonitor_for_Surface  *nodes *or(1,Real) *or(2,Real) *CanRepeat 
*Add Cond MaxMonitor_for_Line     *nodes *or(1,Real) *or(2,Real) *CanRepeat 

*If(CondNumEntities(Int)>0)
// selection nodes loop 1 has *CondNumEntities entities
*loop nodes *OnlyInCond
*tcl(TK_CreateArraysSelectionName *Cond(MonitorName))*\
*#
*End nodes
*EndIf
*# break
*#
*# // *\
*tcl(TK_FinishArraysSelectionName)
*#
*# pri druhem pruchodu je Vypis selections 
*#



*# WarningBox Warning: pred 2.pruchodem 
*#GenData(UniqueSelectionName)

*for(i=1;i<=GenData(UniqueSelectionName,Int);i=i+1)
*Set Var IntervalNumR=0
*loop Intervals
*Set Var delkaradku=0
*Set Var IntervalNumR=Operation(IntervalNumR+1)
*#   
*Set Cond MaxMonitor_for_Volume   *nodes  *CanRepeat 
*Add Cond MaxMonitor_for_Surface  *nodes  *CanRepeat 
*Add Cond MaxMonitor_for_Line     *nodes  *CanRepeat 

*# i = *i
*# *CondNumEntities(Int)
*If(CondNumEntities(Int)>0)
// selection nodes loop 2 has *CondNumEntities entities
SELECTION "*GenData(UniqueSelectionName,*i)" LIST *\
*loop nodes *OnlyInCond
*#
*Set Var oSelectionName=strcmp(Cond(MonitorName),GenData(UniqueSelectionName,*i))
*#
*# *NodesNum --- *Cond(MonitorName) =? *GenData(UniqueSelectionName,*i) => *oSelectionName
*If( oSelectionName(Int)==0)
*Set Var delkaradku=Operation(delkaradku+1)
 *NodesNum *\
*If(delkaradku>=15)
*Set Var delkaradku=0

*EndIf
*EndIf
*#
*End nodes
 REMOVE_DUPLICATES 
 ;
*EndIf
*# break
*End Intervals
*end
 
 
*# // Monitors identify by name of monitor *GenData(SurfaceList,1,Int)
*for(i=1;i<=GenData(UniqueSelectionName,Int);i=i+1)
*Set Var first=1
 
*Set Cond MaxMonitor_for_Volume   *nodes *or(1,Real) *or(2,Real) *CanRepeat 
*Add Cond MaxMonitor_for_Surface  *nodes *or(1,Real) *or(2,Real) *CanRepeat 
*Add Cond MaxMonitor_for_Line     *nodes *or(1,Real) *or(2,Real) *CanRepeat 
*#

*# 
*loop nodes *OnlyInCond
*If(strcmp(GenData(UniqueSelectionName,*i),Cond(MonitorName))==0 && first==1)
*Set Var first=0
*Set Var nMaxMonitor=Operation(nMaxMonitor+1)
Output Name "*GenData(UniqueSelectionName,*i)*\
_*Cond(Global_MM)*\
_*Cond(Data_Attribute)_DIR_*Cond(Item_At)" *\
*If(Cond(Draw_Each_Iteration,int)==1)
MONITOR_1 EACH ITERATION *\
*Else
MONITOR_2 *\
*EndIf
*Cond(Global_MM) LOCATION NODES NODE AT SELECTION *\
"*GenData(UniqueSelectionName,*i)" *\
DATA LIST "*Cond(Data_Attribute)" *\
*If(strcmp(Cond(Item_At),"all")!=0)
 ITEM AT *Cond(Item_At) *\
*EndIf
 End ;
*EndIf
*#
*End nodes
 
 
*End
*#
// MAXMONITORS END

