so I added the layers to freeze and the layers to thaw, but the only thing that happens is the selected objects turn to layer cpdp like they should
no layers freeze or thaw afterwards, I don't know enough to find my mistake
Code:
(defun C:clean (/ entselection ;entity name of selection
int count ;iteration counter for selection set
objselection ;visual lisp activex object
ssSelections ;selection set of entities
)
(setq old-Cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(vl-load-com)
(princ "nPick objects to be changed to layer cpdp: ")
(if (setq ssSelections (ssget))
(repeat (setq intcount (sslength ssSelections))
(setq intcount (- intcount 1)
entselection (ssname ssSelections intcount)
objselection (vlax-ename->vla-object entselection)
)
(if (tblsearch "layer" "cpdp") ;; if layer is there then just put selected objects on that layer
(progn
;(command "-layer" "s" "0" "")
(vla-put-layer objselection "cpdp")
);; end of progn
(progn
(command "-layer" "m" "cpdp" "c" "red" "cpdp" "p" "n" "cpdp" "");; if layer is not there make that layer and put selected objects on the layer
;(command "-layer" "s" "0" "")
(vla-put-layer objselection "cpdp")
)
;; end of progn
)
;;end of if
)
(command "_.layer" "_f" "insert,cpwp,cpdp" "_s" "0,*1*,*2*,3sd,4ld,*8X11*,*AP*,ATLGC,AXTRC,*B*,*CH*,CLGHT,*CO*,*CPS*,CXTRC,*D*,*E*,*F*,*G*,IXTRC,*J*,*K*,*L*,*M*,*N*,*O*,*P*,*R*,*S*,*T*,VIEWPORT,*W*,*X*,ZXTRC" "")
)
(setvar "cmdecho" old-Cmdecho)
)