Jump to content

repeat lsp routine... help


leonucadomi

Recommended Posts

(defun c:E (/)
 (setq old_err *error*)(defun *error* ( a / )(princ "") (setq *error* old_err)(princ))
  (repeat 1000 
(command "_erase" "\\" "")
);repeat
(princ)
  );fin defun

 

hello all:

I use this routine to delete continuously and use "repeat"

Is there any other way to make the routine repeat?

without using "repeat"

 

thanks for yours comments

 

 

Link to comment
Share on other sites

; have to press the space bar after each selection.
(defun c:E ( / ss )
  (while (= 1 1) (if (setq ss (ssget "_:L")) (command "_.erase" ss "")))
  (princ)
)

; Once selected, it will be deleted immediately.
; But this can't modify the selection set.
(defun c:EE ( / ss )
  (while (= 1 1) (if (setq ss (ssget "_:S:L")) (command "_.erase" ss "")))
  (princ)
)

 

 

I prefer to just press the Delete key on my keyboard.

Edited by exceed
  • Thanks 1
Link to comment
Share on other sites

For single entity selection only:

 

(defun c:test ( / MyEnt )
  (while (setq MyEnt (car (entsel "\nSelect entity to delete")))
    (command "erase" MyEnt "")
  ) ; end while
  (princ "OK")
  (princ)
)

 

For multiple entity selections:

 

(defun c:test ( / MyEnt )
  (princ "\nSelect entity to delete")
  (while (setq MyEnt (ssget))
    (command "erase" MyEnt "")
  ) ; end while
  (princ "OK")
  (princ)
)

 

I also prefer to just press the Delete key on my keyboard.

Edited by Steven P
  • Like 2
  • Thanks 1
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...