Lesson45 – Searching the AutoLISP File

Searching the AutoLISP File

Throughout this class we have used these tools found in the Visual LISP editor to help us process the code:

  • Parentheses matching
  • Color coding
  • Formatting
  • Loading partial and full functions
  • Checking the function in the console window
  • Commenting

We are now going to look at other debugging functions in the Visual LISP editor. These are not all the tools that come with Visual LISP but will give you a good start. The ones we will cover in this class can help you create and fix routines by using the search functions, creating breakpoints where you can stop and start your program, inspecting objects such as symbols, and watching the value of symbols.

Search Functions

The search functions help you find symbol and function names used in your program. You can find words or parts of words and replace them if needed. For instance, you could use Find and Replace if you used shortcut symbol names such as CP and later want to replace them with more descriptive names such as CenterPoint.

  • To go to the next instance of the search, press the Find toolbar string button on the Search Toolbar, go to Search> Find/Replace Next on the pull-down menu or press F3.
  • If you have already searched for a string it will be available in the Toolbar String drop-down list on the Search toolbar. This list only shows when the toolbar is docked.

  • The options for Replace are similar to Find.

PRACTICE : VISUAL LISP SEARCH FUNCTIONS

In this practice you will use Find to identify the location of one symbol and then replace the instances of at least one other variable. Estimated time for completion: 5 minutes.

1. Open the file SAW.LSP in the Visual LISP text editor.

2. Find every instance of the symbol CP. Which AutoLISP functions use this symbol?

3. Find the symbol DTR. Replace each instance of this symbol with the new name DegreestoRadians.

4. If you have time, change some of the other variable names to longer, more descriptive ones.

5. Save the file, then load the function and test it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons
SUBSCRIBE TO OUR NEWSLETTER

It's FREE!

Sign up and receive an email every time a new tutorial is published