Jump to content

It’s possible AutoCad selection save (s1, s2, etc.) & after some time reuse


Recommended Posts

Posted

Dear All,

 

It’s possible AutoCad selection save (s1, s2, s3 etc.) & after some time

reuse the selection sets inside some lisp or inside a command

 

Just like Photoshop selection

Posted

Of course, but!

Selection sets consume AutoCAD temporary file slots, so AutoLISP is not permitted to have more than 128 open at one time.

and they exist only in a single session, ie closed\open and they're gone: (

Posted

I think TimSpangler wrote something that would facilitate this a while back. :)

Posted

At the Command: prompt type this...

 

(setq ss1 (ssget))

 

Select your objects.

 

This creates a selection set called ss1.

To retrieve (or reuse) the selection set just type !ss1 at any Select Objects: prompt.

 

Once you close the drawing the selection set is gone like the others have said.

 

You can do this at anytime from the command prompt.

I had several selection sets like this written into my in my menu.

 

Hope this helps...

Posted
Dear All,

 

It’s possible AutoCad selection save (s1, s2, s3 etc.) & after some time

reuse the selection sets inside some lisp or inside a command

 

Just like Photoshop selection

 

Another way to create groups separately for the particular selection set

These woul stored in the current drawing

See Help file about

 

~'J'~

Posted
Another way to create groups separately for the particular selection set

These woul stored in the current drawing

See Help file about

 

~'J'~

 

At the Command: prompt type this...

 

(setq ss1 (ssget))

 

Select your objects.

 

This creates a selection set called ss1.

To retrieve (or reuse) the selection set just type !ss1 at any Select Objects: prompt.

 

Once you close the drawing the selection set is gone like the others have said.

 

You can do this at anytime from the command prompt.

I had several selection sets like this written into my in my menu.

 

Hope this helps...

 

DEAR SIR,

 

THX FOR HELP ME..:)

Posted

Glad to help someone (Finally!!)

Posted
At the Command: prompt type this...

 

(setq ss1 (ssget))

 

Select your objects.

 

This creates a selection set called ss1.

To retrieve (or reuse) the selection set just type !ss1 at any Select Objects: prompt.

 

Once you close the drawing the selection set is gone like the others have said.

 

You can do this at anytime from the command prompt.

I had several selection sets like this written into my in my menu.

 

Hope this helps...

 

I do not know how it was in previous versions, but in 2010 does not happen, ie (setq ss1 (ssget)) works, but the Select Objects: ss1 - no, writes *Invalid selection*, but if you first select(highlight) selection (sssetfirst nil ss1), and then apply it to any command that all is well.

Or put in command line this (vl-cmdf "command name" ss1 "") for example (vl-cmdf "_move" ss1 "")

 

 

I think TimSpangler wrote something that would facilitate this a while back. :)

Well ... me, in principle, it is not necessary, just curious, where can I see this (written by TimSpangler)

Posted

(Can't sleep)

Here's a way...

 

You'll need this subroutine: http://www.cadtutor.net/forum/showpost.php?p=271368&postcount=13

;;; Stored Selection Sets
;;; Required Subroutines: AT:ListSelect
;;; Alan J. Thompson, 03.26.10
(defun c:SSS (/ #Choice #Name #SS)
 (vl-load-com)
 (or *SSS:Option* (setq *SSS:Option* "Store"))
 (initget 0 "Recall rEmove Store")
 (if (vl-consp *SSS:Sets*)
   (setq *SSS:Option*
          (cond ((getkword (strcat "\nStore Selection Sets\nSpecify option. [Recall/rEmove/Store] <"
                                   *SSS:Option*
                                   ">: "
                           ) ;_ strcat
                 ) ;_ getkword
                )
                (*SSS:Option*)
          ) ;_ cond
   ) ;_ setq
   (setq *SSS:Option* "Store")
 ) ;_ if
 (cond
   ((eq *SSS:Option* "Recall")
    (if (vl-consp *SSS:Sets*)
      (and (setq #Choice (car (AT:ListSelect
                                "Recall Stored Selection Sets"
                                "Select Selection Set:"
                                "10"
                                "10"
                                "false"
                                (vl-sort (mapcar 'car *SSS:Sets*) '<)
                              ) ;_ AT:ListSelect
                         ) ;_ car
           ) ;_ setq
           (if (vl-position (getvar 'cmdactive) '(1 2))
             (and (setq SSS (cdr (assoc #Choice *SSS:Sets*)))
                  (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                  (vla-sendcommand *AcadDoc* "!SSS ")
             ) ;_ and
             (sssetfirst nil (cdr (assoc #Choice *SSS:Sets*)))
           ) ;_ if
      ) ;_ and
      (alert "No selection sets stored!")
    ) ;_ if
   )
   ((eq *SSS:Option* "rEmove")
    (if (vl-consp *SSS:Sets*)
      (and (setq #Choice (AT:ListSelect
                           "Remove Stored Selection Sets"
                           "Select Selection Set(s):"
                           "10"
                           "10"
                           "true"
                           (vl-sort (mapcar 'car *SSS:Sets*) '<)
                         ) ;_ AT:ListSelect
           ) ;_ setq
           (progn
             (foreach x #Choice (setq *SSS:Sets* (vl-remove (assoc x *SSS:Sets*) *SSS:Sets*)))
             (print #Choice)
             (princ (strcat "\n" (itoa (length #Choice)) " stored selection set(s) removed."))
           ) ;_ progn
      ) ;_ and
      (alert "No selection sets stored!")
    ) ;_ if
   )
   ((eq *SSS:Option* "Store")
    (and
      (/= ""
          (setq
            #Name (strcase
                    (getstring
                      t
                      (strcat (if (vl-consp *SSS:Sets*)
                                (strcat "\nStored Selection Sets: "
                                        (vl-princ-to-string (vl-sort (mapcar 'car *SSS:Sets*) '<))
                                ) ;_ strcat
                                ""
                              ) ;_ if
                              "\nSelection set name: "
                      ) ;_ strcat
                    ) ;_ getstring
                  ) ;_ strcase
          ) ;_ setq
      ) ;_ /=
      (or (not (vl-position #Name (mapcar (function car) *SSS:Sets*)))
          (alert (strcat "Sorry, \"" #Name "\" is already a stored selection set."))
      ) ;_ or
      (setq #SS (ssget))
      (setq *SSS:Sets* (cons (cons #Name #SS) *SSS:Sets*))
      (princ (strcat "Selection set \"" #Name "\" stored."))
    ) ;_ and
   )
 ) ;_ cond
 (princ)
) ;_ defun

Here's something similar I did: http://www.cadtutor.net/forum/showthread.php?t=45215

  • Like 1
Posted
Well ... me, in principle, it is not necessary, just curious, where can I see this (written by TimSpangler)

 

I think I saw it on theSwamp.org a while back :unsure:

Posted

I do not know how it was in previous versions, but in 2010 does not happen,

ie (setq ss1 (ssget)) works, but the Select Objects: ss1 - no, writes *Invalid selection*

 

 

(Assuming SS1 has been created...)

 

It's not Select Objects: ss1

 

It's Select Objects: !ss1

Posted

I've updated my previous posting. Now if a command is inactive, it will select everything (for pickfirst) and if a command is active, it will store the chosen selection set as SSS (variable) and print to the command line as "!SSS ". The selection set will remain stored as SSS, which can be called at anytime with "!SSS".

Posted

It's not Select Objects: ss1

It's Select Objects: !ss1

 

Well, thank ILoveMadoka, I never could understand why I can not use variables in macros.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...