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

Looking for a custom Lisp Routine to Rotate Objects

10 REPLIES 10
Reply
Message 1 of 11
zootango
1054 Views, 10 Replies

Looking for a custom Lisp Routine to Rotate Objects

I'm looking for a lisp routine that will rotate a selected object a value or your choice and within the same command select the rotated object and allow you to move it to a new location by picking a point on the screen.   Then is you run the command again it would hold the last rotation angle you used as its default.

 

What I'm trying to accomplish is we are always having the need to rotate text either 180 degrees and/or to 0 degrees for many text items.

When we rotate these text items to the angle we need, be it 180 degrees or to zero degrees, we almost always need to move the rotated text as well.

 

A lisp routine that would allow us to just set the rotation we need and select the text object and have it rotate it right then and then automatically start the move command and grab that rotated text object and allow us to just pick a point to place it, would be such a time saver.

 

Does anybody have anything like this that they would like to share?

10 REPLIES 10
Message 2 of 11
Kent1Cooper
in reply to: zootango


@zootango wrote:

... we are always having the need to rotate text either 180 degrees and/or to 0 degrees for many text items.

When we rotate these text items to the angle we need, be it 180 degrees or to zero degrees, we almost always need to move the rotated text as well.

....


Would this always be with Text entities only, or might it also need to work on Mtext entities?  I have a routine that spins any number of selected Text/Mtext objects by the same User-specified angle, though it does it around each one's insertion point.  [It currently doesn't save the User's angle, but offers 180 degrees as a default every time, but that can easily be fixed.]  It wouldn't be hard to alter it to do it around the middle of each one's bounding box, and then you shouldn't need to move them, or at least very few of them.  However, if Mtext is a possibility, its bounding box reaches to its defined width, which can be a lot wider than the actual content, so that could effectively "move" Mtext objects so that you would need to move them "back."  There are ways to determine the middle of Mtext's actual extent, but it's more complicated.  If you don't need that, I can pretty easily come up with one that works on Text only.

Kent Cooper, AIA
Message 3 of 11
zootango
in reply to: Kent1Cooper

Hey Kent,

 

We rotate all types of text and mtext.

 

I don't think the mtext would be a problem if the routine has the "move" function in it.

 

We always need to move just about every text object we rotate a little this way or that way, that's why the "move" function in the routine is so important.

 

 

Message 4 of 11
dbroad
in reply to: zootango

I don't have time to write a routine now but, have you tried mocoro?

Architect, Registered NC, VA, SC, & GA.
Message 5 of 11
Kent1Cooper
in reply to: zootango

Rather quickly converted/adjusted from my other one, without error handling or Undo begin/end or some of the other usual stuff yet, but see what you think.  It asks for, and remembers, the rotation angle, whether you want Text or Mtext or both, and whether you want it to do it with All such objects in the current space or a User selection.  Limited testing.

Kent Cooper, AIA
Message 6 of 11
zootango
in reply to: zootango

Thanks Kent,

 

Your lisp was a little to many steps for what I was looking for.

 

I was able to take an old rt180.lsp routine and just modify the rotation value for what I need and that works fine, until I need to change that value again which then I have to modify the lisp routine and reload the lisp again.  Other than that It works fine for what I need.

 

Thanks again for your help.

Message 7 of 11
Kevin_Nunes
in reply to: Kent1Cooper

@Kent1Cooper

This lisp routine works great! You just saved me tons of time.

Is there anyway I can make an option whether or not to make the text move? There are times when I would like to leave the text in the same spot it originally was. Perhaps there could be a few lines of code I can add that gives me a choice for each item whether or not to move.

Thanks again,

Kevin Nunes
Message 8 of 11
Kevin_Nunes
in reply to: Kevin_Nunes

Also, this doesn't seem to work on lines, objects, blocks, etc. Is there anyway to include those in the lisp routine?
Message 9 of 11
Kent1Cooper
in reply to: Kevin_Nunes


@Kevin_Nunes wrote:
....Is there anyway I can make an option whether or not to make the text move? There are times when I would like to leave the text in the same spot it originally was. Perhaps there could be a few lines of code I can add that gives me a choice for each item whether or not to move.
....

Rather than needing to invoke an option for whether or not to Move each one, I have a suggestion:  Position your left hand with the little finger on the Shift key and another on the 2 key, and for any that you want to stay where they are, just use them to feed in @@.  I imagine something could be worked into the routine, but I would think it would be more cumbersome than that, if it means making a choice for every one.  The @ approach means you don't need to do anything for those you want Moved except@ give it the new position, and typing @ only for those you want left where they are shouldn't be any more work than typing some option letter.

Kent Cooper, AIA
Message 10 of 11
Kent1Cooper
in reply to: Kevin_Nunes


@Kevin_Nunes wrote:
Also, this doesn't seem to work on lines, objects, blocks, etc. Is there anyway to include those in the lisp routine?

That can certainly be done, but it raises some questions.  For Blocks, I assume you would want the rotation to be about the insertion point as for Text/Mtext.  For Xlines and Rays, presumably the "origin" point.  For Lines, I guess the midpoint might be a good candidate, but maybe you would want an endpoint, and if so, the one closer to the point at which you picked it, or always the start or end, whichever that is, or should the User designate for each one?  For Arcs and Ellipses, the center?  What about Polylines, Splines, etc?

Kent Cooper, AIA
Message 11 of 11
Kevin_Nunes
in reply to: Kent1Cooper

@Kent1Cooper

For blocks, it would probably be best to rotate about the insertion point.

You bring up a good point about what point to rotate about for lines, arcs, etc. I probably would not want to include any lines or such in the lisp routine considering the base point will be different for different drawings.

So if the lisp routine could just include blocks that would work out fine.

Thank you

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

Post to forums  

Autodesk Design & Make Report

”Boost