Jump to content

Recommended Posts

Posted

i want write a lisp that move the entity that i select to layer 0 and color :byblock why my routine don't work?

 

; Changes selected objects to Layer 0
(defun c:L0 ()
(command "_.chprop" (ssget )"" "LA" "0" "C" "BYBLOCK" "")
)

 

Posted (edited)

It does work, but not as you intended.

 

If you only want to pick a single item use either :

(defun c:L0 ()
(command "_.chprop" (ssget ":S:E:L") "" "LA" "0" "C" "BYBLOCK" "")
)

or

 

(defun c:L0 ()
(command "_.chprop" (car (entsel)) "" "LA" "0" "C" "BYBLOCK" "")
)

 

If you want to select multiple items then you'll probably need to split the (ssget) outside the command (easiest solution) as it requires an enter to end the selection process. Sometimes you can't cut corners

 

(defun c:L0 ( / ss)
(setq ss (ssget))
(command "_.chprop" ss "" "LA" "0" "C" "BYBLOCK" "")
)

 

Edited by dlanorh
  • Like 1
Posted

give me:

 

error: bad character read (octal): 0

Posted

SORRY WORK THANKS A LOT!!!!!

Posted

why at the end i have :nil?

Posted
17 minutes ago, jim78b said:

why at the end i have :nil?

 

It is the return from the command call (no error)

 

If you don't want to see it put a (princ) in

 

(defun c:L0 ( / ss)
(setq ss (ssget))
(command "_.chprop" ss "" "LA" "0" "C" "BYBLOCK" "")
(princ)
)

 

Posted (edited)

Thanks very Much 

Edited by jim78b

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