Monday, May 7, 2007

AutoCAD ; error: no function definition:

If you have an AutoLISP file that does not work or exits like the sample below there might be an easy solution.

Command: (vlax-get-acad-object)
; error: no function definition: VLAX-GET-ACAD-OBJECT

Try running (vl-load-com) or add it to the beginning of the LSP file.

Command: (vl-load-com)

Command: (vlax-get-acad-object)
#<VLA-OBJECT IAcadApplication 00d73d3c>

Now it works as expected without any errors.

What is (vl-load-com) ?

This function loads the extended AutoLISP functions provided with Visual LISP. The Visual LISP extensions implement ActiveX and AutoCAD reactor support through AutoLISP, and also provide ActiveX utility and data conversion functions, dictionary handling functions, and curve measurement functions.

It does not hurt to add (vl-load-com) to your LSP files to make sure it works. If the extensions already are loaded (vl-load-com) does nothing.

No comments:

Post a Comment