Jump to content

Recommended Posts

Posted

(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

:cry:

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

Posted

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


Posted

oH!! now i got it where i have done mistake ........

 

tank u pBe ...

Posted

Ooops Pbe beat me to it . :shock:

 

Tank u THARWAT ....

 

You're welcome anytime .

Posted

Dear Tharwat

 

What is the deference between "ENTUPD" and "REDRAW"

Posted
What is the deference between "ENTUPD" and "REDRAW"

 

Perhaps examining the ENTUPD, and REDRAW functions in the online Developer Documentation will help? :thumbsup:

Posted
Perhaps examining the ENTUPD, and REDRAW functions in the online Developer Documentation will help? :thumbsup:

 

 

Tank u so much renderman

Posted
Tank u so much renderman

 

Happy to help :beer:

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