gS7 Posted June 3, 2012 Posted June 3, 2012 (defun c:test() (setq ss(ssget "x" (list (cons 0 "TEXT") (cons 1 "0.0,0.00,0.000,0.0000")))) [color="red"](if(= ss nil) (princ "\nNo Valid Objects Found !!") (exit) )[/color] (progn (initget "Y N") (setq user(getkword (strcat "\nFound :<"(rtos (sslength ss) 2 0)">: 0.0 Objects Do u want Erase Them? <Yes>/No:"))) (if(= user nil) (setq user "Y") ) (progn (if(= user "Y") (progn (command "ERASE" SS "") (princ(strcat "\n < "(rtos (sslength ss) 2 0)" > Objects Erase From Drawing")) ) (princ"\nNothing Erased From Drawing:") ) ) )(princ) ) Hi ! Guys .... Please Fix This Lisp function ....i m getting error ...when the objects not found in drawings ..(marked as red color) i want to report error to user .....when i run this file its showning No Valid Objects Found !! Error:bad argument type: lselsetp nil like this sorry for my week English Quote
pBe Posted June 3, 2012 Posted June 3, 2012 (defun c:test() (if (setq ss(ssget "x" (list (cons 0 "TEXT") (cons 1 "0.0,0.00,0.000,0.0000")))) (progn (initget "Y N") (setq user(getkword (strcat "\nFound :<"(rtos (sslength ss) 2 0)">: 0.0 Objects Do u want Erase Them? <Yes>/No:"))) (if(= user nil) (setq user "Y") ) (progn (if(= user "Y") (progn (command "ERASE" SS "") (princ(strcat "\n < "(rtos (sslength ss) 2 0)" > Objects Erase From Drawing")) ) (princ"\nNothing Erased From Drawing:") ) ) )(princ "\nNo Valid Objects Found !!") )(princ) ) Quote
Tharwat Posted June 3, 2012 Posted June 3, 2012 Try it now .... (defun c:test (/ ss user) (if (and (setq ss (ssget "_x" (list (cons 0 "TEXT") (cons 1 "0.0,0.00,0.000,0.0000")) ) ) (progn (initget "Y N") (setq user (getkword (strcat "\n Found :<" (rtos (sslength ss) 2 0) ">: 0.0 Objects Do u want Erase Them? <Yes>/No:" ) ) ) ) ) (progn (if (= user "Y") (progn (command "_.ERASE" ss "") (princ (strcat "\n < " (rtos (sslength ss) 2 0) " > Objects Erase From Drawing" ) ) ) (princ "\nNothing Erased From Drawing:") ) ) (princ "\nNo Valid Objects Found !!") ) (princ) ) Quote
gS7 Posted June 3, 2012 Author Posted June 3, 2012 oH!! now i got it where i have done mistake ........ tank u pBe ... Quote
Tharwat Posted June 3, 2012 Posted June 3, 2012 Ooops Pbe beat me to it . Tank u THARWAT .... You're welcome anytime . Quote
gS7 Posted June 3, 2012 Author Posted June 3, 2012 Dear Tharwat What is the deference between "ENTUPD" and "REDRAW" Quote
BlackBox Posted June 3, 2012 Posted June 3, 2012 What is the deference between "ENTUPD" and "REDRAW" Perhaps examining the ENTUPD, and REDRAW functions in the online Developer Documentation will help? Quote
gS7 Posted June 3, 2012 Author Posted June 3, 2012 Perhaps examining the ENTUPD, and REDRAW functions in the online Developer Documentation will help? Tank u so much renderman 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.