The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

Example: Returning Current AutoCAD Settings

Thus far in this chapter, I have discussed in general terms the essential power that lies in Visual LISP. In this section, you run an application that shows the power of Visual LISP in terms of defining problems to the computer. That is, you see an example that actually does something that might be considered useful.

The (C:HELLO) function, starting with Listing 3.9, demonstrates many of the concepts you have explored in this chapter. This version of (C:HELLO), which is more useful than the one presented in Chapter 2, displays the settings of the current AutoCAD session. The user or the programmer control these settings in a list of items. The list contains system variable names as well as the symbol names of functions to run to obtain an answer about the drawing or system environment.

Listing 3.9: Defining a data list.
<span style="background-color:d9d9d9">(SETQ SETTINGSQUERY</span>   <span style="background-color:d9d9d9">'(("CLAYER" "Current layer")</span>      <span style="background-color:d9d9d9">("TEXTSTYLE" "Current text style")</span>      <span style="background-color:d9d9d9">("DIMSTYLE" "Current dim style")</span>      <span style="background-color:d9d9d9">("TEXTSIZE" "Current Text Size")</span>      <span style="background-color:d9d9d9">((E_COUNTER NIL) "Number of entities")</span>      <span style="background-color:d9d9d9">((E_Counter "LINE") "Number of Lines")</span>      <span style="background-color:d9d9d9">((E_COUNTER "INSERT") "Number of block inserts")</span>      <span style="background-color:d9d9d9">("TDINDWG" "Time in Drawing")))</span>

This is a complex example, involving features of Visual LISP that might be unfamiliar to those just learning...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Vacuum Pumps and Vacuum Generators
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.