looking for a lisp

Discussion in 'AutoCAD' started by gomez, Apr 15, 2004.

  1. gomez

    gomez Guest

    does anybody have a lisp that will select the most recently copied objects .
    for example copy and place objects and then you decide to move or copy the
    objects to a another location. I want to be able to select the recently
    copied objects not the original objects that you just copy. If I select move
    then previous it wants to select the original copied objects not the newly
    placed objects. if I hit last it will only select the last copied object not
    the entire set of items. I know this is how the command works but I want to
    be able to select the most recently entire set of copied objects. hope this
    makes sense.

    Thanks for any help.
     
    gomez, Apr 15, 2004
    #1
  2. gomez

    gomez Guest

    thanks I will do a search
     
    gomez, Apr 16, 2004
    #2
  3. gomez

    Mark Propst Guest

    I don't know the solution he refers to but it may be something like get
    (entlast) just before the copy command, store the handle, then anything with
    a handle larger will be in your new set
    undoubtably j.u. will have the tasty way to do that...
     
    Mark Propst, Apr 16, 2004
    #3
  4. begin your loop:
    (setq ent1 (entlast))

    do your stuff


    (setq ss1 (ssadd))
    (while (setq ent1 (entnext ent1))(ssadd ent1 ss1))

    now copy or rotate or whatever

    end of your loop


    Jamie Duncan

    Consulting - If you're not part of the solution, there's good money in
    prolonging the problem.
     
    Jamie Duncan \(remove lock to reply\), Apr 16, 2004
    #4
  5. This is related to what I do for a copy-&-rotate function. I have a lisp
    routine that asks for a selection set, then copies it with no displacement,
    that is, on top of itself. Then it calls up Move, and picks the Previous
    selection set, and asks for displacement. Then it calls up Rotate, picks
    the Previous selection set again, and falls back into regular prompts to ask
    for a base point and rotation:

    [Copy&Rot]*^C^CSELECT \COPY P 0,0 0,0 MOVE P \\ROTATE P ;
    [Pardon the blue underlined text - I can't seem to get it to not "recognize"
    the two move-displacement-user-input back-slashes as a code for something
    else.]

    If you replace the basic Copy command with a routine like the following,
    which copies the selection set in place, then moves it, you can then do
    whatever command you want on the Previous selection set, and it will be the
    ones at the new location, not the original location:

    [CopyToNewPrev]*^C^CSELECT \COPY P 0,0 0,0 MOVE P

    That's done like a menu pick item, but you could actually redefine Copy, I
    suppose.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Apr 16, 2004
    #5
  6. gomez

    gomez Guest

    Thanks. I give it a shot.
    --
    gomez


     
    gomez, Apr 16, 2004
    #6
  7. gomez

    Don Butler Guest

    This is what I use...

    (bpc:mark *TEST*)
    ....Add Objects
    (setq ss (bpc:catch *TEST*))
    ....Continue

    (defun bpc:mark (appname)
    (command "._point" "0,0,0");;Avoid error if (entlast) returns NIL (No
    Entlast)
    (set (read appname) (entlast))
    (entdel (entlast))
    )

    (defun bpc:catch (appname / ss ent)
    (setq ss (ssadd))
    (setq ent (eval (read appname)))
    (while
    (setq ent (entnext ent))
    (if ent (ssadd ent ss))
    )
    (if ss
    (progn
    (command "._select" ss "")
    (setq ss (ssget "p" (list (cons 410 (getvar "ctab")))))
    )
    )
    ss
    )

    Don
     
    Don Butler, Apr 16, 2004
    #7
  8. I used do this too - but you have to error trap it

    if someone hits esc in the middle = you have a mess (ie stuff on top of
    stuff - and user may not be awaree)

    here is a copy rotate that uses another technique (see my post above)

    (defun c:arctcprot (/ cpmerr pt1 ss1 ss2 looper entymark end1 exclude_list)
    (setq ss1 nil looper T entymark (entlast) exclude_list (list "SEQEND"
    "VERTEX" "ATTRIB"))
    (setvar "osmode" 739)
    (prompt "\nSelect objects to copy and rotate: ")
    (command "select" "auto" pause)
    (setq ss1 (ssget "p"))
    (initget 1)
    (setq pt1 (getpoint "\nBase point: "))
    (while looper
    (setvar "osmode" 739)(setvar "orthomode" 0)
    (command ".copy" ss1 "" pt1 pause)
    (setvar "orthomode" 1)
    (setq ss2 (ssadd))
    (while (setq entymark (entnext entymark))
    (if (not (member (arctgv 0 (entget entymark)) exclude_list))(ssadd
    entymark ss2))
    )
    (prompt "\nRotation angle: ")(setvar "osmode" 0)
    (command ".rotate" ss2 "" (getvar "lastpoint") pause)
    (setq entymark (entlast))
    (prompt "\nHit ESC to stop Copy-Rotate Function: ")
    )
    (princ)
    )


    note the use of an exclude list to ignore subentities of complex entities
    I also removed sysvar functions and error stuff 'cause you might do it
    differently

    Jamie Duncan

    Consulting - If you're not part of the solution, there's good money in
    prolonging the problem.
     
    Jamie Duncan \(remove lock to reply\), Apr 16, 2004
    #8
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.