Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Posted

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

Posted

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).

Posted
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

Posted
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: :P

 

(while (= 1 (logand 1 (getvar 'CMDACTIVE)))
 (command pause))

  • 2 months later...
Posted

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?

Posted

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 ""

Posted

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.

Posted
Are the lines collinear?

 

There on the z-plane (z=0) just random lines.

Posted

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

Posted
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 :o

Posted
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

Posted
(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
)

Posted
(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?

Posted
thanks!

But what exactly does the system variable do?

see alanjt's post #15, or see Help

Posted

Ah I got it, it disables that prompt window!

Nice, thanks for your help guys!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...