Jump to content
Baber62

Getting error message "exceeded maximum number of selection sets"

Recommended Posts

Baber62

Need assistance with the code below, using it to toggle my viewports (open and close). However, after a few times of using it throws up the message "exceeded maximum number of selections" and doesn't do nothing resulting in me having to close down and restart AutoCAD. Not sure if it this routine which is doing it but when I select a grip and try to move it grip turns red and stays in same position.

 

; Toggle the "Display Locked" Variable of selected viewports based on the first view port selected

(defun c:vplocktoggle (/ Ename ss )
 (princ "\nSelect Viewport...")
 ;Get selection set, allow only viewports
 (setq ss (ssget '((0 . "viewport")))) 
 (if (IsVpLocked (setq Ename (ssname ss 0)))
   ;Viewport is locked.  Run Unlock commands
   (progn
     (princ "\nViewport selected is Locked")
     ;Unlock viewport
     (command "mview" "Lock" "OFF" ss "")
     ;Change viewport color to red to indicate it is Unlocked
     (command ".change" ss "" "p" "c" "1" "")
     (princ "\nViewport is now Unlocked")
   )
   ;Viewport is unlocked. Run Lock commands
   (progn
     (princ "\nViewport selected is Unlocked")
     ;Lock viewport
     (command "mview" "Lock" "ON" ss "")
     ;Change viewport color to ByLayer to indicate it is Locked
     (command ".change" ss "" "p" "c" "bylayer" "")
     (princ "\nViewport is now Locked")
   )
 )
 (princ)
)


; Return: T if locked, Nil otherwise
(defun IsVpLocked (Ename)
(eq 16384 (logand 16384 (cdr (assoc 90 (entget Ename)))))
)

Share this post


Link to post
Share on other sites
Grrr

Interesting issue, could you provide more assistance by running this code and post the result here?

(defun C:DumpSSets ( / SSets )
(setq SSets (vla-get-SelectionSets (vla-get-ActiveDocument (vlax-get-acad-object))))
(vlax-dump-object SSets T)
(princ)
) (vl-load-com) (princ)

Share this post


Link to post
Share on other sites
Hippe013

The following is from help.

 

The selected objects are highlighted only when ssget is used with no arguments. Selection sets consume AutoCAD temporary file slots, so AutoLISP is not permitted to have more than 128 open at one time. If this limit is reached, AutoCAD cannot create any more selection sets and returns nil to all ssget calls. To close an unnecessary selection set variable, set it to nil.

Share this post


Link to post
Share on other sites
Baber62

Hi Grrr,

 

Here's the result from running the code that you provided:

 

Command: DUMPSSETS

; IAcadSelectionSets: The collection of all selection sets in the drawing

; Property values:

; Application (RO) = #

; Count (RO) = 0

; Methods supported:

; Add (1)

; Item (1)

Command:

Share this post


Link to post
Share on other sites
Lee Mac

Try leaving the VLIDE window open whilst you work on a drawing, ensuring that the Debug > Break on Error option is enabled (as described here); then, when the error is encountered, go to Debug > Last Break Source to identify the cause.

Share this post


Link to post
Share on other sites
Grrr
Hi Grrr,

 

Here's the result from running the code that you provided:

 

Command: DUMPSSETS

; IAcadSelectionSets: The collection of all selection sets in the drawing

; Property values:

; Application (RO) = #

; Count (RO) = 0

; Methods supported:

; Add (1)

; Item (1)

Command:

 

Thanks,

Damn I thought/expected that the SS collection would act as the "trash" container that would need to be empten, but I was wrong.

Meaning that the "Count" property would have some high value.

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...