entsel, fail, use fail-point for crossing/fence

Discussion in 'AutoCAD' started by GTASteve, Jan 11, 2005.

  1. GTASteve

    GTASteve Guest

    Hello all,

    I want the LISP, to do similar to say, the ERASE command.

    e.g.
    ERASE [Enter]
    {pickbox shown on screen, user can select a single object}
    {if user clicks an empty space, the crossing/window option is auto-invoked}

    For my scenario, I want something similar...

    (setq usrPick (entsel "\nSelect Object: "))
    ;if this fails, I want the 'fail-point', so that I can use this point to start a fence...
    ;I know it seems weird, but there is a good reason for this behaviour... ;-)

    Cheers,
    Steve
     
    GTASteve, Jan 11, 2005
    #1
  2. GTASteve

    T.Willey Guest

    (setq Pt1 (cadr (grread 3)))

    This should give you the point when entsel fails to select something.

    Tim
     
    T.Willey, Jan 11, 2005
    #2
  3. GTASteve

    Jim Claypool Guest

    Use (ssget ":S") instead. Just keep in mind that with a crossing window you
    can select more than one object.
     
    Jim Claypool, Jan 11, 2005
    #3
  4. Maybe this will help?


    ;Modified from Tanzillo's (SelectObjectOrWindow)
    ;Return: List, list returned by (entsel) or a list of two points
    (defun SelectObjectOrPickPoints (msg / Res p2)
    (if (not msg) (setq msg "\nSelect object/<first point>: "))
    (setvar "errno" 0)
    (if (setq Res (entsel msg))
    Res
    (if (and (eq 7 (getvar "errno"))
    (setq Res (grread t))
    (eq (car Res) 5)
    (setq p2 (getpoint (cadr Res) "\nopposite corner: "))
    )
    (list (cadr Res) p2)
    )
    )
    )
     
    Jason Piercey, Jan 11, 2005
    #4
  5. GTASteve

    Adesu Guest

    Hi Steve,may be you can try my code

    ; eo is stand for erase object
    ; Design by Ade Suharna <>
    ; 4 January 2005
    ; Program no.155/01/2005
    ; Edit by
    (defun c:eo (/ ob ss)
    (while
    (setq ob (strcase (getstring T "\nENTER NAME OBJECT: ")))
    (setq ss (ssget "x" (list (cons 0 ob))))
    (command "_erase" ss "")
    )
    (princ)
    )
     
    Adesu, Jan 12, 2005
    #5
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.