Code Red > XDRX-API

[XDrX-PlugIn(153)] Select the entity to set a random color (color number 1-255)

(1/1)

xdcad:
https://www.cadtutor.net/forum/topic/74275-assigning-random-colors-to-each-linepolyline-within-a-selection-set/


--- Code: ---(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)
)

--- End code ---

Navigation

[0] Message Index

Go to full version