Jump to content

wildcard use in entsel filter


samifox

Recommended Posts

hi

 

trying to say

"select only line and all kind of polyline"

 

get wrong result

 

(defun c:demo (/ ent flag sel)
 (setq flag t)
 (while flag
   (if (setq ent(car(entsel "Select object")))
     (progn
       	(setq ent (entget ent))
     		(setq flag nil)

	(if (or (= (cdr(assoc 0 ent)) "LINE" )(= (cdr(assoc 0 ent)) "*POLYLINE"))
	  (alert "a supported entity were selected")
	  (alert "a unsupported entity were selected")
	)
	  
         )
)
     
   
)
 (princ)
 )

Link to comment
Share on other sites

Try to change

(or (= (cdr(assoc 0 ent)) "LINE" )(= (cdr(assoc 0 ent)) "*POLYLINE"))
;to
(wcmatch (cdr (assoc 0 ent)) "LINE,*POLYLINE")

 

Henrique

Link to comment
Share on other sites

Does it?. How would you do the same with ssget?

If you just want the user to select one object and act like the entsel then it would be like this:

(setq ss (ssget "_+.:E:S" '((0 . "LINE,POLYLINE,LWPOLYLINE"))))

If you want the user to be able to select multiple objects then:

(setq ss (ssget '((0 . "LINE,POLYLINE,LWPOLYLINE"))))

Link to comment
Share on other sites

If you just want the user to select one object and act like the entsel then it would be like this:
(setq ss (ssget "_+.:E:S" '((0 . "LINE,POLYLINE,LWPOLYLINE"))))

If you want the user to be able to select multiple objects then:

(setq ss (ssget '((0 . "LINE,POLYLINE,LWPOLYLINE"))))

 

very usefull. thanx

Link to comment
Share on other sites

  • 1 year later...

You can do this with this:

 

;; by user gile here:
;; https://www.theswamp.org/index.php?PHPSESSID=amuofcfnqe6mf8r4g8n5j4t4h4&topic=34004.msg393324#msg393324
(defun fentsel (msg fltr / ent)
   (if
       (and
           (setq ent (if (and (= (type msg) 'STR) (/= msg ""))
               (entsel msg)
               (entsel)
               )
           )
           (wcmatch (cdr (assoc 0 (entget (car ent)))) (strcase fltr))
           )
       ent
       )
   )
 

Then:

(car (fentsel (strcat"\nSelect your Text :\n") "TEXT,MTEXT"))
 
Or to prevent the pick from any miss hits by the user (This keeps asking for the object until it's picked) :
  (while (not (setq
    ent (car (fentsel (strcat"\nSelect Polyline to offset :\n") "*POLYLINE,LINE"))
    )))

 

Edited by 3dwannab
additional miss hit code
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...