@omorah wrote:
.... if I have one hundred layers, I would like to create one hundred points, all on the same coordinate, corresponding to all the one hundred existing layers. ....
I think Message 3 misunderstands the request. As to Message 2, it is not necessary to unlock a Layer to draw on it. [The current Layer can even be off, and you can still draw on it!] If you were drawing all Points on the current Layer and then CHPROP-ing them onto each Layer, the current Layer would need to be on and unlocked so that CHPROP could work on them. If you were setting the current Layer successively to each Layer in the drawing and then drawing a Point on it, you'd need to deal with the possibility of Layers being off or frozen, and presumably set them back.
But it's not necessary to care about any of that -- using (entmake), you can even put Points directly on frozen Layers [which can't be drawn on with a Point command, because they can't be current, though you could draw one on a different Layer and CHPROP it onto a frozen one]. All you really need to be concerned about is that you can't put one on an Xref-dependent Layer.
(defun C:POAL (/ pt layinfo layname) ; = Points On All Layers
(setq pt (getpoint "\nLocation of all Points: "))
(while (setq layinfo (tblnext "layer" (not layinfo)))
(if (not (wcmatch (setq layname (cdr (assoc 2 layinfo))) "*|*")); not an Xref Layer
(entmake
(list
'(0 . "POINT")
(cons 10 pt)
(cons 8 layname)
); list
); entmake
); if
); while
(princ)
); defun
Kent Cooper, AIA