Jump to content

Recommended Posts

Posted (edited)

Hello all,

 

I'm a noob at lisp, hence the very basic code, I'm having issues with the select all part of my code.  It selects all and pauses there and hitting enter cancels the select all not allowing me to do the final part of the code.  Any help would be greatly appreciated.  

(defun c:MCU ()
  (command "LAYON")
  (command "LAYTHW")
 (command "-PURGE" "ALL" "*" "N")

(setq ss (ssget "_ALL"))
  (command "-setbylayer" "y" "y")
  (princ)                    
)

 

Edited by SLW210
Added Code Tags!!
Posted (edited)

@Wootney You need to plug the selection set into the "-setlayer" command with a return following it. I also localized your "ss" variable, and added the "._" on the command names to allow language localization and prevent any redefined commands from mucking things up. See update below:

 

(defun c:MCU (/ ss) ; localize the variable "ss"
  (command "._LAYON")
  (command "._LAYTHW")
  (command "._-PURGE" "ALL" "*" "N")

  (setq ss (ssget "_ALL"))
  (command "._-setbylayer" ss "" "y" "y");; added "ss" into command with a "" for the return.
  (princ)                    
)

 

EDIT alternatively, you don't even need the call to ssget:

(defun c:MCU ()
  (command "._LAYON")
  (command "._LAYTHW")
  (command "._-PURGE" "_ALL" "*" "_N")

  (command "._-setbylayer" "_all" "" "_y" "_y")
  (princ)                    
)

 

Edited by pkenewell
  • Like 1
Posted

Thanks for your help!

 

And sorry next time I'll post in the correct spot!

  • Like 1

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