Jump to content

Add on to an existing command?


squareknees

Recommended Posts

I have worked in AutoCAD for 15 years and I never mastered writing code. I love the lisp routines that I have found and use on a regular basis.

I always thought that the copy command should have a rotate option. I know that in express tools has the 'move copy rotate' command but it is a pain to use.

 

 

I remember when you had to tell the copy command that you wanted to do multiple copies then they added this additional information to automatically do it.

 

 

Would it be possible to add another layer of code that would give you the option to rotated the copied object from a pick point. If the copy command is a rectangular array can't they add the polar array to it too?

 

 

Thanks

squareknees

Link to comment
Share on other sites

See if this will work for you.

 

It not fancy, but should do the trick.

 

(defun c:cr ()
(princ "\nCopy, & 
Rotate:\n")
(setq ss (ssget))
(command "copy" ss "" "0" "0")(command 
"move" ss "" pause pause)(command "rotate" ss "" "@" pause))

Link to comment
Share on other sites

Could you not use the Copy option of the Rotate command?

 

Command: ROTATE
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0
Select objects: Specify opposite corner: 1 found
Specify base point:
Specify rotation angle or [[color=red]Copy[/color]/Reference] <0>: C
[color=red]Rotating a copy of the selected objects.[/color]

Link to comment
Share on other sites

Added an error trap to the code I posted above

 

(defun c:test (/ *error*)

  (defun *error* ( msg )
       (if (not (member msg '("Function cancelled" "quit / exit abort")))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )
(princ "\nCopy & Rotate:\n")
(setq ss (ssget))
 (command "copy" ss "" "0" "0")
 (command "move" ss "" pause pause)
 (command "rotate" ss "" "@" pause)
 )
(princ)

Link to comment
Share on other sites

Wow I didn't even realize that there was a copy option in the rotate command.

I guess I am not use to reading the command line since I just go through the motions that I always have.

Now I just have to remember that if I want to copy something and rotate it I have to use the rotate command.

Thank you so much that has bugged me for awhile. I guess instead of going through the motions I need to actually read the command line!

Link to comment
Share on other sites

Could you not use the Copy option of the Rotate command?

http://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-Core/files/GUID-385D1161-6A07-432E-B69B-71C7D19409F5-htm.html

or MOCORO (Express Tool)

Moves, copies, rotates, and scales selected objects with a single command.

 

Use MOCORO as a convenient method that combines the most commonly used modification commands.

 

Options

Move Moves objects

Copy Makes multiple copies of objects

Rotate Rotates objects

Scale Dynamically scales objects

Base point Specifies a new base point for the next modify option

Undo Reverses the previous operation

Link to comment
Share on other sites

 

I know that in express tools has the 'move copy rotate' command but it is a pain to use.

 

;)

 

Wow I didn't even realize that there was a copy option in the rotate command.

I guess I am not use to reading the command line since I just go through the motions that I always have.

Now I just have to remember that if I want to copy something and rotate it I have to use the rotate command.

Thank you so much that has bugged me for awhile. I guess instead of going through the motions I need to actually read the command line!

 

You're most welcome! - A custom command could of course be created to allow you to perform the same operation without typing the 'C' for copy, but I prefer to suggest an out-of-the-box solution first if appropriate.

 

Lee

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