ADDNUM.LSP - 12 Feb 1987 - Stan H. Bimson as printed in CADLINES,
the newsletter of the Nashville AutoCAD Users' Group (NAUG) April
1988, Vol. 2, No. 7


Something HOT to ADD

By Stan H. Bimson

It is really getting hard to find anything that I have programmed
already that is not in print or has been in print. From CADENCE
you can get Meet.lsp that will either extend or trim lines that
intersect or don't, CADalyst had another "write text in a circle"
program. Well it did not really work like mine, I wrote mine to
write text on or under a curved dimension line the same way you
would do all your dimensioning, but it was the idea that had been
done.

While looking at the CADalyst article I noticed an ad for a
program and menu (protected of course, what a joke) for a foot
& inch calculator. For architectural dimensioning it stated, it
would add, subtract, multiply, divide or perform subcalculations
(subcalculations?? I must have been sick that day in school),
and much more so it says. Well I can not offer all those features
but I can do adding and subtraction.

Blowing off the dust, I found my trusty AddNum program that says
it was written on Feb. 11, 1987. It's strange how you write these
things, put them in your menus, call them from other programs, and
forget that you even wrote it, after a while everything seems like
an AutoCAD command!

The code is listed below, I am not really going to try and explain
all of it, I am not going to explain any of it, but I will explain
how to use it. You can add it to your ACAD.LSP file (if you have
one, and it's not protected) but the best thing to do at the first
is follow Marvin, even though he's talked to Hot Tip Harry, Marvin
really only knows one LISP command: LOAD. So if you name the file
Addnum.lsp when you type it in, at the command prompt just type
(load "addnum"), adding drive and path if it isn't the current.
I can't resist, another menu item using Marvin's LOAD:

[  Lisp  ]
[  Pgms  ]

[Add Nums]^C^C(if (null c:add) (load "addnum")) add

This little menu item will first check to see if the function ADD
is there, if it isn't, it will load it and one way or the other, it
will call it. Maybe someday we will discuss how to make your LISP
function work like overlays, have it load, run and be gone.

Getting back to it, this program lets us add or subtract dimensions
from the screen or from the keyboard. Keyboard entry is in the form
of 12.0103 being 12'-1 3/16. The 1/10's and 1/100's place is for
inches, can range from 0 to 99 but would normally be 0 to 11. The
1/1000's and 1/10,000's place is for fractions based on 16's, can
range from 0 to 99 again but normally would be 1 to 15. Another
example .1108 is 11 1/2. The keyboard entries are always added so if
you want to subtract a keyboard number just enter the negitive vaule
for the number, ie 8'-9 11/16 would be -8.0911.

The first prompt seen is:

       Adding machine
       pick screen +num >(0")

The program is in screen mode, the "+" says we are adding screen
numbers, and 0 is the running total. Just pick the text dimensions
that you want added and the running total will change with each pick.
To get to the option menu just enter a <CR> at the pick prompt:

       Enter + or - (k)eyboard, <q>uit :

If the + or - is entered the function applied to the screen pick
will change to add for + and subtract for -. A "k" will go to
keyboard mode:

       Enter keyboard num (12'-1 1/2) : 

Enter 2 3/8 to be subtracted as -.0206 and get:

       Enter keyboard num (11'-11 1/8) : 

Enter <cr> to get back to mode change:

       Enter + or - (k)eyboard, <q>uit :

Enter - to subtract in screen mode:

       pick screen -num >(11'-11 1/8)

When done at screen level enter <CR> to get to the mode change
prompt, if all is done enter "Q", "q", or <CR> and exit the
program. Upon exiting this program there are two varibles that
are available for other use, Tot has the sum in inches and StrDef
is sum in string form, ie "11'-11 1/8" was can be used by another
program.

This text and the code for AddNum are on the Nashville State
Technical Inst. BBS in file area 4 "AutoCAD" under the name
ADDNUM.ARC (telephone (615)386-1472 but to be changed to
(615)353-3472 in early March). Speaking of the BBS that gave us
a message and file area, we thank them and I ask where are all
you local AutoCAD users, let's use that message area for more
discussion and questions.

