Jump to content

retrieve a keyword out of entsel


samifox

Recommended Posts

hi

 

i need to retrieve a keyword out of entsel,

when i type the keyword i get error that say a point were expected

 

how to do it right?

 

 

(setq ent (car (entsel "\n Select the entity type you want to isolate or [setting] \n")))

 

Thanks

Shay

Link to comment
Share on other sites

I don't understand . Ent holding the entity what holds the kword?

 

Did you try it?

Did you see what the expression returns for each user input?

Link to comment
Share on other sites

I don't understand . Ent holding the entity what holds the kword?

Perhaps this demo helps you to understand a little more

(defun c:demo (/ ans flag)
 (setq flag t)
 (while flag
   (initget "Setting")
   (setq ans (entsel "\nSelect the entity type you want to isolate or or [setting] <exit>:"))
   (cond ((= 'list (type ans))
   (alert "\nYou've selected an object!!!")
  )
  ((= "Setting" ans)
   (alert "\nYou've chosen Setting!!!")
  )
  ((not ans)
   (setq flag nil)
   (alert "\nYou've Missed the Entity, or pressed Enter or the Spacebar to exit!!!")
  )
   );; cond
 );; while
 (princ)
)

 

HTH

Henrique

Link to comment
Share on other sites

Perhaps this demo helps you to understand a little more

(defun c:demo (/ ans flag)
 (setq flag t)
 (while flag
   (initget "Setting")
   (setq ans (entsel "\nSelect the entity type you want to isolate or or [setting] <exit>:"))
   (cond ((= 'list (type ans))
   (alert "\nYou've selected an object!!!")
  )
  ((= "Setting" ans)
   (alert "\nYou've chosen Setting!!!")
  )
  ((not ans)
   (setq flag nil)
   (alert "\nYou've Missed the Entity, or pressed Enter or the Spacebar to exit!!!")
  )
   );; cond
 );; while
 (princ)
)

 

HTH

Henrique

Thank you Henrique

Brilient explanation!

 

Did you try it?

Did you see what the expression returns for each user input?

 

sorry LEE i didnt have Autocad at time of replying

now i test , unsrestand

Link to comment
Share on other sites

Perhaps this demo helps you to understand a little more

(defun c:demo (/ ans flag)
 (setq flag t)
 (while flag
   (initget "Setting")
   (setq ans (entsel "\nSelect the entity type you want to isolate or or [setting] <exit>:"))
   (cond ((= 'list (type ans))
   (alert "\nYou've selected an object!!!")
  )
  ((= "Setting" ans)
   (alert "\nYou've chosen Setting!!!")
  )
  ((not ans)
   (setq flag nil)
   (alert "\nYou've Missed the Entity, or pressed Enter or the Spacebar to exit!!!")
  )
   );; cond
 );; while
 (princ)
)

 

HTH

Henrique

 

how can i repeat the entsel function until the user actually select the entity?

 

i was thinking about this way :

(if (while (not (setq ans (entsel "\nSelect the entity type you want to isolate or or [setting] <exit>:"))))
   (princ "i dont know how but user misses the entity")
   (princ "yes, the user selected an object")
   )

 

but it doesn't feel right!

 

Thanks

Shay

Link to comment
Share on other sites

(defun c:demo (/ ans flag)
 (setq flag t)
 (while flag
   (initget 1 "Setting eXit")
   (setq ans (entsel "\nSelect the entity type you want to isolate or or [setting/eXit]:"))
   (cond ((= 'list (type ans))
   (princ "\nYes, the user selected an object!!!")
   (setq flag nil)
  )
  ((and ans (wcmatch ans "Setting"))
   (princ "\nYou've chosen Setting!!!")
   (setq flag nil)
  )
  ((and ans (wcmatch ans "eXit"))
   (princ "\nYou've chosen to eXit!!!")
   (setq flag nil)
  )
  ((not ans)
   (princ "\nI dont know how but user misses the entity...")
  )
   );; cond
 );; while
 (princ)
)

 

HTH

Henrique

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