Jump to content

lisp file to create command to chprop to a specified layer


NoelStalker

Recommended Posts

Hello everyone,

I tried to create a lisp file to change an object's layer to layer "0". I would like it to be "c0". I tried this and some variations of this but I can't get it to work. Please help to correct my code.

 

(defun c:c0()

(command "_chprop" pause "la " "0" " ")

)

Link to comment
Share on other sites

to change a selection set

(defun c:c0 ()
 (setq ss1 (ssget))
 (command "change" ss1 "" "p" "la" "0" "")
 )

to change one entity

(defun c:c0 ()
 (setq ent (entsel))
 (command "change" ent "" "p" "la" "0" "")
 )

Link to comment
Share on other sites

What does "vl-cmdf" do?

 

The same as command but it checks syntax before execution (command can to run with wrong syntax) and return T in case of seccessfull ending (command always return NIL). Do not recomended to use intractive functions (as ssget) inside command expression. It reason that I use vl-cmdf in this case.

 

How do I assign the code you gave me to the command "c0"?

 

(defun c:c0()
 (vl-cmdf "_.chprop" (ssget) "" "_la" "0" "")
)

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