Jump to content

Perhaps a monumental task...Animating from AutoLISP using Render.


Recommended Posts

Posted

Glad you found the procedure that works for you.

 

 

String concatenation with integer to ascii string conversions:

 

(strcat "C:\\RotateMachine" (itoa counter) ".png")

 

That is you want file image to reside in the root directory.

 

Q : is there still a limit of 512 files in a root directory?

 

-David

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • jjatho

    15

  • David Bethel

    6

  • tzframpton

    2

  • MSasu

    2

Posted

Thanks Dave!

 

Q : is there still a limit of 512 files in a root directory?

 

I'm planning on saving all the files to a dropbox location anyway. I'm going to be running everything on a computer without a monitor and picking up the output files on my laptop with the dropbox.

Posted

Curses. I have been foiled again. I tried working with a more complicated scene, and AutoCAD got to image #17 before I get the message that it was running out of memory, and gave me the option to cancel the current command. This is what I was worried about.

 

I suspect it has to do with the render window and having a long list of previously rendered images. I'm assuming they're kept in memory somehow. Anytime I'm rendering this same scene, or even more complicated ones, I never run into this issue as long as I remove the previous renders from the list as soon as I have them saved.

 

Any ideas?

Posted

Can you post the dwg file and the script that you came up with? Hard to tell what the cause is. -David

Posted

I'll be able to do so later this evening.

 

For now, I tried the SAVEIMG command and it works, but requires the save dialog box. Trying it in a command in LISP like this:

 

(command "SAVEIMG" "C:\\LISPtest01.png" ...

 

Doesn't work, as the dialog box still appears. I've tried a few variations (-SAVEIMG, .SAVEIMG, etc.) but to no avail. I get:

 

Command: -SAVEIMG Unknown command "-SAVEIMG".  Press F1 for help.

Posted

Yes, it looks like saveimg no longer accepts command line parameters. It was SO much easier when it did. Although it was an externally defined arx command, you could use (c:saveimg ......

 

 

From R2000 help :


Externally Defined Commands



saveimg 



Saves a rendered image to a file in BMP, TGA, or TIFF format (Externally-defined: render ARX application)


(c:saveimg filename type [portion] [xoff yoff xsize ysize] [compression])

When AutoCAD is configured to render to a separate display, the portion argument should not be used. You can specify a size and offset for the image; and for TGA and TIFF files, you can specify a compression scheme. 
Arguments
The arguments to saveimg are described in the following table:

SAVEIMG function arguments

Argument	Data type	Description	Default

filename 	STR 	Image file name	None

type 	STR 	File type: BMP, TGA, or TIFF	None

portion 	STR 	Portion of the screen to save:A—active viewportD—drawing areaF—full screen
    NOTE This argument is now ignored, but is provided for script compatibility.	"A" 


xoff 	INT 	X offset in pixels	0
yoff 	INT 	Y offset in pixels	0
xsize 	INT 	X size in pixels	Actual X size
ysize 	INT 	Y size in pixels	Actual Y size 


compression 	STR 	Compression scheme:
NONE
PACK (TIFF files only)
RLE (TGA files only)	None


Examples
The following example saves a full-screen TIFF image named test.tif, without  compressing the file:

(c:saveimg "TEST" "TIF" "NONE")

 

-David

Posted

This is an interesting topic. I don't know how to animate with Inventor yet so I used AutoCAD for this. Creating a whole bunch of jpgs with ever so slight changes on location of blocks and then rendering that scene. I used LISP to automate it so I could sleep through the night while it did all this boring work. Then using the new Movie Maker software that you can download for windows 7 I put it together into an MP4. The finished product is only about 11 seconds long but it sells the whole idea. Too big to upload here though.

Posted

Bill that's exactly what I'm trying to automate here. Would you mind sharing what you use in AutoLISP to capture the jpgs?

Posted

This the code I ended up using to do a more complex animation. The doors move out 26 mm, then swing open 50 degrees. I simply copied and reverse numbered the rotation jpegs to close the doors again. I also used the free Movie Maker software that you can download from Microsoft to create the movie. The end product may not win me any awards but it wowed the investors enough that they've asked for more.

 

(defun c:doit (/ x)

 (setq x 1)

 (setq rp '(20.54 -372.2849 17.3564))

 (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

(repeat 10
  (command "._ROTATE" blk2 "" rp -1)
  (command "-VIEW" "r" "camera2")
  (command "-RENDER" "p" "r" "1024" "768" "y" (strcat "C:/0/DW-" (itoa x) ".jpg"))
  (setq x (1+ x))
); end repeat

 (repeat 30
   (command "._ROTATE" blk2 blk1 "" rp -1)
   (command "-VIEW" "r" "camera2")
   (command "-RENDER" "p" "r" "1024" "768" "y" (strcat "C:/0/DW-" (itoa x) ".jpg"))
   (setq x (1+ x))
 ); end repeat

(repeat 10
   (command "._ROTATE" blk1 "" rp -1)
   (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

Posted

Using -RENDER like you do here always causes me to run out of memory and crash AutoCAD when I'm using it in a script. Oddly enough, I can use render all day long without any problems as long as I clear out the old images from the list in the render window after I save them. It just seems that there's no way to clear the old images from AutoLISP.

Posted

I may have found a way to do this using an unholy combination of AutoLISP, -RENDER in viewport, and an external call using START to run AutoHotKey and take screenshots with SnagIt. This cobbled together mess may actually do the trick.

 

One last thing I would love to figure out is if I can control the date and time for the sun settings via AutoLISP. SUNPROPERTIES exists, but -SUNPROPERTIES does not work.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...