Jump to content

Recommended Posts

Posted

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

Posted
(initget "Setting")
(setq ent (entsel "\nSelect the entity type you want to isolate or [setting]: "))

Posted

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

Posted
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?

Posted
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

Posted
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

Posted
Thank you Henrique

You're welcome, samifox

glad i could help

Henrique

Posted
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

Posted

(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

Posted

You're welcome, Shay

 

 

Henrique

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