hardwired Posted January 5, 2011 Share Posted January 5, 2011 Hi All, I want a quick LISP command to change the current layer to 0 but not just do that, i want to be able to select objects first to change, so it changes all selected objects and the drawing's current layer to 0. I've tried this code out but it won't work (not the changing slected objects bit anyway)....any ideas on what i'm doing wrong or a better solution to my code? ; SET OBJECTS AND CURRENT LAYER TO 0.. (defun C:00 () (setq a (cadr (ssgetfirst))) (if a (command "-LAYER" "S" " " a "S" "0" "")) (princ) ) Thanks, Quote Link to comment Share on other sites More sharing options...
pBe Posted January 5, 2011 Share Posted January 5, 2011 (edited) oops.. wrong thread anyhoo... Edit: I was called away when i was about to reply to another thread but somebody mess with my station.. serves me right not locking my desktop Edited January 5, 2011 by pBe Quote Link to comment Share on other sites More sharing options...
David Bethel Posted January 5, 2011 Share Posted January 5, 2011 maybe: [b][color=BLACK]([/color][/b]defun c:oo [b][color=FUCHSIA]([/color][/b]/ ss[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not ss[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect Entites To Change To Layer 0"[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_UNlock"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_Thaw"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_ON"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_Set"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]""[/color] [color=#2f4f4f]"_.CHPROP"[/color] ss [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LA"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] I wouldn't recommend using numeric characters ( if that is what they are ) as the leading character or all characters in a function name. I couldn't tell if they were zeros or the letter O. -David Quote Link to comment Share on other sites More sharing options...
irneb Posted January 5, 2011 Share Posted January 5, 2011 Or if you want to use the pre-selection: (defun C:00 (/ a) (if (setq a (cadr (ssgetfirst))) (command "_.change" a "" "_Properties" "_LAyer" "0" "") ) (command "_.LAYER" "_Set" "0" "") (princ) ) Quote Link to comment Share on other sites More sharing options...
VVA Posted January 5, 2011 Share Posted January 5, 2011 #3 + #4 = #5 (defun C:00 ( / ss) (if (or (setq ss (cadr (ssgetfirst))) (and (princ "\nSelect Entites To Change To Layer 0") (setq ss (ssget "_:L")) ) ) (command "_.LAYER" "_UNlock" "0" "_Thaw" "0" "_ON" "0" "_Set" "0" "" "_.CHPROP" ss "" "_LA" "0" "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
TJKawaguchi Posted September 19, 2013 Share Posted September 19, 2013 Thanks so much for this! Sometimes the littlest things just drive me mad and eat my time. Thanks for this. 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.