Jump to content
cwize

Simple LISP routine to invoke "copy" command not operating properly

Recommended Posts

cwize

I have a .lsp file that mostly creates keyboard shortcuts for basic commands. My copy mode is set to default to "multiple" - and if I type "copy", it is indeed multiple. However, if I use my shortcut (just the "c" key), it is not. Here's the code:

(defun c:c() (command "copy"))

I don't think it gets much simpler than that... why would it not operate the same way as "copy"? Confused.

Share this post


Link to post
Share on other sites
cwize

I forgot to mention, I'm using AutoCad 2010.

Share this post


Link to post
Share on other sites
Lee Mac

You can use the initcommandversion function to force the later version of the command:

(defun c:c ( )
   (initcommandversion)
   (command "_.copy")
)

However, why not just change the alias for the copy command in the acad.pgp file?

[Tools > Customise > Edit Program Parameters (acad.pgp)]

Share this post


Link to post
Share on other sites
alanjt

I'm with Lee. Make these type of changes at the acad.pgp level. Much less headache. Also, to make things easier and more organized, instead of editing what's already there, just place everything you want after the follow bit of text, placed at the bottom of all acad.pgp files.

 

;  -- User Defined Command Aliases --
;  Make any changes or additions to the default AutoCAD command aliases in 
;  this section to ensure successful migration of these settings when you
;  upgrade to the next version of AutoCAD.  If a command alias appears more
;  than once in this file, items in the User Defined Command Alias take
;  precedence over duplicates that appear earlier in the file.
;  **********----------**********  ; No xlate ; DO NOT REMOVE

Share this post


Link to post
Share on other sites
cwize

Thanks to both of you for the answers - I'd not heard of "initcommandversion". The command was part of of a long Lisp routine that shortened a ton of commands and was created by a coworker many years ago. It's how I learned AutoCad, so the familiarity is why I haven't gone into the .pgp stuff (I did, somewhat, when I was stuck with LT for a while). Also, big thanks for this text block to avoid editing the default pgp.

Share this post


Link to post
Share on other sites
Lee Mac

You're very welcome cwize :thumbsup:

For completeness, here is the documentation for the initcommandversion function.

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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