CAD making simple animation

The main use of Function:


IMxDrawEntity::Rotate


Rotate an object. Details are as follows:


parameter Explanation

[in] IMxDrawPoint* basePoint

Rotating basis points

[in] DOUBLE dRotationAngle

Rotation angle


IMxDrawAnimation::GetAnimationEntity2


Resulting animation temporary object if the object is not animated initial state, returns NULL. Details are as follows:


parameter Explanation

[in] BSTR pszHandle

Animation object handles


js implemented Definitions:


     InitDraw function () { 
        Draw = document.getElementById ( "MxDrawXCtrl"); 
  draw.ImplementCommandEventFun DoCommandEventFunc = function (ICMD) { 
        IF (ICMD ==. 1) { 
             open file // Start 
             draw.OpenDwgFile (draw.GetOcxAppPath () + "\\ \\ animation.dwg Blk"); 
             var = draw.NewComObject animation ( "IMxDrawAnimation"); 
                 // the animated object initialization state 
                 animation.InitAnimationEntity2 ( "211"); 
      animation.InitAnimationEntity2 ( "212"); 
      animation.InitAnimationEntity2 ( "213"); 
                 // start a control clock event for implementing animation. 
      draw.CallLongParam1 ( "Mx_StartUserTimer", 30) ;
         = function CustomEvent draw.ImplementCustomEvent (sEventName) { 
IF (sEventName == "Mx_UserTimer") 
    { 
       var = draw.NewComObject Animation ( "IMxDrawAnimation"); 
       // start an animation drawing process 
                 animation.StartDraw (); 
                 // 211 212 213 It is necessary to rotate the handle entity. 
                 RotateEnt ( "211", animation); 
                 RotateEnt ( "212", animation); 
                 RotateEnt ( "213", animation); 
                 // end animator process 
                 animation.EndDraw (); 
                 // needs attention Generation shows the release delivery device, or will cause an error. 
       Animation = null; 
       CollectGarbage (); 
   } 
         };    
     }


RotateEnt function (handls, Animation) 
      { 
          // get the animation temporary object if the object is not animated initial state, returns NULL. 
          var animation.GetAnimationEntity2 = ENT (handls); 
          ! IF (ENT = null && (== ent.ObjectName "McDbBlockReference")) 
          { 
              var blkRef = ENT; 
              // rotation of an object, a parameter for the point of rotation, the rotation angle of Dimethyl 
              blkRef.Rotate (blkRef.Position, -30 * 3.14159265 / 180.0); 
              // animates Object this function can only be called before StartDraw, EndDraw 
              animation.Draw2 (handls); 
          } 
      }

Guess you like

Origin www.cnblogs.com/yzy0224/p/10955359.html