Bill Tillman Posted November 10, 2012 Posted November 10, 2012 I seem to be missing something important here. I'm wanting to take two blocks in my drawing and move them ever so slightly then do a rendering. Then move them again and do another rendering and so forth. The goal is to produce enough jpg files with the movements so as to be able to make an animated movie of the parts in action. My first tests making the animation worked well so I then tried to automate the production of the renderings so I can set it and forget it while it does all the drugery. BTW, this is an attempt to animate a window unit opening and closing. (defun c:doit (/ x) (setq x 1) (setq blk1 (ssget "_x" '((0 . "INSERT")(2 . "UpperSash")))) (setq blk2 (ssget "_x" '((0 . "INSERT")(2 . "LowerSash")))) (repeat 13 (command "._UCS" "W") (command "._PLAN" "") (command "._MOVE" blk1 "" '(0.0 0.0 0.0) "@2<270") (command "._MOVE" blk2 "" '(0.0 0.0 0.0) "@2<270") (command "-VIEW" "r" "camera2") (command "-RENDER" "p" "r" "1024" "768" "y" (strcat "C:/0/DW-" (itoa x) ".jpg")) (setq x (1+ x)) ); end repeat ); end doit function This works almost, but it unfortunately never moves the blocks. Now what's confusing is that after this runs I can type this on the command line: (command "._MOVE" blk1 "" '(0.0 0.0 0.0) "@2<270") And it highlights and moves the block just fine. But when run from the program the two blocks just sit there in the same position through each run of the repeat and I end up with a motionless animation. Quote
Bill Tillman Posted November 12, 2012 Author Posted November 12, 2012 OK, I finally got it to work by revising the two lines which are commented out below. Still need to study this to understand what the difference is which made one work vs the other and why the first set would work but only from the command line. Once this got running I was able to add different sets of movements to it and let it run all night. This morning I had 160 jpg files then using the new movie maker software with Windows 7 all I needed was a bag of hot buttered popcorn and a soda to enjoy. (defun c:doit (/ x) (setq x 131) ; (setq blk1 (ssget "_x" '((0 . "INSERT")(2 . "UpperSash")))) ; (setq blk2 (ssget "_x" '((0 . "INSERT")(2 . "LowerSash")))) (setq blk1 (ssname (ssget "_X" '((2 . "UpperSash"))) 0)) (setq blk2 (ssname (ssget "_X" '((2 . "LowerSash"))) 0)) (command "._UCS" "W") (command "._PLAN" "") (repeat 13 (command "._MOVE" blk1 "" '(0.0 0.0 0.0) "@2<270") (command "._MOVE" blk2 "" '(0.0 0.0 0.0) "@2<270") (command "-VIEW" "r" "camera2") (command "-RENDER" "p" "r" "1024" "768" "y" (strcat "C:/0/DW-" (itoa x) ".jpg")) (setq x (1+ x)) ); end repeat (princ) ); end doit function Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.