View Full Version : Next Step...
BoKirra
2009-03-26, 12:38 AM
Hi ALL,
I found that in some cases the second command doesn't execute after the first one finished.
Here is a sample:
(defun c:LineOnFace ()
(progn
(command "_.ucs" "f")
(command "pline" pause pause)
); end of progn
(princ)
); end of LineOnFace
with thanks in advance.
lpseifert
2009-03-26, 01:11 AM
untested
(defun c:LineOnFace ()
(progn
(command "_.ucs" "f")
(while (> (getvar 'CmdActive) 0) (command pause))
(command "pline" pause pause)
); end of progn
(princ)
); end of LineOnFace
BoKirra
2009-03-26, 01:30 AM
untested
(defun c:LineOnFace ()
(progn
(command "_.ucs" "f")
(while (> (getvar 'CmdActive) 0) (command pause))
(command "pline" pause pause)
); end of progn
(princ)
); end of LineOnFace
Yes, it works.
Thank you very much.
But, why for some other commands they work perfectly without any problem?
For example:
(defun c:LineAndCircle ()
(progn
(command "circle" pause pause)
(command "pline" pause pause)
); end of progn
(princ)
); end of LineAndCircle
lpseifert
2009-03-26, 02:43 AM
Because you added your own pauses.
If you wanted to draw the pline with more than two endpoints [pause pause] you could do this...
(defun c:LineAndCircle ()
(progn
(command "circle" pause pause)
(command "pline")
(while (> (getvar 'CmdActive) 0) (command pause))
); end of progn
(princ)
); end of LineAndCircle
BoKirra
2009-03-26, 03:16 AM
Because you added your own pauses.
If you wanted to draw the pline with more than two endpoints [pause pause] you could do this...
(defun c:LineAndCircle ()
(progn
(command "circle" pause pause)
(command "pline")
(while (> (getvar 'CmdActive) 0) (command pause))
); end of progn
(princ)
); end of LineAndCircle
Thanks again.
Can you please explain the following:
1) with my previous code of LineAndCircle, I can draw one single piece of pline with more than two endpoints.
2) Looking back to the LineOnFace, it would make no difference if I added a pause to the first command:
(defun c:LineOnFace ()
(progn
(command "_.ucs" "f" pause)
(command "pline" pause pause)
); end of progn
(princ)
); end of LineOnFace
lpseifert
2009-03-26, 01:46 PM
There's more than one way to skin a cat and thats the way I learned to skin em.
BoKirra
2009-03-27, 12:05 AM
There's more than one way to skin a cat and thats the way I learned to skin em.
I did a search in HELP, but found no assistance for "pause" & "cmdactive" is a read-only variable.
How does the following piece work with your code?
Sorry, I keep asking questions - I really want to learn "WHILE" I'm not so busy at work these days.
(while (> (getvar 'CmdActive) 0)
(command pause)
); end of while
Thanks again.
lpseifert
2009-03-27, 02:40 AM
While the system variable "Cmdactive" is greater than 0 meaning there's a command active stop reading the rest of the code until the command is completed.
from Help
Evaluates a test expression, and if it is not nil, evaluates other expressions; repeats this process until the test expression evaluates to nil
BoKirra
2009-03-29, 11:25 PM
While the system variable "Cmdactive" is greater than 0 meaning there's a command active stop reading the rest of the code until the command is completed.
from Help
Thanks for your explanation.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.