HELP with break, entlast, while loop

Discussion in 'AutoCAD' started by chadidjaja, Aug 20, 2004.

  1. chadidjaja

    chadidjaja Guest

    Hello,

    I found a snippet to break a selected line at a selected intersection. I'm trying to modify the code so that it only asks once for the line to be broken, and repeats asking for intersections.

    I tried to get the last entity added by the "break" command by using entlast, however I'm afraid that's not the right way.
    The code always fails after entlast.

    Is there another way doing this?

    Thanks much!

    (while (not ss)
    (setq ss (entsel "\nSelect line to break: "))
    );endwhile
    (redraw (car ss) 3)
    (setvar "osmode" 32)

    (while
    (setq point (osnap (getpoint "\nSelect intersectiont: ") "int"))
    (command "break" ss "f" point "@")
    (setq ss (entget (entlast)))
    );while
     
    chadidjaja, Aug 20, 2004
    #1
  2. chadidjaja

    CAB2k Guest

    Try This:
    Code:
    ;;  Repeat Break at pick point
    (defun c:brk ()
    (while (setq ent (entsel "\n*-*  Select Break Point. *-*"))
    (setq pt (cadr ent)
    pt (list (car pt)(cadr pt))
    );(cadr ent))
    (command "_.BREAK" ent "_F" pt "@")
    )
    )
     
    CAB2k, Aug 21, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.