David Bethel Posted November 9, 2012 Posted November 9, 2012 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 Quote
SLW210 Posted November 9, 2012 Posted November 9, 2012 jjatho, Please read the CODE POSTING GUIDELINES and edit your post to include CODE TAGS! Quote
jjatho Posted November 9, 2012 Author Posted November 9, 2012 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. Quote
jjatho Posted November 9, 2012 Author Posted November 9, 2012 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? Quote
David Bethel Posted November 9, 2012 Posted November 9, 2012 Can you post the dwg file and the script that you came up with? Hard to tell what the cause is. -David Quote
jjatho Posted November 9, 2012 Author Posted November 9, 2012 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. Quote
David Bethel Posted November 9, 2012 Posted November 9, 2012 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 Quote
Bill Tillman Posted November 12, 2012 Posted November 12, 2012 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. Quote
jjatho Posted November 12, 2012 Author Posted November 12, 2012 Bill that's exactly what I'm trying to automate here. Would you mind sharing what you use in AutoLISP to capture the jpgs? Quote
Bill Tillman Posted November 13, 2012 Posted November 13, 2012 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 Quote
jjatho Posted November 13, 2012 Author Posted November 13, 2012 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. Quote
jjatho Posted November 14, 2012 Author Posted November 14, 2012 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. 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.