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

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
[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.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net