Rotating objects by increments with keyboard

Rotating objects by increments with keyboard

Anonymous
Not applicable
3,446 Views
10 Replies
Message 1 of 11

Rotating objects by increments with keyboard

Anonymous
Not applicable

Hi everyone.

 

I was wondering if anyone has written a macros or just knows how to rotate an object or selection by small increments using the keyboard only? I basically have tons of odd shaped 2-D objects that I need to nest together and they fit in various random ways. I can select one and move it precisely by holding ctrl and using the arrow keys. Now I need a way to rotate the thing via keyboard shortcuts, as in I would like to hold ctrl and use the (-) or (+) to rotate CW or CCW by small increments, like 5 degrees per key stroke. 

 

Any idea? Thanks in advance!!

0 Likes
Accepted solutions (1)
3,447 Views
10 Replies
Replies (10)
Message 2 of 11

steven-g
Mentor
Mentor

Here's a starter, if you preselect the object(s) and run this macro it will ask for the rotation point and then ask for an angle (you are free to choose the angle + or -), once rotated the objects are reselected by the macro and hitting enter again will rotate them a second time using the same angle, or you can choose a new angle + or - for fine tuning. This macro will allow for 6 rotations, either all the same angle (hit enter) or change the angle you want (keyboard entry and then enter) and Always using the same rotation point;

Not quite what you asked but a starting point. I did try extending the macro but after 6 rotates the macro fails due to the length of the macro.

^C^C^Cro;\\ro;l;;$M=$(getvar,lastpoint);\ro;l;;$M=$(getvar,lastpoint);\ro;l;;$M=$(getvar,lastpoint);\ro;l;;$M=$(getvar,lastpoint);\ro;l;;$M=$(getvar,lastpoint);\
Message 3 of 11

Anonymous
Not applicable

This is a great start I really appreciate it!!!

0 Likes
Message 4 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

A much more highly-developed version is SPIN.lsp, available here.  Limitless number of steps until you hit Enter/space to exit, + or - does it without Ctrl or anything, remembers your specified angle increment and offers it as default the next time, etc.

Kent Cooper, AIA
Message 5 of 11

Anonymous
Not applicable

This is exactly what I needed, thank you so much!!!

0 Likes
Message 6 of 11

GrantsPirate
Mentor
Mentor

A simple non-lisp solution is to set polar angle to 5 degrees and proceed from there with the rotate command and moving the cursor.


GrantsPirate
Piping and Mech. Designer
EXPERT ELITE MEMBER
Always save a copy of the drawing before trying anything suggested here.
----------------------------------------------------------------------------
If something I wrote can be interpreted two ways, and one of the ways makes you sad or angry, I meant the other one.

0 Likes
Message 7 of 11

Kent1Cooper
Consultant
Consultant

@GrantsPirate wrote:

A simple non-lisp solution is to set polar angle to 5 degrees and proceed from there with the rotate command and moving the cursor.


That's a reasonable approach, though it requires you to make sure Polar mode is turned on, and to change the POLARANG System Variable setting any time you want a different increment [if you ever do], and remember to change it back if you prefer a different setting for other purposes.

 

And it's subject to accidentally Rotating by non-increment-multiple angles, when the cursor location isn't close enough to a Polar-increment-multiple angle from the base point to lock onto one of those angles.  But with a small angle increment, and moving the cursor around fairly close to the base point, it would pretty reliably just jump between those increment angles, without any of the "floating free" between those angles that you can get if the cursor is farther afield.

Kent Cooper, AIA
0 Likes
Message 8 of 11

GrantsPirate
Mentor
Mentor

Yeah, picking the Polar icon is a real inconvenience. Smiley Happy 


GrantsPirate
Piping and Mech. Designer
EXPERT ELITE MEMBER
Always save a copy of the drawing before trying anything suggested here.
----------------------------------------------------------------------------
If something I wrote can be interpreted two ways, and one of the ways makes you sad or angry, I meant the other one.

0 Likes
Message 9 of 11

RobDraw
Mentor
Mentor

I like the non-code solution. Simple, elegant.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Likes
Message 10 of 11

Kent1Cooper
Consultant
Consultant

@GrantsPirate wrote:

Yeah, picking the Polar icon is a real inconvenience. 


It's easy to do, yes, but all I meant was that it's also easy to not be consciously aware of whether Polar is on, in which case, if you want things Rotated only at increment multiples, you could sometimes accidentally get results you don't want.  For the OP's purposes, it sounds like that restriction may not be applicable, but for some people and purposes it could be.

Kent Cooper, AIA
0 Likes
Message 11 of 11

RobDraw
Mentor
Mentor

@Kent1Cooper wrote:

@GrantsPirate wrote:

Yeah, picking the Polar icon is a real inconvenience. 


It's easy to do, yes, but all I meant was that it's also easy to not be consciously aware of whether Polar is on, in which case, if you want things Rotated only at increment multiples, you could sometimes accidentally get results you don't want.  For the OP's purposes, it sounds like that restriction may not be applicable, but for some people and purposes it could be.


With the visual cues available for polar, it would be difficult to "not be consciously aware" that it is on. If you are like me and keep polar on, it catches me off guard when it is off, wondering why my angles are not showing.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Likes