Author Topic: duplicated objects  (Read 3532 times)

0 Members and 1 Guest are viewing this topic.

AfricaAD

  • Guest
duplicated objects
« on: April 11, 2005, 01:52:15 PM »
I have a few drawing files in which all objects have been duplicated on top of each other on the same layer. I need a quick fix. Is there a lisp that will remove all duplicate objects?

What causes this?

Thanks!

hyposmurf

  • Guest
duplicated objects
« Reply #1 on: April 11, 2005, 02:11:59 PM »
How about overkill?Beware if you have polylines of varying width though like those used to create arrows.

grush

  • Guest
duplicated objects
« Reply #2 on: April 11, 2005, 04:55:28 PM »
Try this-

Code: [Select]
;Tip1744:  CLEAR.LSP        Clear duplicates      (c)2001, Andrzej Gumula

(defun DXF (A) (cdr (assoc A (entget ONE)))) ;end dxf

(defun COMPLEX  ()
  (while (not (wcmatch (DXF 0) "*END*"))
    (setq ONE  (entnext ONE)
          ELEM (append ELEM (list ONE)))
    (CHECK)) ;end while
  ) ;end complex

(defun CORECT  (A)
  (cond ((= (type (cdr A)) 'list)
         (cons (car A) (mapcar '(lambda (X) (atof (rtos X 2 8))) (cdr A))))
        ((member (type (cdr A)) (list 'INT 'REAL))
         (cons (car A) (mapcar '(lambda (X) (atof (rtos X 2 8))) (list (cdr A)))))
        (t A))) ;end corect

(defun CHECK  ()
  (foreach X  (entget ONE)
    (if (not (member (car X) '(-2 -1 5 6 8 62 100)))
      (setq TEMP (cons (CORECT X) TEMP))))) ;end check

 ;(defun c:clear (/  CM LISTA NEW ONE TEMP OLD ZNACZNIK)
(defun C:CLEAR  ()
  (setq CM    (getvar "cmdecho")
        LISTA NIL
        NEW   NIL
        ONE   NIL
        TEMP  NIL
        OLD   (ssget "_X"))
  (setvar "cmdecho" 0)
  (cond
    (OLD
     (command "_-layer" "_u" "*" "")
     (prompt "\nDrawing clearing. ")
     (prompt "\nPlease wait... \n")
     (while (cond (ONE (setq ONE (entnext ONE)))
                  (t (setq ONE (entnext))))
       (setq ELEM (append ELEM (list ONE)))
       (CHECK)
       (if (or (and (= (DXF 0) "INSERT") (= (DXF 66) '1)) (= (DXF 0) "POLYLINE"))
         (COMPLEX))
       (if (member TEMP LISTA)
         (foreach X ELEM (entdel X)))
       (setq LISTA (cons TEMP LISTA)
             TEMP  NIL
             ELEM  NIL)
       (cond (ZNACZNIK (setq ZNACZNIK NIL) (princ "\r\\"))
             (t (setq ZNACZNIK (princ "\r/"))))) ;end while
     (prompt (strcat "\nNumber of elements before clearing- " (itoa (sslength OLD))))
     (prompt
       (strcat "\nNumber of elements after clearing- " (itoa (sslength (ssget "_X"))))))
    (t (prompt "\nFound zero elements. "))) ;end cond
  (setvar "cmdecho" CM)
  (princ)) ;end file
(prompt "\nLoaded new command CLEAR. ")
(princ)


pmvliet

  • Guest
duplicated objects
« Reply #3 on: April 11, 2005, 05:56:13 PM »
Are there any other disclaimers for the overkill command?

hyposmurf

  • Guest
duplicated objects
« Reply #4 on: April 11, 2005, 06:15:13 PM »
Not that I know of  :) .Ive not gone near the command since it screwed up one of my drawings with arropws created from polylines.

Dent Cermak

  • Guest
duplicated objects
« Reply #5 on: April 11, 2005, 07:07:12 PM »
Are you using descriptor codes to enter these duplicated items?

Kate M

  • Guest
duplicated objects
« Reply #6 on: April 12, 2005, 12:26:23 PM »
Just tell OVERKILL to ignore polylines (in the options). That made all the errors go away...of course, you still have to fix the polylines. :-)

AfricaAD

  • Guest
duplicated objects
« Reply #7 on: April 12, 2005, 03:58:21 PM »
I do have plines, so overkill is a nono. How does overkill affect blocks?

I'm gonna give the clear.lsp a try. Anything with this command to be aware of?

Thanks!

hyposmurf

  • Guest
duplicated objects
« Reply #8 on: April 12, 2005, 04:14:53 PM »
overkill thread from before

AfricaAD

  • Guest
duplicated objects
« Reply #9 on: April 12, 2005, 05:35:05 PM »
The clear.lsp did the job.

Thanks!

grush

  • Guest
duplicated objects
« Reply #10 on: April 13, 2005, 01:14:06 PM »
Glad I could help.

Pete