Need some help with CLAYER not being restored

Need some help with CLAYER not being restored

king
Enthusiast Enthusiast
238 Views
2 Replies
Message 1 of 3

Need some help with CLAYER not being restored

king
Enthusiast
Enthusiast
 

 

(defun c:DC ( / curlay)
  (setq curlay (getvar "CLAYER"))
  (command
    "_.layer" "_set" "S - DETAIL CUT" ""
    "_.insert" "Detail Cut" "_scale" 36
    "_.layer" "_set" curlay ""
    )
(Princ)
)

 

 

 

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

0 Likes
Accepted solutions (1)
239 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

You haven't completed the Insert command, within the routine and before the Layer resetting.  It can't go into the second Layer command when the Insert command is still running.

 

One way would be to add some pauses for insertion point and rotation, inside the routine, instead of letting the routine end and leave you to those inputs:

"_.insert" "Detail Cut" "_scale" 36 pause pause

 

Kent Cooper, AIA
0 Likes
Message 3 of 3

king
Enthusiast
Enthusiast

Adding Pauses for my inputs worked, thanks for the clarification. 

0 Likes