Jump to content

Initializing...no function definition: VLAX-GET-ACAD-OBJECT (ACAD 2011)


Recommended Posts

Posted

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,

Posted (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 by lpseifert
thread was moved from 'Introduce Yourself'
Posted

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...

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...