Tento LISP skript vyzve k výberu objektov a potom target objekt. U vybraných objektov sa zmení hladina podľa target objektu.
(defun c:zmen_hladinu (/ mech1 ciel1 pocet_mech1 pocitadlo var1 nazov_ciel1 var2 extrakt1 hladina)
; local variable defined
(graphscr)
;
(prompt "\nSelect objects to be changed: ")
(setq mech1 (ssget))
; Set of object that will be changed
(setq pocet_mech1 (sslength mech1))
; we have number of entities in mech1
(prompt "\nSelect object in target layer: ")
(setq ciel1 (entsel))
; We have 1 entity stored
;
(setq nazov_ciel1 (entget (car ciel1)))
; we got the name of entity encoded in CAD db...
(setq extrakt1 (assoc 8 nazov_ciel1))
;... and extracting the name of a layer indicated by "8"
;
(setq pocitadlo 0)
; getting counter to zero
;
; starting loop for all objects in mech1, extracting and
;changing the value of layer attribute
(repeat pocet_mech1
(setq var1 (entget (ssname mech1 pocitadlo)))
(setq var2 (assoc 8 var1))
(setq hladina (subst extrakt1 var2 var1))
(entmod hladina)
(setq pocitadlo (+ pocitadlo 1))
)
(princ)
)