PDA

View Full Version : Remove extrat lines?



Robert J
18th Oct 2007, 02:37 pm
We have drawings that are made up of a bunch of little lines and rectangles that are sitting on top of each other making a pain in the a$$ to work with.
Is there anyway to purge or extract the extra layered lines that are on top of each other?
All this is on one layer.

Thanks,
Robert J

lpseifert
18th Oct 2007, 02:41 pm
I've had limited success using the Express tools' Overkill command.

Robert J
18th Oct 2007, 02:51 pm
Thank you.
I am using 2008 and I don't see an Overkill command.

lpseifert
18th Oct 2007, 03:00 pm
Did you try typing Overkill at the command line?

Alan Cullen
18th Oct 2007, 03:06 pm
Probably because 2002 is too young to have Express tools, But then again, I'm not sure.

In the meantime, here is a lisp routine I wrote a long time ago that has served me well, but by no means a definitive answer. Try it at your peril, but it may help you.


;;----------------------------------------------------------------------------
;; DUPLICAT.LSP REMOVE DUPLICATE POINTS, STRINGS AND TEXT FROM DRAWING
;;----------------------------------------------------------------------------
;;
;; WRITTEN BY: ALAN CULLEN CAIRNS JULY 1997
;;
;; MODIFIED.......JULY 2003 (TEXT ADDED)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ERROR HANDLER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun newerr (/ s)
(if ocmd (setvar "cmdecho" ocmd))
(if olderr (setq *error* olderr))

