Jump to content

Recommended Posts

Posted (edited)

Is it possible to use the grread function to deselect objects by holding down the SHIFT key+left click?

Edited by masao_8
Posted

I think you would need to test for 'shift' being pressed and the test for a left mouse entity selection.

 

Do a 'princ' on your grread loop to display what you are doing, shift and select something - which should give you what you want to test for.

  • Like 1
Posted

Isn't that how CAD works already? you select something either by mouse clicke or window it will be highlighted hold shift to deselect it the same way.

I know if you have to many things selected they are no longer highlighted.

  • Agree 1
Posted
1 hour ago, mhupp said:

Isn't that how CAD works already? you select something either by mouse clicke or window it will be highlighted hold shift to deselect it the same way.

I know if you have to many things selected they are no longer highlighted.

Doesn't that depend on PICKADD value? I do believe the default is select to add and shift select to deselect from selection set.

 

To that end, it needs to be clarified from OP what they need, my WAG is something being already done with grread and need to deselect.

 

AFAIK (and that's very little, mostly from my previous thread )

 

 

The left click is doable with grread, but it would ignore the SHIFT (also CTRL, etc.), so probably would need something else to show the SHIFT key is pressed.

 

Which reminds me I need to get back to work on that and the centerline on rivers, roads, etc. problem when I get regular work caught up.

Posted

Perhaps you could use the undocumented (acet-sys-shift-down) express tools function within the grread loop? Then you would have to manipulate highlighting with (redraw [3/4]) and use (ssadd) and (ssdel) to update the selection set.

  • Like 1
Posted (edited)

@masao_8 Here is a solution for a simple single selection add and SHIFT-Select to remove. Perhaps this will give you a basis for starting:

;; Function to do a simple Select/Deselect using grread.
;; By PJK - 6/16/2026
(defun pjk-grread-Select (/ done en grl grc grv ss)
   (if acet-load-expresstools (acet-load-expresstools))
   (setq ss (ssadd))
   (princ "\nSelect to add objects or SHIFT+Select to remove from selection set: ")
   (while (not done)
      (setq grl (grread T 15 2)
            grc (car grl)
            grv (cadr grl)
      )
      (cond
         ((= grc 3)
            (if (setq en (car (nentselp grv)))
               (if (acet-sys-shift-down)
                  (progn
                     (if (ssmemb en ss)(ssdel en ss))
                     (redraw en 4)
                  )
                  (progn
                     (ssadd en ss)
                     (redraw en 3)
                  )
               )
            )
         )
         ((= grc 2)
            (setq done (if (vl-position grv '(13 32)) T nil))
         )
         ((= grc 25)(setq done T))
      )
   )
   (if (> (sslength ss) 0)
      (progn
         (foreach i (mapcar 'cadr (ssnamex ss))(redraw i 4))
         ss
      )
      nil
   )
)

 

Edited by pkenewell
1) Added right-click completion to the loop. 2) added redraw of selection set on completion of the routine and returns nil if the selection set is empty.

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