Jump to content

Repeat Lisp Like Vanilla Command


JWhelp

Recommended Posts

Hi fantastic lisp people, 

 

I have a (probably very basic) lisp question. 

I'm making a basic command to augmenting existing AutoCAD command. I would like this command to act like a vanilla command, ie. repeat on <enter> or <space>.

Is this doable? I'm fine if the answer is 'no', or 'no but you can use a "while" loop or the "repeat" command'. 

 

F.Y.I - Here's my humble lisp: 

 

(defun c:ROT1 ()
(setq selection1 (ssget))
(command "rotate" selection1 "" pause "r" "@" pause pause)

)

 

Link to comment
Share on other sites

To run this command you have typed "ROT1" on the command line. If you press enter or spacebar immediately after the command is finished it will repeat. You can access your command history by pressing the up arrow which will step through the command history in reverse order, or just type "ROT1" again

Link to comment
Share on other sites

Hi Dlanorh

 

It would be great if it were that simple. I wrote the command and can run it fine and all that jazz. 

My question was a bit more specific. If you press the enter key it does not repeat the command. It runs the select command - which must be the last command hidden within the 'magic' of the default rotate command? (If it does run again on your machine,  could it be possible I have different system variable setting which make the effects different?)

Link to comment
Share on other sites

2 hours ago, JWhelp said:

Hi Dlanorh

 

It would be great if it were that simple. I wrote the command and can run it fine and all that jazz. 

My question was a bit more specific. If you press the enter key it does not repeat the command. It runs the select command - which must be the last command hidden within the 'magic' of the default rotate command? (If it does run again on your machine,  could it be possible I have different system variable setting which make the effects different?)

 

Run the command on your sysytem and press the up arrow to cycle backwards through the command list. Is "ROT1" there?

Link to comment
Share on other sites

Yep, "ROT1" is there in the previous commands list. 

 

The command works but i can't get it to repeat with  "space" or "enter".

 

Maybe this is a system variable thing then? You both don't have a problem with it. 

 

Here's my screen shot showing the command line until the command fails on attempting to run it again.

 

Does this shed light on anything?  

Screen_ROT1.JPG

Link to comment
Share on other sites

20 hours ago, JWhelp said:

If you press the enter key it does not repeat the command. It runs the select command

 

Sorry, but i missed this bit. If Its asking you to select again then the lisp IS repeating. Or do you mean you automatically want to select the last object again?

Link to comment
Share on other sites

33 minutes ago, dlanorh said:

 

 If Its asking you to select again then the lisp IS repeating. Or do you mean you automatically want to select the last object again?

 

No. The (ssget) in the lisp which prompts the user to "Select objects:" is not the same as the SELECT command. Check the image in post 6.

Link to comment
Share on other sites

Try running the native built-in ROTATE command. Does it fail to repeat with the space bar or <enter> also?

 

Here is someone with a similar problem, he is running the ROTATE command (which is what you lisp is doing), and then the space bar or <enter> executes the SELECT command.

It looks like an add-on is causing the issue

 

 

  • Thanks 2
Link to comment
Share on other sites

4 hours ago, rkmcswain said:

 

No. The (ssget) in the lisp which prompts the user to "Select objects:" is not the same as the SELECT command. Check the image in post 6. 

 

I cannot see any image in post 6. Something is filtering out *.jpg in my browser. I can see the *.png and *.gif but not *.jpg. :cry:

Link to comment
Share on other sites

Sorry about that! I should remeber to copy from the comand line too, in case someone has a similar problem with viewing jpegs in the future.

The image shows that after my script runs, when I press <enter> the SELECT comand runs (Not the ROT1 as expected)

My problem was caused by a third party plugin called ' DiLeader ' - which I have now uninstalled. It was supposed to create dynamic leaders with text populated automatically based on what object you were pointing at. 

It was a bit glitchy and also caused this problem - commands not repeat properly! 

All good now tho! 🙂

 

 

Edited by JWhelp
Link to comment
Share on other sites

1 hour ago, JWhelp said:

Sorry about that! I should remeber to copy from the comand line too, in case someone has a similar problem with viewing jpegs in the future.

The image shows that after my script runs, when I press <enter> the SELECT comand runs (Not the ROT1 as expected)

My problem was caused by a third party plugin called ' DiLeader ' - which I have now uninstalled. It was supposed to create dynamic leaders with text populated automatically based on what object you were pointing at. 

It was a bit glitchy and also caused this problem - commands not repeat properly! 

All good now tho! 🙂

 

 

Thanks for the update. My problem has been solved by a browser update. It found a corrupt file.

Link to comment
Share on other sites

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