AutoCAD: Secrets Every User Should Know

Repeat Function

While programming, you often need to loop through a group of functions either for a specific number of times, or indefinitely until some condition changes. When you don t know how many times to repeat, use the WHILE function, which is discussed in the next section; when you do know how many times an evaluation must repeat, use the REPEAT function.

I created this next routine when I was asked to testify in a case in which one company accused another company of using direct copies of several of its drawings to produce an identical product. I wrote a program to determine whether a particular drawing was an original, independent creation or an electronic copy.

The program in Listing 9.8 uses entity handles, which are fixed, to compare the entities in one drawing with the entities in another. Rather than select each entity and use the LIST command to see the handles, I used this program to create a list of the handles for every object in each of the drawings and then write those lists to a text file. When I had finished comparing the files, I felt confident in judging how many entities had been copied from one to the other, and I had documentation to use in the deposition.

Listing 9.8
handle_file.lsp        (defun c:handle_file (/ txtFile userProf fileName selSet1                      ...

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: Handles and Pulls (industrial)
Finish!
Privacy Policy

This is embarrasing...

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