There are 2 things in this blog post that I want to point out.
1) Share a LISP routine that rotates multiple objects around their individual base points…
2) The lisp routine shown in this post hasn’t been altered since 1991 and it still works in AutoCAD 2014. This may not seem like a big deal but with all of the various programming languages available to be used within AutoCAD, the power of using a LISP routine that hasn’t had to be changed or updated in over 20 years is pretty impressive.
The Routine allows you to rotate multiple objects such as blocks and text objects that have an “Insertion Point” to a user-specified angle. And instead o0f rotating everything around one base point, the object’s individual base point is used.
In the example below, there is a vertical column of blocks that are rotated clockwise by 90s. I don’t know why, but all that I know is that I want them right-side-up.
- Load the routine
- ROTMULT <enter> to start
- Select objects
- <enter> when finished selecting
- “Enter Rotation Angle:” enter a positive number to rotate the objects counter-clockwise (example 90) and a negative number to rotate the objects clockwise (example -90)
;* Rotate Multiple ;* Rotates many entities around their respective basepoints ;* allows selection by AUTOCAD selection sets or SSX. ;* Written by David Husch, January 1991 (defun c:rotmult () (prompt "Select Entities to Rotate, <ENTER> for SSX.") (setq ss (ssget)) (if (not ss) (setq ss (ssx))) (setq num (sslength ss)) (setq x 0) (if ss (if (setq ang (getreal "Enter Rotation Angle: ")) (repeat num (setq ename (ssname ss x)) (setq elist (entget ename)) (setq pnt (cdr(assoc 10 elist))) (command "Rotate" ename "" pnt ang) (setq x (1+ x)) ) ) ) )
This is pretty great, thanks. Adding it to my utilities.lsp file now.
It works very good, very good for Electrical Plans, Thank you very much
How do you load the routine??
There is also a video I tried to explain how to copy code and load it
Here is the video https://www.youtube.com/watch?v=GfEI9CSSSk4
i tried using it today. not sure if you have to be an administrator for it to work. i cannot get it to. seems like the code is different in the video than in body of this article as well.
Jon – I tried this routine with both ACAD 2014 & 2015 and they both work fine. I am wondering if you have your SECURELOAD variable turned on. Once you load the LISP routine does it prompt you and ask what you want to do? If so, type in SECURELOAD [enter] at the command line and then set it to 0 (zero)
after that is set you shouldn’t be prompted after loading lisp routines.
Hi! I have a problem. :( All of my text are facing the wrong way. Is there any other way or shortcut to rotate them all at once?
Yes – It sounds like your system Variable MIRRTXT was set to 1. When it is set to 1 and then go to mirror objects and possibly text objects (single line text, Mtext or even attributes, The objects will be mirrored and as you are experiencing, the text will display backwards and end up haying to read the text as a reflection in a mirror.
So if you can erase the content that was mirrored then use the command MIRRTEXT in the command line, please set it to 0 [zero]. Then mirror the objects again, they should be readable as expected.
I hope this helps. If not maybe I can find a routine that will flip the text objects back to normal
Hi. Could you please explain to me what the following statements mean?
(prompt “Select Entities to Rotate, for SSX.”)
(setq ss (ssx)
And what definition data of the object does (assoc 10 elist) statement retrieve?
(assoc 10 elist) takes the start point (10 29.4036 28.6588 0.0), if you want the end point just change 10 to 11.
ELIST = ((-1 . ) (0 . “LINE”) (330 . ) (5 . “18E”) (100 . “AcDbEntity”) (67 . 0) (410 . “Model”) (8 . “0”) (100 . “AcDbLine”) (10 29.4036 28.6588 0.0) (11 48.2395 28.6588 0.0) (210 0.0 0.0 1.0))
This is a great lisp , however I was wondering if there is a lisp to set the absolute angle of rotation to a certain angle.
My issue is that I am trying to set the rotation of many entities to zero without selecting them one by one.
would you please reply to my email
Are the objects similar objects? If so, you can select one of the blocks and then right-click and then select SELECTSIMILAR. This will make a selection set of blocks with that are similar. https://autocadtips.wordpress.com/2010/11/07/command-alias-select-similar/
Another option is to use the following LISP to select blocks by their name and then use the above – https://autocadtips.wordpress.com/2012/09/19/autolisp-select-block-by-name/
Hats off……….. to you a great job.
Thanks a lot…………..worked perfectly.
It works great. just wondering if you could add reference angle option for rotation.
Hi, this is great! Is it possible to write such a lisp for ROTATE3D? I need to rotate multiple texts on their own base point, -90 degree on Y axis. I want to see all the texts on the LEFT view instead of the TOP. I would really appreciate if you could help me.
Like a multiple rotation, is it possible to do for multiple mirror? I am seaching for lisp that could mirror the individual block in one time command.
Bit late I’m sure but see the below, hope it can help others. I too wanted to mirror multiple blocks about their base points so used the lisp posted above as a template. The below mirrors the objects in the Y axis. This is defined within the lisp by the base point and 1 unit above the base point (@0,1). This could be easily changed for X axis mirroring by swapping for @1,0
I’m sure this could be set up to prompt the user to either enter an angle or define two points but I’ll let someone else figure that out!
;* Mirror Multiple
;* Mirrors many entities around their respective basepoints
;* allows selection by AUTOCAD selection sets or SSX.
;* Written by Matthew Hardcastle, May 2016
(defun c:mirrmult ()
(prompt “Select Entities to Mirror, for SSX.”)
(setq ss (ssget))
(if (not ss) (setq ss (ssx)))
(setq num (sslength ss))
(setq x 0)
(setq ename (ssname ss x))
(setq elist (entget ename))
(setq pnt (cdr(assoc 10 elist)))
(command “Mirror” ename “” pnt “@0,1” “y”)
(setq x (1+ x))
; error: too many arguments
After load the mirrmult command .
please Resend the Correct Lisp script.
PERFECT! THANKS A LOT!
when I draw a rectangle using built-in tool for it this LSP seems to work. However, whenever I use it to rotate regions that I have drawn myself, it prompts me with message “Rotate”, but what ever I do it either leaves objects unchanged or deletes them. What should I do?
I think that what is throwing it off is that there isn’t a base point for a region.
For regions, you’ll just have to use the rotate command on them.
Nice, thanks for sharing with the rest of us.
autocad show me a message Rotate Commande inconnue “ROTATE”. Appuyez sur F1 pour obtenir de l’aide.
My first idea is to try to redefine the command.
Here is a link with a brief description: https://autocadtips1.com/2011/04/26/redefine-oh-how-i-love-thee/
I have linked a help article from Autodesk’s website below which answers to question by making sure the correct .cui file is loaded.
Are you using “plain” AutoCAD or a “vertical” such as AutoCAD Architecture, AutoCAD MEP, or Civil 3D?
If you fins a solution, please let us know what worked.
I also noticed that this was posted in an AutoLISP blog post. Are you trying to use the command (rotmult) in this post?
If you are having trouble saving the code and loading the LISP, please see the following link.
it doesn’t seem to work on groups.. in a set of 5 groups I selected, only two rotates, and worst of all, the 2 group-objects rotated like 50times!!!! I’m using Autocad 2014, and it’s my first time using lisps.. can someone help?
It’s a great tool. It saves time.
I have a suggestion for improvement to make.
But I think this is for all programmers lisp language.
This is the maximum use commands in the international format.
For example, I use a French version of Autocad and routine does not work.
The “Rotate” is not recognized.
I changed to “_Rotate” and it works without any worries.
I know this is a very old thread, but is there a way to further this lisp command so that each block that is already placed at the midpoint of a polyline can snap to the line or perpendicular to it? I’ve got a block that looks like a bubble and a leader with a number to indicate what number line segment it is so that depending on which direction the polyline is going, my block with a number 1 points to the midpoint of the line segment between the 1st and 2nd vertexes, the same block with a number 2 points to the midpoint of the next line segment and so on. Your rotmult command works perfectly for it, but my lines change directions often and sometimes have arcs. I was just wondering if I could get all my blocks to rotate so that the arrow portion of the block points perpendicular to the line at each line segment (all blocks rotated about their own specific base points, but perpendicular to my line no matter which direction the line is heading)? If not then no worries, your rotmult command already saves me so much time! Thanks a ton!!
Thanks a lot!
This lisp just did a bunch of work for me in a second on AutoCAD 2020.1.
Works great! But how can I change the routine to rotate all lines at their midpoints instead of their basepoints?
I suspect if instead of rotating around the Start X and Start Y (assoc 10 elist)???????
You could roate around End X – Start X and End Y – Start Y to get the midpoint.
But I have no idea how to write this as this is the first lisp I’ve ever implemented.
Pingback: 1️⃣ Top 15 lisp xoay đối tượng trong cad mới nhất năm 2022