(if (/= s "Function cancelled")
(if (= s "quit / exit abort")
(princ)
(princ (strcat "\nError: " s))
)
(princ "\n ERROR....CONSOLE BREAK....PREVIOUS DRAWING STATUS RESTORED ")
)
(setq check1 nil check2 nil code nil)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ROUTINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:du (); (/ ocmd olderr newerr check1 check2 code opt time1 lay sset n no
; index tot elem1 chk pt xpt ypt zpt loop1 elem2 code10 code11
; x10 y10 z10 ly lynew elemnew pt1 pt2 xpt1 xpt2 ypt1 ypt2 zpt1
; zpt2 x11 y11 z11 time2 time3 secs mins )
(princ)
(princ "\n REMOVE DUPLICATE POINTS, STRINGS AND TEXT FROM DRAWING - July 2003 - Alan CULLEN")
(print)
(initget "Yes No")
(setq opt (getkword "\n Proceed ? Y / N <Yes> : "))
(if (= opt nil) (setq opt "Yes"))
(if (= opt "No")
(progn
(princ "\n ROUTINE TERMINATED BY USER")
(exit)
))
(if (= opt "Yes")
(progn
(setq time1 (getvar "date"))
(setq lay "duplicate_entities")
(if (= (tblsearch "layer" lay) nil)
(command "layer" "make" lay "")
)
(setq sset nil)
(setq sset (ssget "X" '((0 . "POINT"))))
(if sset
(progn
(princ "\n Checking POINT entities")
(setq n (sslength sset))
(setq no (- n 1))
(setq index 0)
(setq tot 5)
(repeat no
(if (= tot index)
(progn
(setq tot (+ 5 tot))
(princ "-")
))
(setq elem1 (entget (ssname sset index)))
(setq index (+ 1 index))
(setq chk index)
(setq pt (assoc 10 elem1))
(setq xpt (cadr pt) ypt (caddr pt) zpt (cadddr pt))
(setq loop1 T)
(while loop1
(setq elem2 (entget (ssname sset chk)))
(if (= chk (- n 1))
(setq loop1 nil)
(setq chk (+ 1 chk))
)
(setq code10 (assoc 10 elem2))
(setq x10 (cadr code10) y10 (caddr code10) z10 (cadddr code10))
(if (and (= xpt x10) (= ypt y10))
(if (= zpt z10)
(progn
(setq ly (assoc 8 elem1))
(setq lynew (cons (car ly) lay))
(setq elemnew (subst lynew ly elem1))
(entmod elemnew)
(setq loop1 nil)
)))))))
(setq sset nil)
(setq sset (ssget "X" '((0 . "LINE"))))
(if sset
(progn
(princ "\n Checking LINE entities")
(setq n (sslength sset))
(setq no (- n 1))
(setq index 0)
(setq tot 5)
(repeat no
(if (= tot index)
(progn
(setq tot (+ 5 tot))
(princ "-")
))
(setq elem1 (entget (ssname sset index)))
(setq index (+ 1 index))
(setq chk index)
(setq pt1 (assoc 10 elem1))
(setq pt2 (assoc 11 elem1))
(setq xpt1 (cadr pt1) ypt1 (caddr pt1) zpt1 (cadddr pt1))
(setq xpt2 (cadr pt2) ypt2 (caddr pt2) zpt2 (cadddr pt2))
(setq loop1 T)
(while loop1
(setq elem2 (entget (ssname sset chk)))
(if (= chk (- n 1))
(setq loop1 nil)
(setq chk (+ 1 chk))
)
(setq code10 (assoc 10 elem2))
(setq code11 (assoc 11 elem2))
(setq x10 (cadr code10) y10 (caddr code10) z10 (cadddr code10))
(setq x11 (cadr code11) y11 (caddr code11) z11 (cadddr code11))
(if (or (and (= xpt1 x10) (= xpt2 x11))
(and (= xpt1 x11) (= xpt2 x10))
)
(if (or (and (= ypt1 y10) (= ypt2 y11))
(and (= ypt1 y11) (= ypt2 y10))
)
(if (or (and (= zpt1 z10) (= zpt2 z11))
(and (= zpt1 z11) (= zpt2 z10))
)
(progn
(setq ly (assoc 8 elem1))
(setq lynew (cons (car ly) lay))
(setq elemnew (subst lynew ly elem1))
(entmod elemnew)
(setq loop1 nil)
))))))))


(setq sset nil)
(setq sset (ssget "X" '((0 . "TEXT"))))
(if sset
(progn
(princ "\n Checking TEXT entities")
(setq n (sslength sset))
(setq no (- n 1))
(setq index 0)
(repeat no
(setq elem1 (entget (ssname sset index)))
(setq index (+ 1 index))
(setq chk index)
(setq pt (assoc 10 elem1))
(setq xpt (cadr pt) ypt (caddr pt))
(setq txt (assoc 1 elem1))
(setq text (cdr txt))
(setq loop1 T)
(while loop1
(setq elem2 (entget (ssname sset chk)))
(if (= chk (- n 1))
(setq loop1 nil)
(setq chk (+ 1 chk))
)
(setq code10 (assoc 10 elem2))
(setq x10 (cadr code10) y10 (caddr code10))
(setq txt2 (assoc 1 elem2))
(setq text2 (cdr txt2))
(if (and (= xpt x10) (= ypt y10))
(if (= text text2)
(progn
(setq ly (assoc 8 elem1))
(setq lynew (cons (car ly) lay))
(setq elemnew (subst lynew ly elem1))
(entmod elemnew)
(setq loop1 nil)
)))))))


(setq time2 (getvar "date"))
(setq time3 (- time2 time1))
(setq secs (* 86400.0 (- time3 (fix time3))))
(if (> secs 60)
(progn
(setq mins (/ secs 60))
(princ (strcat "\n Completed - Time taken was "(rtos mins)" minutes"))
)
(progn
(princ (strcat "\n Completed - Time taken was "(rtos secs)" seconds"))
)
)))
(setvar "CMDECHO" ocmd)
(setq *error* olderr)
(princ)
(princ (strcat "\n Duplicate entities placed on layername \""lay"\""))
(princ)
)

Robert J
18th Oct 2007, 03:09 pm
That would have been too simple LOL
Thank you. It seems to have helped some.
Edit..The overkill.
I haven't tried Alsn's lsp yet since it was posted while I was typing.

mahahaavaaha
18th Oct 2007, 05:20 pm
Probably because 2002 is too young to have Express tools, But then again, I'm not sure....


Alan, if you'd "really" read the original post, you'd've (that cannot be correct...) noticed that even though he states his current version as AutoCAD 2002, he says in the message 2008...

Just a reminder to ALL; please read the original question... (I've been known to jump to answering after just having read the topic...)

/Petri from almost Freezing Finland..

Alan Cullen
18th Oct 2007, 06:06 pm
mahahaavaaha,

What the hell are you talking about?

JD Mather
18th Oct 2007, 06:17 pm
mahahaavaaha,

What the hell are you talking about?

Let's see, uhmmm...

Thank you.
I am using 2008 and I don't see an Overkill command.

Robert J
18th Oct 2007, 06:28 pm
Is there any way to list both 2002 and 2008 for AutoCAD or just just one in the footer for other programs used.
I have 2002 at home and 2008 at work.

Also, neither method solved the problem all together so I guess I am left to live with it or redraw.

Edit..I just move what I thought was a rectangle and checked the properties and it says it is a 3D Face and it doesn't explode. Is there a way to make everything explode and then maybe the overkill command would work better in my case?

Thanks Again,

mahahaavaaha
18th Oct 2007, 08:25 pm
mahahaavaaha,

What the hell are you talking about?
DUH !

Robert J
19th Oct 2007, 10:54 am
I found out that the drawings are 3D just showing in 2D and they are download this way from the OEM.
I used the flatten command and that helped some but not great.

Thanks Again,
Robert J.

SLW210
19th Oct 2007, 04:28 pm
I found out that the drawings are 3D just showing in 2D and they are download this way from the OEM.
I used the flatten command and that helped some but not great.

Thanks Again,
Robert J.

In 2008, use _FLATSHOT to flatten them.

Robert J
19th Oct 2007, 04:43 pm
Thanks but still the same...Unless I am doing something wrong.

SLW210
19th Oct 2007, 04:58 pm
Try using Properties to set all z values to 0

Robert J
20th Oct 2007, 01:19 pm
Thanks but still the same.
These drawing are from a well know automation company [Rockwell Automation] here in the US and known also world wide.
Don't get me wrong, any drawing is better then nothing but it is a pain to try and modify them if needed.

Thanks Again,
Robert J.