Export functions from a VLX application to use them in the document namespace.
Note: The Visual LISP IDE is available on Windows only.
- In a Visual LISP text editor window, enter the AutoLISP statements the functionality you want to create.
Make sure to use the vl-doc-export function for each of the functions you want to access from the document namespace.
- Save the program file you created.
- Build an application file using the Make Application wizard.
- Load the VLX file into AutoCAD and execute the exported functions.
Example
- In a Visual LISP text editor window, copy the following code into a file:
(defun kertrats ()
(princ "This function goes nowhere")
)
Note: This code does not contain a call to vl-doc-export.
- In Visual LISP, click File Save As. In the Save-as dialog box, specify a location and name for the AutoLISP file. Click Save.
- Click File Make Application New Application Wizard.
- In the Make Application wizard, specify the following wizard options.
-
Wizard mode: Expert
-
Application location: Browse to the location in which you want to store your VLX and PRV files.
-
Application name: doctest
-
Application options: Separate-namespace
-
Application compilation options: Optimize and Link
- On the Review Selections/Build Application page, make sure Build Application is selected and then click Build.
- At the AutoCAD Command prompt or Visual LISP Console window prompt, enter (load “doctest.vlx”) and press Enter to load the doctest VLX file.
Specify path to the VLX file if it is not placed in the Support File Search Path.
- At the AutoCAD Command prompt or Visual LISP Console window prompt, enter (kertrats) and press Enter.
You should receive an error message indicating the function is not defined.
- In a Visual LISP text editor window, add the following line of code to the beginning of the program file:
(vl-doc-export 'kertrats)
- Save the file, then rebuild the application.
- Use the vl-unload-vlx function to unload the VLX file, then load and run the VLX file again.
This time, kertrats should run successfully.