jim78b Posted May 24, 2019 Share 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 Link to comment Share on other sites More sharing options...
dlanorh Posted May 24, 2019 Share 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 Link to comment Share on other sites More sharing options...
jim78b Posted May 24, 2019 Author Share Posted May 24, 2019 give me: error: bad character read (octal): 0 Quote Link to comment Share on other sites More sharing options...
jim78b Posted May 24, 2019 Author Share Posted May 24, 2019 SORRY WORK THANKS A LOT!!!!! Quote Link to comment Share on other sites More sharing options...
jim78b Posted May 24, 2019 Author Share Posted May 24, 2019 why at the end i have :nil? Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 24, 2019 Share 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 Link to comment Share on other sites More sharing options...
jim78b Posted May 24, 2019 Author Share Posted May 24, 2019 (edited) Thanks very Much Edited May 24, 2019 by jim78b Quote Link to comment Share on other sites More sharing options...
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.