TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => XDRX-API => Topic started by: xdcad on April 20, 2024, 11:10:48 AM

Title: [XDrX-PlugIn(153)] Select the entity to set a random color (color number 1-255)
Post by: xdcad on April 20, 2024, 11:10:48 AM
https://www.cadtutor.net/forum/topic/74275-assigning-random-colors-to-each-linepolyline-within-a-selection-set/

Code: [Select]
(defun c:xdtb_entrandclr (/ ss clr)
  (xdrx-begin)
  (if (setq ss (xdrx-ssget
(xdrx-string-multilanguage
   "\n选择实体<退出>:"
   "\nSelect Entity<Exit>:"
)
       )
      )
    (progn
      (mapcar '(lambda (x)
(setq clr (xdrx-math-rand 1 255))
(xdrx-setpropertyvalue x "color" clr)
       )
      (xdrx-ss->ents ss)
      )
    )
  )
  (xdrx-end)
  (princ)
)