Jump to content

Recommended Posts

Posted

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

Posted
why not use (ssget) ?

 

how would i add a select prompt to ssget?

 

(ssget "_A" '((0 . "LINE")))

Posted

Try to change

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

 

Henrique

Posted
how would i add a select prompt to ssget?

 

(ssget "_A" '((0 . "LINE")))

 

 

(ssget) automatically prompts to 'Select objects: '

Posted

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

Posted

AFAIK only ssget with no args or X is giving a prompt....all the rest operating with no live interaction.

Posted
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"))))

Posted

(ssget) prompts if there are no automated options.

 

Automated options include "X" "CP" "WP"

Posted
how would i add a select prompt to ssget?

 

(ssget "_A" '((0 . "LINE")))

 

using ssget instead of entsel saves lots of code. thanx

Posted
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

  • 1 year later...
Posted (edited)

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

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