Nice solution @kandennti
I would just change in your code the location of the temporary tracefile into :
// Temporary file path
STRING $TraceFilePath = MACRO_PATH(false) + "\Tracefile.txt"
like that you are not dependent of the configuration of your post with a hard coded path. GetFlatFacesName could be write like that :
FUNCTION GetFlatFacesName(OUTPUT STRING LIST Surf) {
// Temporary file path
STRING $TraceFilePath = MACRO_PATH(false) + "\Tracefile.txt"
$Surf = {}
ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT
TRACEFILE OPEN $TraceFilePath
PRINT SELSURFACE
TRACEFILE CLOSE
ECHO ON DCPDEBUG TRACE COMMAND ACCEPT
FILE OPEN $TraceFilePath FOR READ AS Input
FILE READ $Surf FROM Input
FILE CLOSE Input
DELETE FILE $TraceFilePath
INT Ret = REMOVE_FIRST($Surf)
}
herewith same macro with block reset