delete Zero length lines

 Hi,

I would like a simple script to erase lines with zero length. Any ideas?

Comments

  •  Try this one:
    [code](foreach e (vle-selectionset->list 
                (ssget "_X" (list (cons 0 "LINE"))))
     (if (equal (cdr (assoc 10 (entget e)))
             (cdr (assoc 11 (entget e)))
             0.00000001
             )
      (entdel e)
      )
     )[/code]
  • The code looks better if simply pasted...

     (foreach e (vle-selectionset->list 
                (ssget "_X" (list (cons 0 "LINE"))))
     (if (equal (cdr (assoc 10 (entget e)))
             (cdr (assoc 11 (entget e)))
             0.00000001
             )
      (entdel e)
      )
     )
  • The code looks better if simply pasted...

     (foreach e (vle-selectionset->list 
                (ssget "_X" (list (cons 0 "LINE"))))
     (if (equal (cdr (assoc 10 (entget e)))
             (cdr (assoc 11 (entget e)))
             0.00000001
             )
      (entdel e)
      )
     )

    That's great thanks Vaidas. I'm only new to writing scripts and I can get it to work if I paste each line in the command line separately, but what will the text look like if I want to make a custom tool? I have this at the moment and it doesn't work. Is there something I'm doing wrong?

    (foreach e (vle-selectionset->list;(ssget "_X" (list;(cons 0 "LINE"))));(if (equal (cdr (assoc 10 (entget e)));(cdr (assoc 11 (entget e)));0.00000001;);(entdel e););)
  •  Hi Rowan,

    Remove all semicolons from your code because any text after semicolon is supposed as a comment.

    The simpliest way to use it is to save the code into YOUR.lsp file and load it with APPLOAD command.
  •  Ok so I've saved I pasted into a text file (See attachment Lisp1)
    Used APPLOAD to load it (see attachment Lisp2)

    How do I actually run the command. I did a bit of searching but couldn't find an answer.

    Thanks in advance!!!
    imagelisp1.PNG
    imagelisp2.PNG
  •  Got it! had to add the folder to my support file search paths!

  •  Got it! had to add the folder to my support file search paths!

    Should have added:

    type:

    (load "0_lines")

    That single line of text can be saved as a tool
This discussion has been closed.