Author Topic: [XDrX-PlugIn(155)] Erase completely overlapping (coincide) objects and keep one  (Read 200 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 505
Code: [Select]
(defun c:xdtb_erase_coincide (/ ss lens ents nums)
  (xdrx-begin)
  (if (and (setq ss (xdrx-ssget
      (xdrx-string-multilanguage
"\n选择要处理的对象<退出>:"
"\nSelect objects to process <Exit>:"
      )
    )
   )
   (setq lens (sslength ss))
   (setq ents (xd::pickset:coincide ss))
      )
    (progn
      (setq nums 0)
      (mapcar '(lambda (x)
(xdrx-entity-delete (setq coins (cdr x)))
(setq nums (+ nums (length coins)))
       )
      ents
      )
      (xdrx-prompt
(xdrx-string-formatex
  (xdrx-string-multilanguage
    "\n搜寻实体 %d ...\n共发现 %d 组重合的对象...\n删除了其中 %d 个重合实体."
    "\nSearching for entities %d...\nA total of %d groups of Coincide objects were found...\n%d of the coinciding entities were deleted."
  )
  lens
  (length ents)
  nums
)
      )
    )
    (progn
      (xdrx-prompt
(xdrx-string-multilanguage
  "\n没有发现重合实体."
  "\nNo coinciding entities found."
)
      )
    )
  )
  (xdrx-end)
  (princ)
)

=======================

The above LISP code uses the XDRX-API, which can be downloaded from https://github.com/xdcad/XDrx-API

The XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.
Modify message
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