#!/usr/bin/perl # Usage : perl $0 filereturnedbylglsubmit filewithlabels speckfilename $nodefile = $ARGV[0]; # usually called noname2 $edgefile = $ARGV[1]; # usually called noname1 $labelfile = $ARGV[2]; $outfile = $ARGV[3]; open (EDGES,$edgefile); open (NODES,$nodefile); open (INLAB,$labelfile); open (NODESPECK ,">".$outfile.".speck"); open (OUTLAB,">".$outfile.".label"); open (EDGESPECK ,">".$outfile."_edges.speck"); my @names; my @xs,@ys,@zs; $count = 1; while () { chomp; $names[$count] = $_; $count = $count+1; } while () { @tmp = split /[\n\t ]+/; $nodenum = $tmp[0]; $x=$tmp[1]; $y=$tmp[2]; $z=$tmp[3]; $label = $names[$nodenum]; $label =~ s/["\$"]+//g; print OUTLAB "$x $y $z text \"",$label ,"\"\n"; print NODESPECK "$x $y $z 1 # $label \n"; $xs[$nodenum] = $x; $ys[$nodenum] = $y; $zs[$nodenum] = $z; } my $n1 = -1; my $n2 = -1; while () { @tmp = split /[\n\t ]+/; if ($tmp[0] eq "#") { $n1 = $tmp[1]; } else { $n2 = $tmp[0]; print EDGESPECK "mesh -c 1 -s wire {\n 1 2\n"; print EDGESPECK $xs[$n1], " ", $ys[$n1], " ", $zs[$n1], "\n"; print EDGESPECK $xs[$n2], " ", $ys[$n2], " ", $zs[$n2], "\n}\n"; } }