Example #1
0
    def avi_save(self):
        """writes a video to file
            SCALE_FACTOR, TIME_HISTORY

            mytimeHistoryMode = TIME_BASED FRAME_BASED SCALE_FACTOR
        """
        #session.animationController.play(duration=UNLIMITED)
        # session.animationController.animationOptions.setValues(numScaleFactorFrames=7,
        #                                                        timeHistoryMode=TIME_BASED,
        #                                                        mode=PLAY_ONCE)
        # session.animationController.setValues(animationType=SCALE_FACTOR, viewports=(self.myVp.name, ))
        # session.imageAnimationOptions.setValues(vpDecorations=OFF,
        #                                         vpBackground=OFF,
        #                                         compass=OFF,
        #                                         timeScale=1,
        #                                         frameRate=30)
        session.animationController.setValues(animationType=TIME_HISTORY, viewports=(self.myVp.name, ))
        session.animationController.play(duration=UNLIMITED)
        session.imageAnimationOptions.setValues(vpDecorations=OFF,vpBackground=OFF,compass=OFF)
        o = self.myVp.odbDisplay.primaryVariable[0]
        c = self.myVp.odbDisplay.primaryVariable[5]
        s = self.myVp.odbDisplay.fieldSteps[0][0]
        v = self.myView
        cs = '' if self.myVp.odbDisplay.basicOptions.transformationType == DEFAULT else self.myVp.odbDisplay.basicOptions.datumCsys.name[1:]
        path_filename = '%s_%s_%s_%s_%s_%s.avi' % (self.myOdbDat.name.replace('.odb',''),s,o,c,cs,v)
        session.writeImageAnimation(path_filename, AVI, (self.myVp,))
Example #2
0
 def simple_avi_save(self, path_filename):
     try:
         session.writeImageAnimation(path_filename, AVI, (self.myVp,))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)