;;DemoLayer.LSP - Changes picked objects to layer with -DEMO suffix.
;;Bill Kramer 2008
;;
;; Visual LISP Example utility to change objects selected. This example
;; changes the layer name of the selected objects (appends "-DEMO") and
;; duplicates the layer definition if needed for the new layer.
;;
(defun C:DemoLayer
( / SS CNT LYR vEN EN LyrNew LyrTab oLayers
) (prompt "\nChange selected objects layer by appending -DEMO to name.") (setq oLayers
;;get layer table link ;;
;;Got the objects, now stream through them
;;
vEN
(vlax
-ename
->vla-object En
) ;;entity object reference )
;;check to see if -DEMO already there
(if (not (wcmatch LYR
"*-DEMO")) ;;layer name already -DEMO type? ;;
;; No, first check to see if the layer with -DEMO already exists
;;
(progn ;;add the new layer )
;; Clone the properties
(vla-put-truecolor LyrNew (vla-get-truecolor LyrTab))
(vla-put-material LyrNew (vla-get-material LyrTab))
;(vla-put-plotstylename LyrNew (vla-get-plotstylename LyrTab)) ;<-----------
)) ;;end layer add
;;
;; Update the layer name of the object
)) ;;end if -DEMO already there
) ;;end REPEAT
)) ;;end SS test
)