Here's a problem: I have two snippets of code each of which test OK when run separately but when I combine them I am unable to get the desired result. (a number of sequential renderings written to a particular file)
I'll post both then post my attempt at combining them. Hopefully some brilliant Autolisp specialist can spot a neophyte's oversight.
First bit:
(defun C:setrender
()
(c:rpref "TOGGLE" "SKIPRDLG" "OFF")
(c:rpref "ROPT" "ASCAN" 2 NIL NIL 0 1 3)
(c:rfileopt "BMP" 640 480 1.0 "C8")
(c:render "D:/Bernie/Shadows/Shadow_System_Rotate2/Test2"
)
)
Second bit:
(defun rtod (a)
(/ (* a 180) pi)
)
(defun c:ani (/ cntr deg entgrp fname num rotpnt)
; Turn command echoing off
(setq cmdold (getvar "cmdecho"))
(setvar "cmdecho" 0)
; Select the objects
(setq entgrp (ssget))
; Check to make sure you selected something
(if entgrp
(progn
; Set undo point
(command ".undo" "Mark")
; Pick rotation point
(setq rotpnt (getpoint "\nPick rotation point:<0,0,0> "))
(if (= rotpnt nil)
(setq rotpnt (list 0 0 0))
)
(setq num (getint "\nEnter number of images:<15> "))
(if (= num nil)
(setq num 15)
)
(setq deg
(rtod (getangle rotpnt "\nEnter degrees of movement:<3> "))
)
(if (= deg nil)
(setq deg 3)
)
(setq cntr 1)
(repeat num
; Add your path here
(setq
fname (strcat
"D:\Bernie\Shadows\Shadow_System_Rotate2\TestImage"
(itoa cntr)
".jpg"
)
)
; ***renders an image to the specified filename***
(c:render (vl-princ-to-string fname))
; Rotate the object
(command ".rotate" entgrp "" rotpnt deg)
(setq cntr (1+ cntr))
) ; repeat
(command ".undo" "Back")
) ; progn
) ; if
; Return echo
(setvar "cmdecho" cmdold)
(princ)
)
My attempt at a combination:
(defun rtod (a)
(/ (* a 180) pi)
)
;sets reder preferences and file options
(defun C:setrender
()
(c:rpref "TOGGLE" "SKIPRDLG" "OFF")
(c:rpref "ROPT" "ASCAN" 2 NIL NIL 0 1 3)
(c:rfileopt "BMP" 640 480 1.0 "C8")
)
(defun c:ani (/ cntr deg entgrp fname num rotpnt)
; Turn command echoing off
(setq cmdold (getvar "cmdecho"))
(setvar "cmdecho" 0)
; Select the objects
(setq entgrp (ssget))
; Check to make sure you selected something
(if entgrp
(progn
; Set undo point
(command ".undo" "Mark")
; Pick rotation point
(setq rotpnt (getpoint "\nPick rotation point:<0,0,0> "))
(if (= rotpnt nil)
(setq rotpnt (list 0 0 0))
)
(setq num (getint "\nEnter number of images:<15> "))
(if (= num nil)
(setq num 15)
)
(setq deg
(rtod (getangle rotpnt "\nEnter degrees of movement:<3> "))
)
(if (= deg nil)
(setq deg 3)
)
(setq cntr 1)
(repeat num
; Add you path here
(setq
fname (strcat
"D:\Bernie\Shadows\Shadow_System_Rotate2\TestImage"
(itoa cntr)
".jpg"
)
)
;sets render preferences and file options
(c:setrender)
; ***renders an image to the specified filename***
(c:render (vl-princ-to-string fname))
; Rotate the object
(command ".rotate" entgrp "" rotpnt deg)
(setq cntr (1+ cntr))
) ; repeat
(command ".undo" "Back")
) ; progn
) ; if
; Return echo
(setvar "cmdecho" cmdold)
(princ)
)
Hope someone has a go at this
bemiller