Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Keybord shortcut for Macro

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
lucasa8LZ6Q
280 Views, 5 Replies

Keybord shortcut for Macro

Hi All,

I created this macro to copy rotate:

^C^C^]._MOCORO;_P;;\_C;\;_R;\;

 

and i want to run it when i type in "cr" into the command line.

how do i do this?

Tags (3)
Labels (1)
5 REPLIES 5
Message 2 of 6
Kent1Cooper
in reply to: lucasa8LZ6Q

Or you adopted? -- that's exactly the example macro >here<.  Follow the instructions there to make a command of it.

 

You could also define such a command in AutoLisp, but it wouldn't be able to use MOCORO in a (command) function, since that takes only AutoCAD commands, and MOCORO is an Express Tool.  It would need to build the same functionality with a COPY and a ROTATE command.

Kent Cooper, AIA
Message 3 of 6
lucasa8LZ6Q
in reply to: Kent1Cooper

hey, yes, thats how it was created.

and i made a button for it on my tool palette.

But i want it to run when i type CR.

 

im not familiar with how to write the code for it in AutoLisp.

 

Any advice?

Message 4 of 6
rkmcswain
in reply to: lucasa8LZ6Q

Here is a starting point for the lisp version. Change C:COPYROT to C:CR

 

https://www.theswamp.org/index.php?topic=2787.msg35069#msg35069

R.K. McSwain     | CADpanacea | on twitter
Message 5 of 6
lucasa8LZ6Q
in reply to: rkmcswain

Hey thank you so much, it worked!

Do you know the best place to go and learn this?

because i have other commands i want to do the same with. ie (move rotate, scale move, etc)

Message 6 of 6
Kent1Cooper
in reply to: lucasa8LZ6Q

I have a greatly simplifying suggestion.  That linked routine and other suggestions at the same link get complicated by the fact that the original selection isn't what you want to Rotate after you've Copied it, but you want the results of the Copying, yet you can't know in defining the command how many there will be, so you have to find the newer things after Copying, or involve Groups or the Clipboard, or.....

 

If, instead of COPYing the selection with a displacement, you COPY the original selection IN PLACE, then MOVE that original selection by the desired displacement, then very conveniently, both what you want to MOVE and what you then want to ROTATE is simply the Previous selection, no matter how many objects it contains.

(defun C:CR (/ ss)
  (prompt "\nTo Copy and then Rotate,")
  (if (setq ss (ssget "_:L"))
    (command ; then
      "_.copy" ss "" '(0 0) '(0 0); IN PLACE
      "_.move" "_previous" "" pause pause
      "_.rotate" "_previous" "" "@"
    ); command
  ); if
)

It leaves you at the point of specifying the rotation, around the same location relative to the objects that was used for the displacement.

 

Of course, it requires that it's OK for you to have the original selection end up in a different place, replaced in the original location by the results of the Copying.  You may have reason not to want that, for example if you have extended data attached to some of it, or other such complication.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta