AutoLisp-Need help on Transparent commands

I need help on a little AutoLisp routine that I am writing I want to : 1) Save the users layer in a variable called SAVELAYER
2) Change the layer to a layer called "GREEN" 2) Call up the Doughnut command 3) Then, after the user is finishd with the doughnut command, reset the layer to the layer called SAVELAYER
Here is my code:
(defun C:insertdot ( / SAVELAYER ) (setq SAVELAYER (getvar "CLAYER" ) ) (command ".layer" "S" "GREEN" "" ) (command ".donut" 0 0.75 ) (command ".layer" "S" SAVELAYER "" ) ) ; end defun inserdot
The problem is that when the doughnut command is called up, my program does not wait for the doughnut command to run untill the user hits the escape key. The program tries to run on through to the (command ".layer" "S" SAVELAYER ) line and I get an error.
Anybody know how to get my program to wait until the doughnut command runs before the rest of the code runs?
Thanks Jarv (I also have this problem in a routine I tried to write where I call up the "adcenter" function )
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The fact that the donut command needs a break to end is troublesome in this routine. I'm not sure how to stop it without stopping the whole routine. Adding a pause at the end of the donut call will only work once and then the routine will fail when you feed it a command call when it's looking for a point. Have you thought about using ENTMAKE to make the donuts instead of using a command call? Then you could form a loop, and each time the user picks a point, you make a donut centered there.
--


MichaelB
www.michaelbulatovich.com
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
(defun c:dnut(/ oldlayer) (setq oldlayer (getvar "clayer") oldecho (getvar "cmdecho")) (setvar "clayer" "0") (setvar "cmdecho" 1) (command "donut" "" "") (while (> (getvar "cmdactive") 0) (command pause) ) (setvar "clayer" oldlayer) (setvar "cmdecho" oldecho) (princ) )
HTH, Jeff

does
the
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I didn't know you could issue pause without quotes to the command call. Very cool. Is there anything else that will pass the command call I should know about?
Here it is in context:
(defun C:insertdot ( / SAVELAYER ) (setq SAVELAYER (getvar "CLAYER" ) ) (command ".layer" "S" "GREEN" "" ) (command ".donut" 0 0.75 ) (while (> (getvar "cmdactive") 0) (command pause) ) (command ".layer" "S" SAVELAYER "" ) )

the
runs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.