Script to rotate a molecule and save coordinates

Dear users,

Hope someone could help in the problem of orienting  a protein molecule in different directions. I have a protein molecule and want to rotate(randomly about the center of mass) and save the updated coordinates of the protein molecule in some 10 to 20 different orientations. Am using the Discovery studio visualizer 2.0 and tried to write up a script after reading through the discovery studio forum. Below is the script

##############################################################################

use MdmDiscoveryScript;
use Time::HiRes qw(usleep);
my \$document = DiscoveryScript::LastActiveDocument(MdmModelType);
die "No open Molecule Windows" unless \$document;
use constant PI => 3.14159;
# The number of steps to get there, decrease to speed up
my \$frames=50;
my \$angle = 360/\$frames;
for my \$i (1..\$frames)
{
    \$document->RotateView(0,\$angle,0);
  
    my \$num = sprintf("%04d", \$i);
    my \$percent = int(100*\$i/\$frames);
    \$document->Save( "\$num.pdb", 'pdb');
    if (\$percent > \$lastreport)
    {
        \$lastreport = \$percent;
        print "\$percent%\n"; # progress
    }
}

##############################################################################

With this script am able to save the rotated pdb files but when i open the pdb file i see that the coordinates are not updated.

Hope somebody could help me to save the updated coordinates of the rotated molecule. Thanks in advance.

Sincerely

phoenix