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 

38 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
  16. Hi Ryan, I have a question that honestly, I feel a little dim asking... All I'm trying to do is rotate a flat, 90 degree face so that it is now 45 degrees. When I type in 45 to the degrees, it moves the vertices in the correct (constrained) axes, but the triangle formed is a 90:82:8, not a 90:45:45. I tried dragging the degree bar until it visibly formed a 45 degree angle, and the degree bar reads 7.12. Sorry, I wish I could include a screenshot, it would be a lot easier to explain...but based on that (probably confusing) description, any ideas about what I've done wrong? Any help would be great! Thanks

    ReplyDelete
  17. This might be due to rotation and/or scaling at the object level. Does the object have a non-uniform scale or a rotation?

    ReplyDelete
  18. Hey Ryan! It's a great script to add some much needed functionality that blender doesn't do as well as max. In max I would probably use the very robust symmetry modifier for this, and rotate the plane of symmetry. I do have a suggestion and I'd be interested in your thoughts on whether you think it's worth implementing. The idea is basically about a 3 step action:

    1) the selected face should be essentially extruded at a 0 amount
    2) then the face can be rotated constrained with MIN setting (e.g 40 degrees)
    3) the initial unrotated face should be rotated 80 degrees around the point of rotation (min)...

    I will try to attach a picture https://pasteboard.co/HB99ESA.jpg

    The idea is that we could keep the cross-section of the initial face selection and keep extruding the form, because with rotate constrained, it inherently gets skewed. There might be a better way of doing this, so I'd be interested in hearing your thoughts. Thanks!

    ReplyDelete
    Replies
    1. I made a gif to better show what I mean... :D

      https://pasteboard.co/HBaig2L.gif

      Delete
    2. Another elaboration of the same idea. Not sure if it's possible to get the data that reflects the tangents of rotations. https://pasteboard.co/HBLhC4R.jpg

      Delete
  19. Hi.
    Still not 100% sure if I know what you're after but I have just posted a new version for Blender 2.8. It handles angles in Normal space better so it may be closer to what you need. Otherwise, the way you do your operations in your gif is probably the best way and simplest way.
    Cheers
    Ryan

    ReplyDelete
  20. Hello, it seems the mirror checkbox does nothing in the latest Blender 2.8 build from today with the latest version of your script. Do you have any clue on how to solve this ?

    ReplyDelete
  21. Just tried it on today's build and it works fine. Do you have two faces selected?

    ReplyDelete
  22. This comment has been removed by a blog administrator.

    ReplyDelete
  23. Hey Ryan. Trying to install the script (__init__.py) but it doesn't show up in the addons list afterwards?? Am I missing something?

    ReplyDelete
  24. Hi.
    I'm a bit busy today but will have a look over the weekend and see if the script needs updating. You're using Blender 2.80?
    Ryan

    ReplyDelete
  25. Yes I'm using 2.80. It's meant to be installed in the normal way right? The console says: Modules Installed () from 'F:\\Blender Files\\rotation_constrained-master\\__init__.py' into 'C:\\Users\\Troels\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\addons'

    ReplyDelete
  26. Message looks right. I just tried it by installing from the github zip and it appears in the list in the 'mesh' section.

    ReplyDelete
  27. You can see here that it's not in the mesh section.

    https://imgur.com/QG1x9jr

    ReplyDelete
  28. I have installed the add on in 2.82 but cannot see how to activate it. I press Ctrl-Shift-R and F6 but nothing happens. Can you help?

    ReplyDelete
    Replies
    1. That is because he changed the shortcut to Alt+Shift+R (you can have a look in the python script for that in line 131)

      Delete