Menu | OPAL / TriciaAmira | |
OPAL Home About People International Collaborators
Opportunities
Events
Related Links
|
Using Amira (v 4.1.1)Creating a Mesh from LW Output In Amira
In command line, run "perl wrl2obj.pl filename" wrl2obj.pl: #!/usr/bin/perl $filename = pop(@ARGV); $in = $filename.'.wrl'; $out = '>'.$filename.'.obj'; open (INFILE, $in) || die "Can't open '$in': $!\n"; open (OUTFILE, $out); $readpoint = 0; $readface = 0; while (<INFILE>) { $line = $_; if ($readpoint == 1) { if ($line =~ m/}/) { $readpoint = 0; } elsif ($line =~ m/^[\d\s\-\.\,\]]+$/) { $line =~ s/^\s+//; $line =~ s/(\]|,)$//; if ($line !~ m/^$/) { print OUTFILE "v "."$line"; } } } elsif ($readvertex == 1) { if ($line =~ m/}/) { $readvertex = 0; } elsif ($line =~ /(\d+), (\d+), (\d+), -1, (\d+), (\d+), (\d+), -1/) { print OUTFILE "f ".($1+1)." ".($2+1)." ".($3+1)."\n"; print OUTFILE "f ".($4+1)." ".($5+1)." ".($6+1)."\n"; } } elsif ($line =~ m/\s*point\s*\[/) { $readpoint = 1; } elsif ($line =~ m/\s*coordIndex\s*\[/) { $readvertex = 1; } } close(OUTFILE); close(INFILE); |
|
View Edit Attributes History Attach Print Search Page last modified on July 28, 2008, at 01:34 PM |