KRBeckman Posted March 2, 2010 Posted March 2, 2010 I'm writing a lisp that will use an arc as a reference for an angular dimension, and I would like to use the arc command, however by using this command there could be issues with the number to user inputs... is there a way to get a lisp to "pause" until the current command successfully complete? Quote
M76 Posted March 2, 2010 Posted March 2, 2010 Yes, its called pause If you enter pause as an argument for the command in this case the arc command, autocad will wait for user input. Quote
KRBeckman Posted March 2, 2010 Author Posted March 2, 2010 I understand that... but that only pauses for one user input... the arc command can have anywhere between 3 and 5 user inputs, so I can't just do: (command "_.arc" pause pause pause) because if the user decides to specify the center by hitting "c" before selecting the first point, now there are 4 user inputs and the arc command won't finish. Quote
lpseifert Posted March 2, 2010 Posted March 2, 2010 Maybe this... (while (= 1 (getvar "cmdactive")) (command pause)) or this ...essentially the same thing (while (> (getvar 'CmdActive) 0) (command pause)) enter after the command call Quote
alanjt Posted March 2, 2010 Posted March 2, 2010 You could write it as a subroutine that emulates the syntax. The just fill the variables with the property command calls. Would be a lot cleaner and you would have blank prompts (result of using PAUSE). Quote
KRBeckman Posted March 2, 2010 Author Posted March 2, 2010 Maybe this... (while (= 1 (getvar "cmdactive")) (command pause)) or this ...essentially the same thing (while (> (getvar 'CmdActive) 0) (command pause)) enter after the command call This worked great, thanks a ton Quote
Lee Mac Posted March 2, 2010 Posted March 2, 2010 Maybe this... (while (= 1 (getvar "cmdactive")) (command pause)) or this ...essentially the same thing (while (> (getvar 'CmdActive) 0) (command pause)) enter after the command call Another just for fun: (while (= 1 (logand 1 (getvar 'CMDACTIVE))) (command pause)) Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 I'm trying to do this for an mpedit macro: (command "_.mpedit" "pause" "yes" "join" "0,5" "close" "")(while (> (getvar "CMDACTIVE") 0) (command pause)) But it worked once (no idea why it worked then :S ). I think it isn't working because the cmd active makes a loop and I need to select the lines in one turn. How can I do this? Quote
lpseifert Posted May 10, 2010 Posted May 10, 2010 I didn't test it but it doesn't appear as if you need the (while (> (getvar "CMDACTIVE... it looks as if you are completing the mpedit command with the "" Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 hmm with (command "_.mpedit" "pause" "yes" "join" "0,5" "close")(while (> (getvar 'CmdActive) 0) (command pause)) I can select everything but I get: 0 lines joined to source, 11 objects discarded from operation If I run true the cmds manually it works well. But can some one explain how it is possible that I can select them all? Because if it loops wouldn't it be a rerun of the command over and over again? I'm confused. Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 Are the lines collinear? There on the z-plane (z=0) just random lines. Quote
lpseifert Posted May 10, 2010 Posted May 10, 2010 here's one I've used for quite awhile. edit it for your needs if you want (defun c:pj () (setq pa (getvar "peditaccept")) (setvar "peditaccept" 1) (setq ssj (ssget )) (command "pedit" "m" ssj "" "j" "0.01" "") (setvar "peditaccept" pa) (princ) ) it won't join if the endpoints aren't close enough Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 here's one I've used for quite awhile. edit it for your needs if you want (defun c:pj () (setq pa (getvar "peditaccept")) (setvar "peditaccept" 1) (setq ssj (ssget )) (command "pedit" "m" ssj "" "j" "0.01" "") (setvar "peditaccept" pa) (princ) ) it won't join if the endpoints aren't close enough modified it for me too: (defun c:pj () (setq pa (getvar "peditaccept")) (setvar "peditaccept" 1) (setq ssj (ssget )) (acet-overkill2(list ssj 0.000002 nil nil nil nil)) (command "pedit" "m" ssj "" "j" "0.5" "c" "") (setvar "peditaccept" pa) (princ) ) Added overkill command since it happens sometimes that there double lines. Further added the c for close to pedit. (defun c:pj () (setq pa (getvar "peditaccept")) ?? (setvar "peditaccept" 1) ;; set variable to 1 (setq ssj (ssget )) ;;selection set (setvar "peditaccept" pa) ?? (princ) ) Could you please explain me what exactly have you done, or point me to a good tutorial. I already checked afralisp but damn that stuff is hard. I have coded in action script 2.0 and that is peanuts compared to this stuff Quote
alanjt Posted May 10, 2010 Posted May 10, 2010 Suppresses display of the Object Selected Is Not a Polyline prompt in PEDIT. The prompt is followed by "Do you want it to turn into one?" Entering y converts the selected object to a polyline. When the prompt is suppressed, the selected object is automatically converted to a polyline. 0 The prompt is displayed 1 The prompt is suppressed Quote
lpseifert Posted May 10, 2010 Posted May 10, 2010 (defun c:pj () (setq pa (getvar "peditaccept"));gets and stores the system variable Peditaccept (setvar "peditaccept" 1);sets the system variable to 1 (setq ssj (ssget ));make a selection set (command "pedit" "m" ssj "" "j" "0.01" "");runs the Pedit command on the selection set (setvar "peditaccept" pa);restores original value of the system variable (princ);clean exit ) Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 (defun c:pj () (setq pa (getvar "peditaccept"));gets and stores the system variable Peditaccept (setvar "peditaccept" 1);sets the system variable to 1 (setq ssj (ssget ));make a selection set (command "pedit" "m" ssj "" "j" "0.01" "");runs the Pedit command on the selection set (setvar "peditaccept" pa);restores original value of the system variable (princ);clean exit ) thanks! But what exactly does the system variable do? Quote
lpseifert Posted May 10, 2010 Posted May 10, 2010 thanks!But what exactly does the system variable do? see alanjt's post #15, or see Help Quote
CADkitt Posted May 10, 2010 Posted May 10, 2010 Ah I got it, it disables that prompt window! Nice, thanks for your help guys! Quote
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.