Hi, I have made this lisp, but It seems to fall over. our proj dir is like so: ProjNumber DocumentControl Outgoing To Be Issued Drawings Structural Mechanical etc etc My idea was to have a lisp called "issue" that binds & purges and then saves from the "structural dir" to the "doc control\outgoing\to be issued dir" ready for plotting/archive What am i doing wrong? (defun c:Issue () (command "xref" "b" "*") (command ".purge" "a" "" "n") (command ".purge" "a" "" "n") (command ".purge" "a" "" "n") (command "saveas" "2000" (strcat (vl-filename-directory (vl-filename-directory (getvar "dwgprefix") ) ) (strcat projpref (nth project_val projnm_sym) ;server proj path dir to project "/documentcontrol/outgoing/to be issued/" (getvar "dwgname") ) ) ) (princ) ) Any help would be great!
devon, check the follow: (alert(strcat (vl-filename-directory (vl-filename-directory (getvar "dwgprefix") ) ) (nth project_val projnm_sym) "/documentcontrol/outgoing/to be issued/")) or the next if statement returned T I think it's var projpref witch perhaps is nil (vl-file-directory-p (strcat (vl-filename-directory (vl-filename-directory (getvar "dwgprefix") ) ) (nth project_val projnm_sym) "/documentcontrol/outgoing/to be issued/"))
Hi Zeha, Seems like you must be the man for the job?!! Thanks for you help. I have to admit that i'm confused with your solution and didnt have much success. I went back to my origional code and got it working like so... ----------------------------------------- (defun c:Issue () (command "xref" "b" "*") (command ".purge" "a" "" "n") (command "saveas" "2000" (strcat projpref (nth project_val projnm_sym) ;server proj path dir to project "/documentcontrol/outgoing/to be issued/" (getvar "dwgname") ) ) (princ) ) ------------------------------------------------- Only problem is that it saves the bound/purged dwg to both the live dir and the 'to be issued' dir. Maybe I need to qsave to current and then saveas to the issue dir? not sure how to get it to change dir and also not overright the current unbound file. Thanks for your input.
Devon, Have you checked the follow code Just copy between paranteses and pasted on the command line it returns or nil or T T means that the subdirectory exist nil means that the subdirectory not exist if it is nil look at all your variable (it must be strings or list of strings) like project_val projnm_sym and (nth project_val projnm_sym) projpref
In the following sequence: (strcat projpref (nth project_val projnm_sym) ;server proj path dir to project "/documentcontrol/outgoing/to be issued/" (getvar "dwgname") Try shortening the 'dwgname' - eliminate the '.dwg'. (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname") 4))) Bob
Thanks for the reply guys This is what I ended up with... (defun c:Issue () (command "xref" "b" "*") (command ".purge" "a" "" "n") (vl-file-directory-p (strcat projpref (vl-filename-directory (vl-filename-directory (getvar "dwgprefix") ) ) (command "saveas" "2000" (strcat projpref (nth project_val projnm_sym) ;server proj path dir to project "/documentcontrol/outgoing/to be issued/" (getvar "dwgname") ) ) ) ) (princ) ) Works fine, but I get this error up the cmd line just b4 the end of the routine... ; error: bad argument type: stringp nil Thanks