TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TimSpangler on February 22, 2006, 04:52:27 PM

Title: Selection Sets
Post by: TimSpangler on February 22, 2006, 04:52:27 PM
Are they stored in the drawing or are the local to the session.  If I create a selection set < Selection Set: 3 >  If I close the drawing and reopen it will it still be availible?

What are the effacts of creating selections set of the same objects over and over?
Title: Re: Selection Sets
Post by: sinc on February 22, 2006, 05:04:34 PM
Selection sets are created as they are used, and exist only in memory.  They are not persisted anywhere.

But you can only have a maximum of (I think) 127 selection sets at one time.  So, you should make sure you free up selection sets you don't need.  If you use SSGET, then all you have to do is set the variable to nil when you are done (or use a local variable for the selection set).  If you use Active X, delete the selection set when you are done.
Title: Re: Selection Sets
Post by: TimSpangler on February 22, 2006, 05:18:24 PM
OK so if I have a function Like this:

Code: [Select]
(defun CREATE_SELSET (/ HandleList NewSet X)

(setq NewSet (ssadd))
(setq HandleList (GET_HANDLE_LIST (GET_XRECORD "TGS_SSETS" (nth SSet(GET_KEYS  "TGS_SSETS")))))
(foreach X HandleList
(setq NewSet  (ssadd (handent X) NewSet))
)
NewSet
)

Which create a selections set of handles stored in an Xrecord.  I wouldn't have to worry?
Title: Re: Selection Sets
Post by: CAB on February 22, 2006, 08:04:02 PM
Somewhat related.

http://www.theswamp.org/forum/index.php?topic=8451.0
Title: Re: Selection Sets
Post by: sinc on February 23, 2006, 11:03:15 AM
OK so if I have a function Like this:

...

Which create a selections set of handles stored in an Xrecord.  I wouldn't have to worry?

If all you are doing is storing handle in Xdata, then using the list of handles to recreate selection sets, it looks like it should work.  Keep in mind that you list of handles may be out-of-date - objects regularly get created and destroyed.  Break a line, and your old handle is no longer valid.

There is some question about why you are doing this.  It sounds like you are trying to use selection sets to mimic the functionality of a group.  So why not just use a group?

There is no danger in using a group, just so long as you realize you are using a group, and not a block.  Groups have their uses, and blocks have their uses.  Some of these uses sort-of overlap, but Groups are Groups and Blocks are Blocks.  The only time I really see people get into trouble is when they don't know the difference, and try to work with a group as if it is a block.
Title: Re: Selection Sets
Post by: TimSpangler on February 24, 2006, 09:19:54 AM
Thanks CAB. 

That is were this post kind of sprung from.  I am revamping an old routine.

Sinc
What I am attempting to do is to store selections sets between drawing sessions.  My next step is to check the handles to makesure that they still exsist before recreating the selections set.  I just wanted to make sure that i would run into any problems creating these selection sets.

Thanks guys.