Hi Jim,
Since you say these functions are called from other routines as well this may be difficult to incorporate into your existing code, but I sure would look at using arguments in your functions to reduce the number of global variables flying around. Here's my rendition of your code, using just 1 global variable. That 1 is for the Selection set, since I'm not sure what you are doing with it.
I'm sure there are other ways of doing this, too, but since no one else has popped in I figured I'd throw in my $0.02
(defun c:hardwood_blocking()
(setq jayssobj (ssadd))
(jay-hardwood_blocking)
)
(defun jay-hardwood_blocking(/ 4points)
(jay-closedoor)
(setq 4points (jay-userdef_4_points_random))
(jay-4point-object 4points)
(jay-blocking-lines 4points)
(jay-opendoor)
)
(defun jay-closedoor ()
(setq ccmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq cosm (getvar "osmode"))
(setvar "osmode" 0)
(setq cl (getvar "clayer"))
(setq usercolor (getvar "cecolor"))
)
(defun jay-userdef_4_points_random(/ jayudp1 jayudp2 jayudp3 jayudp4)
(setq jayudp1 (getpoint "\n Pick the first point..."))
(setq jayudp2 (getpoint jayudp1 "\n Pick the second point..."))
(grdraw jayudp1 jayudp2 1 1)
(setq jayudp3 (getpoint jayudp2 "\n Pick the third point..."))
(grdraw jayudp2 jayudp3 1 1)
(setq jayudp4 (getpoint jayudp3 "\n Pick the last point..."))
(command "redraw")
(list jayudp1 jayudp2 jayudp3 jayudp4)
)
(defun jay-blocking-lines (points)
(command "pline" (nth 0 points) "w" 0 0 (nth 2 points) "")
(ssadd (entlast) jayssobj)
(command "pline" (nth 1 points) "w" 0 0 (nth 3 points) "")
(ssadd (entlast) jayssobj)
)
(defun jay-opendoor ()
(setvar "osmode" cosm)
(setvar "cmdecho" ccmde)
(setvar "clayer" cl)
(setvar "cecolor" usercolor)
)
(defun jay-4point-object (points)
(command "pline" (car points) "w" 0 0)
(mapcar '(lambda (x)
(command x)
)
(cdr points)
)
(command "cl")
(ssadd (entlast) jayssobj)
)
Also, in your 2point-object code you are drawing a 2 vertice pline....why do you close it? It seems to me this just adds an extra item for the display list to maintain while not doing anything for the actual drawing.
HTH,
Jeff