Jump to content

Help with while loop or repeat the command until hit escape


Recommended Posts

Posted
(Defun c:ld (/ ent sset cnt )
  (setq sset (ssget))
  (setq cnt 0)
  (repeat (sslength sset)
  (command "_MAPCreateFeatureFromGeometry" "yes" "landuse" "")))

Hi Guys, sorry this might be so simple but i cant get it to work, basically i need to loop or repeat the command until i hit escape.

 

Thanks for your help.

Posted

You need a test after the geometry line you can crash out using a (exit) but this is not ideal better way is to use a (setq x (sslength sset)) so if want exit set x actual sslength+1 of sset and use a While to test. (while (< x Y) etc

 

Posted

hi bigal can you give an example i cannot get it to work thanks

Posted (edited)

Don't know what that command does but this is a simple while loop:

(while (setq s (ssget))
  (sssetfirst nil s)
  (command "_MAPCreateFeatureFromGeometry" "yes" "landuse" "")
)

 

Edited by ronjonp

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