theonlydanny Posted September 21, 2010 Posted September 21, 2010 Hi Tutors, I recently upgraded to ACAD 2011 from, get this, ACAD 2004.. Yes, I know I know.. but now that I am playing catch up, I'm coming across little bumps in the road and need expert advice to smooth them out. Here it is: I'm trying to run a LISP routine that works fine in ACAD 2004, but with the 2011 I get this error when running the command, "Error: no function definition: VLAX-GET-ACAD-OBJECT". The routine is as follows: [please note the space between c: and command to avoid auto emoticon insertion] (defun c: p17all () (setq fname (strcat (getvar "dwgprefix") "pltfiles.scr")) (setq fpath (getvar "dwgprefix")) (setq cfile (getvar "dwgname")) (setq fh (open fname "w")) (setq fh2 fh) (setq flist (vl-directory-files fpath "*.dwg")) (setq curname (car flist)) (setq flist (cdr flist)) ; write each file name in the list to the script file (textscr) (write-line "FILEDIA" fh) (write-line "0" fh) (while (not (null curname)) ; if file is neither the X-Base or X-Broder, nor is it in model space, nor the current dwg open, (setq active_lyr (vlax-get-property (actlay) 'Name)) (if (null (or (vl-string-search "X-Base" curname) ; exclude X-Base (vl-string-search "X-Border" curname) ; exclude X-Border (= cfile curname) ; exclude current file to avoid 'file ;(= active_lyr "Model") ) ; already open' prompt. (will be done later) ) ; write script to open the file, create a plot file, and then close the file (progn (princ (strcat "\nWriting " curname " to file...\n")) (write-line "OPEN" fh) (write-line (strcat "\"" fpath curname "\"") fh) (write-line "(setq active_lyr (vlax-get-property (actlay) 'Name))(if (/= active_lyr \"Model\")(C: P17))" fh) ;(write-line "PTFF" fh) (write-line "CLOSE" fh) (write-line "NO" fh) ) ) ; end if ; set next item in list to current, and remove it from the rest of the list (if (null flist) (setq curname nil) (progn (setq curname (car flist)) (setq flist (cdr flist)) ) ) ) ; end while (write-line "FILEDIA" fh) (write-line "1" fh) (write-line "DEL" fh) (write-line fname fh) (close fh) ; close and save script file (command "FILEDIA" "0") (graphscr) (C:QSA) ; save current dwg (C: P17) ; plot current dwg (command "script" fname) ; run script for other dwgs (princ) ; quiet exit ) ; end C: PFALL function (defun ActLay () (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object) ) ) ) Thank you for your time, Quote
lpseifert Posted September 21, 2010 Posted September 21, 2010 (edited) Welcome to CadTutor You're probably getting the error because you don't have the VLisp functions loaded Put this somewhere near the beginning of your code (or enter it at the command line, or add it to your acaddoc.lsp file) (vl-load-com) also see here http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines BTW... you can turn off the friggin emoticons in the Advanced Editor (Go Advanced) also, this might be best posted in the AutoLisp, Vlisp & DCL forum Edited September 22, 2010 by lpseifert thread was moved from 'Introduce Yourself' Quote
theonlydanny Posted September 22, 2010 Author Posted September 22, 2010 Thanks for the help lpseifert. I added that code to one of my startup apps and it works great now. Also, thanks for the link on forum mannerisms, the hint on eliminating emoti-frustration.. much appreciated, and for moving my thread to the more appropriate forum. (if that was in fact you) I'm new, but I'll get it... 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.