pryzmm Posted November 16, 2011 Posted November 16, 2011 hello, i need some help on how to check a selection set if it contain "wipeout" entity? if it does (draworder "back") and proceed to the next string of command. if not then just proceed likewise with some alert msg. please have a look at my simple routine ;this routine will let the user select multiple object ;& PASTEBLOCK the selection - 112011 ;- (defun c:pblk (/ bp opt selx) ;- (princ "Select basepoint: ") (setq bp (getpoint)) (setq opt "_b") ;- (setq selx (ssget)) ;- [color="blue"];check the selection set "selx" if there is any "WIPEOUT" entity selected ;if "wipeout" is/ are PRESENT (command:"_.draworder" "wipeout" opt) ;(alert "wipeout found -> sent to back") ;proceed to next ;if wipeout is/ are NOT found ;(alert "wipeout NOT found") ;proceed to next[/color] ;- (command "_.copybase" bp selx "") (command "_.pasteblock" bp) (command "_.erase" "previous" "") (princ) );end defun ;;; (the BLUE is where i hope i can put in the necessary codes) im using autocad 2009 thanks in advance Quote
Tharwat Posted November 16, 2011 Posted November 16, 2011 This ... ? (defun c:TesT (/ ss i sn) ;; Tharwat 16. Nov. 2011 ;; (if (setq ss (ssget '((0 . "WIPEOUT")))) (progn (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (command "_.draworder" sn "" "_b") ) (alert (strcat "wipeout found -> sent to back" "\t" "(" (itoa (sslength ss)) ")" ) ) ) (alert "wipeout NOT found") ) (princ) ) Quote
alanjt Posted November 16, 2011 Posted November 16, 2011 Is this what you're aiming for? Why are you placing the objects in an anonymously named block? (defun c:Test (/ ss pt ss2) (if (and (setq ss (ssget "_:L")) (setq pt (getpoint "\nSpecify basepoint: "))) (progn (if (setq ss2 (ssget "_P" '((0 . "WIPEOUT")))) (command "_.draworder" ss2 "" "_back") ) (command "_.copybase" "_non" pt ss "" "_.pasteblock" "_non" pt "_.erase" ss "") ) ) (princ) ) Quote
pryzmm Posted November 17, 2011 Author Posted November 17, 2011 @ tharwat -> my initial idea was similar to yours using (setq ss (ssget '((0 . "WIPEOUT")), but i do not know how to incorporate it into the rest of the _.pasteblock routine i posted above, your prompt is way cooler than mine .. thank you ... @alanjt -> yeah, i know its not a good practice not naming a block properly, but where im working right now don't really care much about it, speed is. as for the routine you made,,, this is what im looking for, thank you so very much, i didn't realize that ssget will still be the key, i was initially trying the car/ crd but i really could not figure it out (still a newbie in lisp). thank you both oh, alan pls. show me where i could place the prompt to inform user that a "wipeout" were found and it was taken care of, shown at the command line, right after the routine have finished its magic? Quote
alanjt Posted November 17, 2011 Posted November 17, 2011 yeah, i know its not a good practice not naming a block properly, but where im working right now don't really care much about it, speed is. wow................. 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.