Jump to content

Select entities by crossing window


thekiki

Recommended Posts

Hi,

I'm looking for 3 lisp that can allow me to select only:

   lisp 1 - polyline by crossing window.

   lisp  2 - text by crossing window.

   lisp 3 - Blocks by crossing window.

Thanks for your help.

Link to comment
Share on other sites

@thekiki This is very simple. This could also be done very easily without AutoLISP with the FILTER command.

(defun c:Selpline (/ p1)
   (ssget "C" (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (getcorner p1 "\nSelect 2nd point of crossing window: ") '((0 . "*POLYLINE")))
)

(defun c:Seltext (/ p1)
   (ssget "C" (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (getcorner p1 "\nSelect 2nd point of crossing window: ") '((0 . "*TEXT")))
)

(defun c:Selblock (/ p1)
   (ssget "C" (setq p1 (getpoint "\nSelect 1st corn of cossing window: ")) (getcorner p1 "\nSelect 2nd point of crossing window: ") '((0 . "INSERT")))
)

 

Link to comment
Share on other sites

So what I might do is look at the questions you asked before and refer to this: http://lee-mac.com/ssget.html to see if you can apply that.

 

I'd reckon all you need to do is modify the word "TEXT" to whatever you want.

 

If you want to find the text to use in the filter, use this:

 

(cdr (assoc 0 (entget (car (entsel "Select Entity: ")))))

 

Which will give the description of the entity type (for example "TEXT", "MTEXT", "LWPOLYLINE", "INSERT" or whatever it might be.

Link to comment
Share on other sites

Thanks for your reply. Pkenwell, I try your lisps, but I can't manage to select pline, or text?

When i make crossing window, with your lisps, it doesn't work!!

My purpose is when i select crossing window, i would like to select only pline or text or block...

Link to comment
Share on other sites

@thekiki I tested these and they work fine for me. Have you tried doing the Move command and P for previous after? These do not highlight the selection set.

Link to comment
Share on other sites

I don't know that method, but it's work! Do you know how to highlight the selection without typing Move command and P..

Many thanks again!

Link to comment
Share on other sites

@thekiki Try This version:

(defun c:Selpline (/ p1 p2 ss)
   (if (and
         (setq p1 (getpoint "\nSelect 1st corn of cossing window: "))
         (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: "))
         (setq ss (ssget "C" p1 p2 '((0 . "*POLYLINE"))))
      )
      (sssetfirst nil ss)
   )
   ss
)

(defun c:Seltext (/ p1 p2 ss)
   (if (and 
         (setq p1 (getpoint "\nSelect 1st corn of cossing window: "))
         (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: "))
         (setq ss (ssget "C" p1 p2 '((0 . "*TEXT"))))
      )
      (sssetfirst nil ss)
   )
   ss
)

(defun c:Selblock (/ p1 p2 ss)
   (if  (and
         (setq p1 (getpoint "\nSelect 1st corn of cossing window: "))
         (setq p2 (getcorner p1 "\nSelect 2nd point of crossing window: "))
         (setq ss (ssget "C" p1 p2 '((0 . "INSERT"))))
      )
      (sssetfirst nil ss)
   )
   ss
)

 

Edited by pkenewell
Edited to add some error prevention
  • Like 3
Link to comment
Share on other sites

2 minutes ago, thekiki said:

That's perfect!!

Thanks again.

@thekiki Your Welcome. I suggest you use these as examples to start learning how to do your own AutoLISP routines.

  • Like 2
Link to comment
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
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...