EYNLLIB Posted September 15, 2023 Share Posted September 15, 2023 (defun c:DC ( / curlay) (setq curlay (getvar "CLAYER")) (command "_.layer" "_set" "S - DETAIL CUT" "" "_.insert" "Detail Cut" "_scale" 36 "_.layer" "_set" curlay "" ) ) After the block is inserted on the proper layer per the code, the layer is not being reset properly to the previous current layer. Any help would be appreciated, I'm still learning lisp Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 16, 2023 Share Posted September 16, 2023 Give this a try: (defun c:DC ( / curlay) (setq curlay (getvar "CLAYER")) (setvar "clayer" "S - DETAIL CUT") (vl-cmdf "._insert" "Detail Cut" "_s" 36.0 "_r" 0) (setvar "clayer" curlay) (princ) ) 2 Quote Link to comment Share on other sites More sharing options...
EYNLLIB Posted September 20, 2023 Author Share Posted September 20, 2023 On 9/16/2023 at 12:40 PM, rkmcswain said: Give this a try: (defun c:DC ( / curlay) (setq curlay (getvar "CLAYER")) (setvar "clayer" "S - DETAIL CUT") (vl-cmdf "._insert" "Detail Cut" "_s" 36.0 "_r" 0) (setvar "clayer" curlay) (princ) ) I tried your solution but the layer is not reset to curlay properly. I managed to find in a fix for my code by adding a pause after the rotate. see below; (defun c:DC ( / curlay) (setvar 'cmdecho 0) (setq curlay (getvar "CLAYER")) (command "_.layer" "_set" "S - DETAIL CUT" "" "_.insert" "Detail Cut" "_scale" 36 "_rotate" 0 pause "_.layer" "_set" curlay "" ) (setvar 'cmdecho 1) (Princ) ) 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.