Rotation animation script

Rotation animation script

Anonymous
Not applicable
1,455 Views
3 Replies
Message 1 of 4

Rotation animation script

Anonymous
Not applicable

 

I've got a question. When I attempted to animate this mechanism, it doesn't rotate on its own after I've applied the script but it requires I manually spin it. Is there a way to rectify this?

Please note that when I apply the script, it asks for "specify rotation angle or ....".

 

My script: 

 

Rotate

G

C1

 

0.0000, 0.0000

 

-1

Rscript

0 Likes
1,456 Views
3 Replies
Replies (3)
Message 2 of 4

leeminardi
Mentor
Mentor

The vlisp program at the end of this tutorial may be of help to you.

lee.minardi
0 Likes
Message 3 of 4

yangguoshe
Advocate
Advocate

;;You can try this custom command

 ;The wait sub function comes from this forum. I can't remember the specific author. Thank the original author!
(defun c:Rot_ani(/ ANG CEN_PT SS TN)
(progn
(princ "\n select the object to rotate")
(setq ss (ssget))
)
(setq cen_pt (getpoint "\n click the rotation center point"))
(setq ang (cond ((getreal "\n enter an angle value for each rotation<33>"))
(33)
)
)
(setq tn (cond ((getreal "\n enter the milliseconds for each pause<100>"))
(100)
)
)
(setq zsj (cond ((getreal "\n enter the total running time in seconds<6>"))
(6)
)
)
(xzdh ss cen_pt ang tn zsj)
)
(defun xzdh (ss cen_pt ang tn zsj)
(setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(setq xzsj 0 t1(getvar "millisecs"))
(while (<= xzsj zsj)
(foreach x lst
(vla-Rotate
(vlax-ename->vla-object x)
(vlax-3D-point cen_pt)
(/ (* ang pi) 180)
)
)
(foreach x lst
(redraw x)

)
(wait (/ tn 1000.0))
(setq t2(getvar "millisecs") )
(setq xzsj(/(- t2 t1)1000))
)
)


;; Parameter: seconds is an integer or real number.
(defun wait (seconds / stop)
(setq stop (+ (getvar "millisecs") (/ seconds 86400.0)))
(while (> stop (getvar "millisecs")))
)

0 Likes
Message 4 of 4

yangguoshe
Advocate
Advocate

77777.gif  

 

0 Likes