#!/usr/bin/tclsh # # This scripts parsed a tecplot style file of triangles and displays them via VMD's graphics interface # fname is the filename of the tecplot .dat file proc show_surface { fname } { draw delete all # open file set file [open $fname r] gets $file title gets $file variables gets $file zone # parse nodes set ncount 1 gets $file line while { $line != {} } { set nodes($ncount) $line incr ncount gets $file line } set ncount [ expr $ncount -1 ] puts "There are $ncount nodes." # there's a blank line in between # parse triangles set tcount 0 gets $file line while { $line != {} } { set triangles [ split $line " "] set first [ lrange $nodes([ lindex $triangles 0 ]) 0 2 ] set second [ lrange $nodes([ lindex $triangles 1 ]) 0 2 ] set third [ lrange $nodes([ lindex $triangles 2 ]) 0 2 ] draw material Transparent draw color blue2 draw triangle $first $second $third incr tcount gets $file line } puts "There are $tcount triangles." }