- 积分
- 15341
- 明经币
- 个
- 注册时间
- 2002-2-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-3-24 08:43:00
|
显示全部楼层
2.删除重合,只對完全相同的物体有效
;| Programmed by Dave Aguilar
DUPREM.LSP 1994 Onyx Software
This program creates an list of entity lists for all entities in the
drawing (using the first VERTEX for POLYLINES) and then compares each
entity list with the total list, building a new selection set of all
duplicate entries which are then erased.
it's not guarenteed but try it on a copy of a badly duplicated drawing
and see if it helps.
------------------------------------------------------------------------
------------------------------------------------------------------------
Modified by J. Tippit, SPAUG President 08/25/99
E-mail: cadpres@spaug.org
Web Site: http://www.spaug.org
1. Modified to work with R14 & 2000
2. Now prompts for 3 types of selection sets
3. Works on all types of entities (including LWPOLYLINES)
Large donations to SPAUG is appreciated. :)
------------------------------------------------------------------------
------------------------------------------------------------------------
|;
(defun C:DUPREM ()
(setvar "cmdecho" 0)
(setq F1 NIL
F1 0
)
;; Added by Jeff Tippit 08/25/99
;; Start
(initget "S L A")
(setq SLE
(getkword
"\nSelect objects by <S>election set, <L>imits, or <A>ll: "
)
)
(cond
((= SLE "S") (setq SA (ssget)))
((= SLE "L")
(setq SA (ssget "c" (getvar "extmin") (getvar "extmax")))
)
((= SLE "A")
(setq SA (ssget "X" (list (cons 410 (getvar "CTAB")))))
)
)
;; End
(setq CA 0
TA (sslength SA)
LA NIL
LB NIL
)
(while (< CA TA)
(setq ENTA (ssname SA CA)
EA (cdr (entget ENTA))
TYPA (cdr (assoc 0 EA))
)
;; (if (= typa "OLYLINE") (progn
;; (setq entb (entnext enta) ea (cdr (entget entb)))
;; ))
;; Added by Jeff Tippit 08/25/99
;; Updated for R14 & 2000
;; Start
(setq A1 (assoc 5 EA))
(setq A2 (cons 5 ""))
(setq EA (subst A2 A1 EA))
(if (wcmatch (getvar "ACADVER") "*15*")
(progn
(setq A3 (assoc 330 EA))
(setq A4 (cons 330 ""))
(setq EA (subst A4 A3 EA))
)
)
(if (= TYPA "VIEWPORT")
(progn
(setq A3 (assoc 69 EA))
(setq A4 (cons 69 ""))
(setq EA (subst A4 A3 EA))
(setq A3 (assoc 68 EA))
(setq A4 (cons 68 ""))
(setq EA (subst A4 A3 EA))
)
)
;; End
(setq LA (cons ENTA LA)
LB (cons EA LB)
CA (+ CA 1)
)
)
(setq SC NIL
SC (ssadd)
LTEST LB
)
(setq CA 0)
(setq TES (car LTEST)
LTEST (cdr LTEST)
TA NIL
TA (length LTEST)
)
(while (/= TA 0)
(if (member TES LTEST)
(progn
(setq SC (ssadd (nth CA LA) SC))
;;(prompt "\nFound aduplicate entity.")
(setq F1 (+ F1 1))
)
)
(setq CA (+ CA 1))
(setq TES (car LTEST)
LTEST (cdr LTEST)
TA (length LTEST)
)
)
(command "_.erase" SC "")
(redraw)
(prompt "\n")
(prin1 F1)
(prompt " duplicate entities erased.")
(princ)
)
(prompt
"\nType DUPREM to run. Delete duplicate entity routine Ver 2.0 loaded."
)
(princ) |
|