Where find selection set max

Discussion in 'AutoCAD' started by Adesu, Aug 16, 2004.

  1. Adesu

    Adesu Guest

    Can you point me where I find " I know that AutoCAD can allow only upto 128
    selection sets per time."
    thanks for your help.
    Best regards
    Ade Suharna
     
    Adesu, Aug 16, 2004
    #1
  2. Adesu

    R.K. McSwain Guest

    R.K. McSwain, Aug 16, 2004
    #2
  3. Adesu

    John Uhden Guest

    From the AutoCAD 2002 Developer help:
    "Attempting to manage a large number of selection sets simultaneously is not
    recommended. An AutoLISP application cannot have more than 128 selection sets
    open at once. (The limit may be lower on your system.) When the limit is
    reached, AutoCAD refuses to create more selection sets. Keep a minimum number of
    sets open at a time, and set unneeded selection sets to nil as soon as possible.
    If the maximum number of selection sets is reached, you must call the gc
    function to free unused memory before another ssget will work."

    Using (gc) may still not free up selection sets if each is bound to a unique
    variable.

    This is basically the same as that posted July 2003 by Jason Piercey <sheesh,
    even the function name's the same!>:
    (defun C:ClearSS ( / n)
    (setq n 0)
    (foreach item (atoms-family 0)
    (and
    (= (type (eval item)) 'PICKSET)
    (setq n (1+ n))
    (set item nil)
    )
    )
    (gc)
    (princ (strcat "\nCleared out " (itoa n) " selection sets."))
    (princ)
    )
     
    John Uhden, Aug 16, 2004
    #3
  4. Adesu

    ECCAD Guest

    Adesu,
    When 'done' with a given selection set, it is always a good idea to 'null' it out (nil). e.g.
    (setq ss (ssget "X")); get all
    .......do something with the ss..
    (setq ss nil)

    This allows you to do more than the limit.

    Bob
     
    ECCAD, Aug 16, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi R.K.McSwain,John Uhden and ECCAD,thanks a lot for your help
    I mean in AutoCAD 2000 ,where I find it.
     
    Adesu, Aug 16, 2004
    #5
  6. Adesu

    John Uhden Guest

    I'm not sure what you mean about where to find "it." The documentation for 2002
    is the same I think for 2000. The help file is called acad_dev.chm and should be
    found in AutoCAD's "Help" subdirectory.
     
    John Uhden, Aug 16, 2004
    #6
  7. Adesu

    John Uhden Guest

    I forgot to mention that localizing variables is the simplest and prefered means
    of avoiding the selection set overrun as they don't become global...
    (defun C:Whatever ( / SS)
    (setq SS (ssget <filter>))
    ;; etcetera
    )

    Here's a really bad example:
    (defun C:ReallyBad ()
    (setq Done nil i 0)
    (while (not Done)
    (set (read (strcat "SS" (itoa i)))(ssget <filter>))
    ;; whatever
    (setq i (1+ i))
    )
    )
     
    John Uhden, Aug 16, 2004
    #7
  8. Adesu

    Adesu Guest

    Sorry John for you become confuse,I mean I'm not yet find " I know that
    AutoCAD can allow only upto 128
    selection sets per time." in " AutoCAD 2000 Help "
     
    Adesu, Aug 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.