samifox Posted April 6, 2014 Posted April 6, 2014 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 Quote
Lee Mac Posted April 6, 2014 Posted April 6, 2014 (initget "Setting") (setq ent (entsel "\nSelect the entity type you want to isolate or [setting]: ")) Quote
samifox Posted April 6, 2014 Author Posted April 6, 2014 I don't understand . Ent holding the entity what holds the kword? Quote
Lee Mac Posted April 6, 2014 Posted April 6, 2014 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? Quote
hmsilva Posted April 6, 2014 Posted April 6, 2014 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 Quote
samifox Posted April 6, 2014 Author Posted April 6, 2014 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 Quote
hmsilva Posted April 6, 2014 Posted April 6, 2014 Thank you Henrique You're welcome, samifox glad i could help Henrique Quote
samifox Posted April 11, 2014 Author Posted April 11, 2014 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 Quote
hmsilva Posted April 11, 2014 Posted April 11, 2014 (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 Quote
Recommended Posts
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.