Meet my friend Cal Q. Lator15 Sep, 2004 By: Bill Fane
This built-in AutoCAD function does some amazing things
It was a warm, sunny afternoon. Captain LearnCurve was trying to figure out how to make his Hobie Cat go faster. Suddenly a thought sprang out. Captain LearnCurve screamed, "At last! I have a topic for this month's column! I'll show my readers how to figure things out with AutoCAD's built-in calculator!"
Have you ever needed to use a calculator while working in AutoCAD? I know you have, because I've seen many of you using one. Well, put away your pocket calculator because AutoCAD has one built in. Unfortunately, many users don't realize that the Command of the Month even exists because you can't invoke it via a menu or a toolbar button.
Okay, let's fire it up. Type in Cal at the Command prompt and the Command prompt shows Cal's standard prompt:
This is inviting you to enter an arithmetic expression. I can't show you any fancy screen shots, because there are no dialog boxes, wizards, or menu picks associated with this command. Instead, you type in your desired mathematical expression using a fairly obvious syntax, press Enter, and Calculator returns your answer. For example, if you type
and press Enter, Cal adds 2 plus 3 then divides that by the result of multiplying 2.3 times 5. It then displays the answer, 0.434703, and finally returns to the Command prompt.
The basic syntax is simple: As expected, you use +, -, and / to add, subtract, and divide. The only minor anomalies are that you use * instead of X to indicate multiplication and the caret ^ to indicate exponentiation (raising to a power).
The usual mathematical rules of precedence apply: The system evaluates expressions in parentheses first, starting with the innermost ones, then exponentiation, then multiplication/division, then addition/subtraction. It evaluates operators of equal precedence from left to right.
The usual range of trigonometric functions is available, including SIN, COS, TANG, and the inverse functions ASIN, ACOS, and ATAN. Note that "tangent of an angle" is TANG, not TAN, because that would conflict with the TANgent object snap. By default, the trig functions work in decimal degree values, but I'll cover this later.
The base-10 logarithmic functions LOG, EXP10 are available, while LN and EXP provide the natural log functions. SQ and SQRT return the square and square root.
ROUND returns the number rounded up or down to the nearest integer, and TRUNC simply drops the decimal portion and returns the integer portion. ABS returns the absolute value.
Two interesting functions are R2D and D2R. They convert an angle in radians to degrees and vice versa. I'll leave it to you to figure out which does which.
The general syntax of any of the preceding mathematical functions is
For example, SIN(30) returns 0.5, because the sine of 30
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD Video Tips. Subscribe to the free Cadalyst Video Picks newsletter, and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!