Author Topic: Delete a line of complete coincidence  (Read 4643 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Delete a line of complete coincidence
« Reply #15 on: August 25, 2015, 05:46:32 PM »
If I am understanding correctly, wouldn't this work:
Code: [Select]
(defun c:tt (/)
     (command "._-overkill" "All" "" "_O" "0" "_I" "_A" "_P" "_N" "_T" "_N" "_E" "_N" "_A" "Y" "")
)
And it would be by far the fastest method, at least in versions of AutoCAD since Overkill has been a command instead of an express tool. I believe it was around 2012 or so that this became a built-in command.

It would be the fastest way if OP didn't wanted to overkill only coincident lines. So the lisp is more appropriate solution IMHO.
If you want to limit it to lines only, simply make the following change:
Code: [Select]
(defun c:tt (/)
     (command "._-overkill" (ssget "_X" '((0 . "LINE"))) "" "_O" "0" "_I" "_A" "_P" "_N" "_T" "_N" "_E" "_N" "_A" "Y" "")
)

As far as I can see, this will only remove lines that match exactly, here's how:
Code: [Select]
(defun c:tt (/)
     (command "._-overkill" ; Begins the Overkill command
                     (ssget "_X" '((0 . "LINE"))) ;selects all lines within the drawing, but only lines, change this filter if you only want lines within the current space.
                      "" ;Ends the selecting of lines
"_O" "0" ; Sets the tolerance to 0, you can increase this tolerance if needed.
 "_I" "_A" ; Tells the command to Ignore all of the following differences: Color, Layer, Linetype, ltScale, LWeight, Thickness, Transparency, plotStyle & Material - This can be easily changed to suit any needs.
"_P" "_N" ; Tells the overkill command not to optimize plines - since only lines are selected, this is not an issue, but I left here in case the ssget above is changed to include plines
"_T" "_N" ; Tells the command not to combine partially overlapping objects.
"_E" "_N" ; Tells the command not to combine co-linear objects end to end
"_A" "Y" ; Tells the overkill command to maintain associativity, in this case, this will do nothing, but may be important if the ssget filter were adjusted to include dimensions.
"" ; Completes the Overkill command
)
)

It uses a tolerance of 0, does not allow for partial overlaps, will not combine end to end, so this will only handle coincident lines that are exactly the same length, unless I am missing something. And if you want to remove all overlapping lines, even if they are different length, simply change the option above. Please let me know if I am missing something, but I believe it accomplishes the desired effect, right? But perhaps I am missing something, please let me know if I am.
« Last Edit: August 25, 2015, 05:53:01 PM by cmwade77 »