Saturday, 4 May 2013

Rotate Constraint Script

I could find no easy way to extrude a complex shape in right-angle directions whilst maintaining the shape profile, so I've written a little add-on to do it, available on the scripts page. The Constrain Rotate add-on has no operator button, although it can be enabled in the python file, and is instead run with the ctrl-shift-R key combo. Basically the script allows a face in edit mode to be rotated whilst contstraining all vertices of the face to movement on only one axis. You can for example rotate around the y-axis whilst keeping the vertex movement constrained to the z-axis.
When using this key combo in edit mode with a face selected the following options are presented in the mesh tools panel or by pressing F6:

  • Rotation axis. The axis around which the face is to be rotated.
  • Constraint axis. The axis the vertices are allowed to move in.
  • Rotation point. The point of the face to rotate around.
  • Degrees. The degrees of rotation.
A video would tell a thousand words, but takes 57 times longer to put together than this blog post. I'll do one when I can though. Operation is, however, pretty self-explanatory.
Hope it's useful.
Star Shape Extrusion 

22 comments:

  1. Hi Ryan but where is the download link, please?

    ReplyDelete
  2. On the 'scripts' page. You should see the page link to the right of the post, or if on a mobile browser in the drop down menu at the top.

    ReplyDelete
  3. that's pretty nice. Usually to do such operation i make a slice cut with the knife at 45° thanks to the angle constraint of the knife tool. For other angles i have to create a surface rotated in the specific angle i need and use it as snap target. So this is really really appreciated! Conceptually is a reversed scale on x,y or z axis with 0 value.
    Problem is that the script is not working...Am I missing somthing? I've created a plane > edit mode > shift+ctrl+r and this appear in both vertex and edge selection.

    Traceback (most recent call last):
    File "C:\Users\alan\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\rotation_constrained.py", line 66, in invoke
    self.fnorm = [face.normal for face in context.active_object.data.polygons if face.select == True][0]
    IndexError: list index out of range

    location: :-1

    ReplyDelete
  4. Hi Alan.
    The script only currently works with a selected face. I hadn't thought about making it work for selected vertices or edges. Do you think that would be useful?
    Ryan

    ReplyDelete
  5. Hi Ryan, I'm sorry, I haven't received any notification of your reply. Any way, yes, i think it could be even better if it works with vertex. But right now it's work pretty fine...i haven't understood that I have to be in face selection mode...(As you know if you select 4 vertex of a face, blender it's basically select the face)

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  7. Video here: http://youtu.be/55NUR3tAiLk

    ReplyDelete
  8. Cool video MIke thanks. Name pronunciation was good to. To answer the issue with subsequent rotation angles I usually flatten the face along an axis after each constrained extrude. For example with a s - x - 0 key sequence to flatten the face on the x-axis. This then clears the angle for the next rotation.

    ReplyDelete
    Replies
    1. Okay, I see. Thanks again. This was a needed script.

      Delete
  9. Hey, Ryan, I was thinking, this would be even more useful it it could constrain the face vertex to local x,y,or z axis. Whereas now, it works great for global axis's. What do you think?

    ReplyDelete
  10. HI.
    It already does. Put your manipulator in normal mode and it will constrain to the face's normal x, y, z orientations.

    ReplyDelete
    Replies
    1. Okay, I see that now, cool. I'm lovin' this tool.

      Delete
  11. There was a bug in normal mode that could swap the x and y axis.This has now been fixed

    ReplyDelete
  12. Very useful script! thanks man ;-)

    ReplyDelete
  13. Hi Ryan, nice script but have some questions though. When rotated a face and extruded it again afterwards and want to do a second rotation. The degrees in the second rotation arent the same than the first one? ie if have a cube and rotate one face 45 deg than extrude and than want rotate the new face again 45deg the angle looks different?

    ReplyDelete
    Replies
    1. I usually do a rotation, extrude and then clear the previous rotation by flattening the face in the extruded direction. If you do a rotation on top of a rotation directly I think it screws up.

      Delete
  14. Im glad I checked this addon out 11/10

    ReplyDelete
  15. Always nice to get a nice comment.
    Cheers
    Ryan

    ReplyDelete