jim78b Posted May 24, 2019 Posted May 24, 2019 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" "") ) Quote
dlanorh Posted May 24, 2019 Posted May 24, 2019 (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 May 24, 2019 by dlanorh 1 Quote
jim78b Posted May 24, 2019 Author Posted May 24, 2019 give me: error: bad character read (octal): 0 Quote
dlanorh Posted May 24, 2019 Posted May 24, 2019 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) ) Quote
jim78b Posted May 24, 2019 Author Posted May 24, 2019 (edited) Thanks very Much Edited May 24, 2019 by jim78b Quote
Recommended Posts
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.