See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Create selection set of newest entities created by copy command

  1. #1
    Active Member Borg's Avatar
    Join Date
    2001-04
    Posts
    66
    Login to Give a bone
    0

    Default Create selection set of newest entities created by copy command

    Let's say that I select a bunch of stuff and copy it. I want to make a selection set
    of the new stuff created by the copy command.

    Thanks for any and all suggestions. :

  2. #2
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    You can use this
    Code:
    ;;============================================================
    ; Rune Wold and Michael Puckett - modified
    ; e.g. usage (setq marker (ALE_LASTENT))
    ;;  Function to get the absolute last entity in the database
    ;;  Returns nil is drawing is completely empty
    (defun ALE_LastEnt ( / EntNam OutVal)
      (and
        (setq OutVal (entlast)); if there is an entity in drawing
        (while (setq EntNam (entnext OutVal))
          (setq OutVal EntNam)
        )
      )
      OutVal
    )
    ;;============================================================
    ;;  Function to get new items after EntNam in the database
    (defun ALE_Ss-After (EntNam / EntNxt SelSet)
      (cond 
        ( (not EntNam) (ssget "_X") ); dwg was empty
        ( (setq EntNxt (entnext EntNam)); get new items
          (setq SelSet (ssadd EntNxt))
          (while (setq EntNxt (entnext EntNxt))
            (if (entget EntNxt) (ssadd EntNxt SelSet))
          )
          SelSet
        )
      )
    )
    ;=========================================================
    
    ;;=====================================================================
    ;;===================  Code to get New objects ========================
    ;;=====================================================================
    (setq elast (ALE_LastEnt)); get last entity in database
    (setq newbies (ssadd)) ; create an empty selection set
    ;;
    ;; Do your array or paste command 
    ;;
    (setq newbies (ALE_Ss-After elast))
    ;; newbies is a selection set of all items created by your command.
    ;;=====================================================================
    Last edited by CAB2k; 2007-03-27 at 12:56 PM.

  3. #3
    Active Member Borg's Avatar
    Join Date
    2001-04
    Posts
    66
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    Thanks. I'll give it a try next week.

  4. #4
    Member
    Join Date
    2004-10
    Posts
    16
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    how about

    (setq sel (ssget))
    (command "copy" sel "" "0,0" "0,0" "move" "P" "" pause pause)
    (setq sel2 (ssget "p"))

  5. #5
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    Quote Originally Posted by eddyhgng
    how about

    (setq sel (ssget))
    (command "copy" sel "" "0,0" "0,0" "move" "P" "" pause pause)
    (setq sel2 (ssget "p"))
    No point, really .. sel2 will contain the same selection as sel. I see only two ways, one of which is given above by Ab2draft. The other way is using the ActiveX methods Copy and CopyObjects, which will both return the copied object(s).

  6. #6
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    Quote Originally Posted by stig.madsen
    No point, really .. sel2 will contain the same selection as sel.
    Hi

    Have you actually tried what "eddyhgng" posted, I think you might be surprised....

    Have a good one, Mike

  7. #7
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    I was surprised, it did work. Not sure I understand why?

  8. #8
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    Quote Originally Posted by Mike.Perry
    Hi

    Have you actually tried what "eddyhgng" posted, I think you might be surprised....

    Have a good one, Mike
    Yes, line by line. It moves the original objects so that it appears to be the new objects being selected .. kinda like an optical illusion.

  9. #9
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Question Re: Create selection set of newest entities created by copy command

    Quote Originally Posted by stig.madsen
    Yes, line by line. It moves the original objects so that it appears to be the new objects being selected .. kinda like an optical illusion.
    Hi Stig

    Can you please explain, you've lost me (not difficult I know).

    Mike

  10. #10
    Active Member Borg's Avatar
    Join Date
    2001-04
    Posts
    66
    Login to Give a bone
    0

    Default Re: Create selection set of newest entities created by copy command

    Reply to Eddyhgng:

    Thanks for your input.
    What I'm trying to do is create a rector(this part is done) that reacts on the copy command.
    It will then iterate through all of the new objects created by said command to check for blocks of a particular name.

    I should be able to incorporate the code AB2DRAFT to make this happens.
    Your code is valid but I don't wan't to redefine the copy command.

Page 1 of 3 123 LastLast

Similar Threads

  1. Select the last N entities created in a lisp routine.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 7
    Last Post: 2015-06-23, 04:36 PM
  2. Create a Selection Set of Entities as They are Created
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2008-10-12, 06:37 PM
  3. Copy and Move command selection problem
    By smckee in forum AutoCAD General
    Replies: 7
    Last Post: 2008-09-05, 05:03 PM
  4. Replies: 1
    Last Post: 2007-03-08, 01:12 PM
  5. Slow selection of entities.
    By peter.woodcock in forum AutoCAD General
    Replies: 2
    Last Post: 2004-09-23, 01:19 PM

Posting Permissions

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