AutoCAD: Secrets Every User Should Know

The COND function behaves like multiple IF functions, but it s much more efficient. It allows you to create a list of multiple conditions and have your program go through them one at a time until it finds one condition that is true. When it finds a true condition, it executes the function that follows but ignores the other conditions in the list.
To illustrate how COND works, let s completely rethink the program for placing an end-section symbol on a piece of structural lumber. The program you wrote earlier is serviceable, but it has some flaws. You can eliminate those flaws by changing your approach. This time, let s force the user to apply the section symbol only in situations that make sense. Because structural lumber in the U.S. comes in the nominal sizes 2 2, 2 3, 2 4, 2 6, 2 8, 2 10, and 2 12, let s require the operator to use this symbol for only those sizes.
Instead of having the program draw out the symbol each time, let s insert a unit-sized block. Actual sizes of lumber are smaller than nominal sizes. Because the actual thickness of all structural lumber is 1.5 inches, you ll create a block that is 1.5 1 units in size. When it s inserted, you ll have the program adjust the X scale factor to match the actual size for the lumber selected by the operator.
To restrict user input, this program applies two GET...