Sorry about being unclear. OK, if you start a new drawing and load this first bunch of code, which I'll call version 1:
(defun getinfo ()
(setq pt1 (getpoint "Pick first corner: "))
(setq pt3 (getcorner pt1 "Pick opposite corner: "))
)
(defun procinfo ()
(setq pt2 (list (car pt3) (cadr pt1)))
(setq pt4 (list (car pt1) (cadr pt3)))
)
(defun output ()
(command "pline" pt1 pt2 pt3 pt4 "c" )
)
(defun C:BOX1 (/ pt1 pt2 pt3 pt4)
(getinfo)
(procinfo)
(output)
)
at this point you have defined the functions GETINFO, PROCINFO, OUTPUT and C:BOX1. If you then load this second bunch of code, which I'll call version 2:
(defun BOX1 (/ pt1 pt2 pt3 pt4)
(getinfo)
(procinfo)
(output)
)
(defun 3DBOX (/ pt1 pt2 pt3 pt4 h)
(getinfo)
(setq h (getreal "Enter height of box: "))
(procinfo)
(output)
(command "change" "L" "" "P" "th" h ""
"3dface" pt1 pt2 pt3 pt4 ""
"3dface" ".xy" pt1 h ".xy" pt2 h
".xy" pt3 h ".xy" pt4 h ""
)
)
(defun C:MAINBOX (/ pt1 pt2 pt3 pt4 h choose)
(setq choose (getstring "\nDo you want a 3D box ? "))
(if (or (equal choose "y") (equal choose "Y"))
(progn
(getinfo)
(setq h (getreal "Enter height of box: "))
(procinfo)
(output)
(command "change" "Last" "" "Properties" "thickness" h ""
"3dface" pt1 pt2 pt3 pt4 ""
"3dface" ".xy" pt1 h ".xy" pt2 h
".xy" pt3 h ".xy" pt4 h ""
)
)
(progn
(getinfo)
(procinfo)
(output)
)
)
)
at that point you have also defined the additional functions BOX1, 3DBOX and MAINBOX, but the original functions GETINFO, PROCINFO, OUTPUT and C:BOX1 are still defined.
Note that if you opened a new drawing and loaded only version 2 and not version 1, C:MAINBOX wouldn't work, because GETINFO, PROCINFO and OUTPUT are executed inside C:MAINBOX, but they are defined only in version 1.
Regarding
Maybe an explanation of what getinfo, procinfo, and output do and what they are would help. Are they functions or variables or what?
GETINFO, PROCINFO and OUTPUT are functions, defined by the DEFUN function. GETINFO prompts the user to pick two points and stores the two points as PT1 and PT3. PROCINFO computes PT2 and PT4 from PT1 and PT3. OUTPUT draws a polyline from PT1 to PT2 to PT3 to PT4 and close. BOX1 is another function, and what it does is execute the GETINFO, PROCINFO and OUTPUT in serial order. 3DBOX is yet another function. C:BOX1 is another function; it happens to be effectively identical to BOX1 but it is a different function.
In version 2, in the definition of C:MAINBOX you see the exact same steps as in 3DBOX (following the first PROGN), and likewise you see the exact steps in BOX1 repeated (following the second PROGN). My guess (I don't have that book) is that in the next version of C:MAINBOX, which I'll call C:MAINBOX2, they substitute BOX1 and 3DBOX for the analogous steps in C:MAINBOX, like so:
(defun C:MAINBOX2 (/ pt1 pt2 pt3 pt4 h choose)
(setq choose (getstring "\nDo you want a 3D box ? "))
(if (or (equal choose "y") (equal choose "Y"))
(3DBOX)
(BOX1)
)
)
So here you have a function C:MAINBOX2, which executes (if you press "Y") the function BOX1, which in turn executes the three functions GETINFO, PROCINFO and OUTPUT.