Jump to content

Need help on Checking a selection set


pryzmm

Recommended Posts

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 :oops:

 

;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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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