(vla-put-Plottable objectLayer :vlax-False)
(defun c:NoP ( / doc enm obj objLayer)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(while (setq enm (car (nentsel)))
(setq obj (vlax-ename->vla-object enm))
(setq objLayer (vla-get-layer obj))
)
(vla-put-Plottable objLayer :vlax-False)
(princ)
)
Select object: ; error: bad argument type: VLA-OBJECT "LayerName"
;;
;; LAYER group codes
;;
;; Group codes - Description
;;
;; 100 - Subclass marker (AcDbLayerTableRecord)
;;
;; 2 - Layer name
;;
;; 70 - Standard flags (bit-coded values):
;; 1 = Layer is frozen; otherwise layer is thawed
;; 2 = Layer is frozen by default in new viewports
;; 4 = Layer is locked
;; 16 = If set, table entry is externally dependent on an xref
;; 32 = If both this bit and bit 16 are set, the externally
;; dependent xref has been successfully resolved
;; 64 = If set, the table entry was referenced by at least
;; one entity in the drawing the last time the drawing
;; was edited. (This flag is for the benefit of AutoCAD
;; commands. It can be ignored by most programs that
;; read DXF files and need not be set by programs that
;; write DXF files)
;;
;; 62 - Color number (if negative, layer is off)
;;
;; 6 - Linetype name
;;
;; 290 - Plotting flag. If set to 0, do not plot this layer
;;
;; 370 - Lineweight enum value
;;
;; 390 - Hard-pointer ID/handle of PlotStyleName object
;;
FWIW, note that you needn't necessarily stray into Visual LISP & ActiveX to accomplish this - here is an example using Vanilla AutoLISP:Code - Auto/Visual Lisp: [Select]