+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 27
  1. #1
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Question Erase specified length of lines in by Script/Lisp

    Registered forum members do not see this ad.

    Good Afternoon All,

    i was wondering if someone here could help me, i have done a search on the web and here trying to find what i am after but have had no luck.

    I need to erase a whole heap of lines ranging from about 1.25 to 3 in length, i need to do this in multiple xrefs, just realised you can't use QSELECT in script, and the SSX command does not do the trick either,

    does anyone out there have a script/lisp routine that erases the specified length of lines in multiple drawings?

    i hope this enough information.

    cheers

    Emily

  2. #2
    Forum Deity Dadgad's Avatar
    Using
    AutoCAD 2012
    Join Date
    Nov 2011
    Location
    At the confluence of worthlessness & invaluability
    Posts
    3,176

    Default

    Are you able to use the FILTER command instead?
    Once you have described it sufficiently, make sure you SAVE the filter for
    subsequent use.
    Volume and repetition do not validate opinions forged in the absence of thought.

  3. #3
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Default

    Quote Originally Posted by Dadgad View Post
    Are you able to use the FILTER command instead?
    Once you have described it sufficiently, make sure you SAVE the filter for
    subsequent use.
    hi Dadgad,

    i have not really used the Filter command before, i tried using it earlier, but when i select one of the lines to add in the filter, it does not list it's length, and stince i am unfamiliar with the filter command, i am unsure weather it's going to work or not.

  4. #4
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,664

    Default

    Try this ...

    Code:
    (defun c:Test (/ ss i sn l)
      (if (setq ss (ssget "_:L" '((0 . "LINE"))))
        (repeat (setq i (sslength ss))
          (setq sn (ssname ss (setq i (1- i))))
          (setq l (distance (cdr (assoc 10 (entget sn))) (cdr (assoc 11 (entget sn)))))
          (if (or (eq l 1.25) (eq l 3.0) (and (> l 1.25) (< l 3.0)))
            (entdel sn)
            )
          )
        )
      (princ)
      )
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  5. #5
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Default

    Hi Tharwat,

    when i run the lisp, prompts me to select objects, and when i click on the line, it does not find it, i even windowed everything in my drawing and it still doesn't select anything,

    could it have something to do with the lines being polylines?

  6. #6
    Forum Deity Dadgad's Avatar
    Using
    AutoCAD 2012
    Join Date
    Nov 2011
    Location
    At the confluence of worthlessness & invaluability
    Posts
    3,176

    Default

    It is a great tool, very helpful, unfortunately I have been trying to set it up for you too, and failed.
    It sounds like a very simple lisp, no doubt someone will soon help you sort it out.
    Volume and repetition do not validate opinions forged in the absence of thought.

  7. #7
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Default

    Quote Originally Posted by Dadgad View Post
    Polylines don't have LENGTH.
    If you explode a few of them, into LINES, as a test,
    no doubt Tharwat's lisp will work.
    thanks Dadgad,

    the lisp works, however now that i have to explode the Plines, they explode into tiny lines, and also the routine erases other lines that are now the same length since exploding that i don't want erased, if it helps, i really only need all vertical lines erased of the length i specify.

  8. #8
    Forum Deity Dadgad's Avatar
    Using
    AutoCAD 2012
    Join Date
    Nov 2011
    Location
    At the confluence of worthlessness & invaluability
    Posts
    3,176

    Default

    Emily I made a huge mistake in my earlier post POLYLINES do have length.
    I am guessing (I do not write lisp) that you need to change the "LINE" in Tharwat's
    code to "PLINE" .
    Attached Images
    Volume and repetition do not validate opinions forged in the absence of thought.

  9. #9
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Default

    hehe thanks Dadgad, i had a look before using QSELECT, then selecting polyline and saw that it does have the length, i thought it did as i usually use the QSELECT this way

    i also changed the "LINE" part of the lisp to "PLINE" but it did not work, might try "PL"

    thankyou for helping me i greatly appreciate it.

  10. #10
    Full Member
    Using
    AutoCAD 2011
    Join Date
    Aug 2008
    Location
    Australia
    Posts
    65

    Default

    Registered forum members do not see this ad.

    just changed it to "PL" and that does not work either

Similar Threads

  1. Trying to Erase 4 lines from a project
    By bibi in forum Student Project Questions
    Replies: 8
    Last Post: 26th Oct 2011, 08:19 pm
  2. Replies: 2
    Last Post: 11th Oct 2011, 12:41 pm
  3. Need Lisp to create stock length with Lap length
    By rajeshmuthu in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 2nd Oct 2011, 06:10 pm
  4. Selecting lines for erase or copy
    By duece in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 6th Apr 2008, 04:20 am
  5. Erase multiple lines with same layers...???
    By ElmZ in forum AutoCAD General
    Replies: 2
    Last Post: 26th Oct 2006, 10:32 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts