Author Topic: [XDrX-PlugIn(102)] Modify the color of block in batches  (Read 252 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 469
[XDrX-PlugIn(102)] Modify the color of block in batches
« on: January 22, 2024, 02:38:34 AM »
Code: [Select]
(defun c:xdtb_blkchgclr (/ ss colinx blk)
  (if (and (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择图块<退出>:"
   "\nSelect Insert<Exit>:"
)
'((0 . "insert"))
    )
   )
   (xdrx-initget "0 256")
   (or (setq colinx (getint
      (xdrx-string-multilanguage "\n输入颜色号[ByBlock(0)/ByLayer(256)]<选取>:"
"\nInput Color Index[ByBlock(0)/ByLayer(256)]<Select>:"
      )
    )
       )
       (setq colinx (xdrx_color_select))
   )
      )
    (progn (xd::begin)
      (setq blk (xdrx-getpropertyvalue ss "BlockTableRecord" t)
blk (xd::list:flat blk)
blk (xd::list:removedup blk)
   )
   (mapcar '(lambda (x) (xdrx-setpropertyvalue x "color" colinx))
   (xdrx-getpropertyvalue blk "allentities")
   )
      (xd::end)
    )
  )
  (princ)
)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net