3
$\begingroup$

I have a model that I initially started to create not exactly along the axes. I need to rotate it so that the faces go exactly along the axes. And you also need to find out the angle of rotation of the model relative to the position when it will look exactly along the axes. Is it possible to do this ? I twisted the model in every possible way, but nothing brought results. Text

$\endgroup$
3
  • $\begingroup$ First thing, you are in Global orientation mode, so maybe the local orientation is correct, what does it give if you press Alt R in Object mode? $\endgroup$
    – moonboots
    Feb 23 at 7:09
  • $\begingroup$ Or if you switch to Object Mode instead of Edit Mode, what are the values for Rotation in the sidepanel on the top right? It would have been good if you showed a screenshot in Object Mode, too. $\endgroup$ Feb 23 at 7:21
  • $\begingroup$ hehe, this Q&A is really a testament to how far removed from a CAD software Blender is :) $\endgroup$
    – Gorgious
    Feb 23 at 9:58

4 Answers 4

6
$\begingroup$
  • In Edit Mode, select an element aligned to your desired axes, and Header > Transform Orientations > Create a Transform Orientation from the element, by clicking the little '+' in the pop-up.
  • In Object Mode, set the Header > Options to affect only 'Origins'
  • With the object selected, Header > Transform > Align to Transform Orientation.

Now the axes will be aligned to the selected element. Uncheck the 'Origins' option.

enter image description here

Before straightening the object, (AltR) you will be able to read the old rotation from the N panel > Item > Transform > Rotation fields. (Perhaps stash that rotation on a copy)

$\endgroup$
2
$\begingroup$

Presuming that the object's rotation is applied so that Clear Rotation with Alt+R doesn't work, there are probably smart ways to find out the angle of rotation your object is off the axes - but I forgot them (but while I was preparing my answer I saw that @joshsanfelici already provided a good one).

Another way you could get the angle is the following (this method is in case your plane is just rotated on the Z axis and flat in XY): in Edit Mode, select some of those edges of which you want to know the angle.

select edges

While still using Global orientation, press E Z to extrude them (up or down doesn't matter) constrained to the Z axis.

extrude edges

Add a new object, preferably one with rectangular sides like a cube. Make sure the Snapping options are set to Face Project and Align Rotation to Target.

snapping options

Select the cube. Since you only need the Z rotation, lock X and Y rotation in the sidepanel to avoid weird rotations of the cube. Press G to move it towards the extruded faces. With either the Snap tool enabled (the magnet symbol left to the Snapping options) or holding Ctrl for temporary snapping make sure the cube snaps to the new faces.

move and snap

After confirming the new position of the cube with left-click, the Z rotation of the cube shows the angle to which your mesh is rotated off the global axes.

In my case it showed -16.4° but of course there can be decimal places that might just be shown rounded. The best is to copy the value from the input field to get the exact angle.

copy angle

Now select your mesh, go to Edit Mode, select all with A, then press R Z to constrain rotation to the Z axis, paste the angle with Ctrl+V followed by minus to reverse whatever value it was and hit Enter. Now your mesh is aligned to the global axes.

rotate mesh back

$\endgroup$
2
$\begingroup$

If you can apply object's transforms, You could go to edit mode, select some mesh elements that have normals in the orientation you would like to match the axis, make Custom Transform Orientation out of them, go to object mode and run C.object.matrix_world = C.scene.transform_orientation_slots[0].custom_orientation.matrix.to_4x4().inverted() in Python Console.

$\endgroup$
2
$\begingroup$

I assume that in object mode the model has a straight orientation, so you have to rotate it to align straight lines with the 3D world.

There are many ways you can choose to perform the task, I would use bones.

Go to edit mode, select a vertex belonging to a straight line, press Shift S > Cursor to selected.

Back in object mode press Shift A > Add Armature > Single bone.

In the Armature Edit mode, turn on vertex snapping and snap the tail of the bone to another vertex of the straight line.

With the bone selected in its edit mode, press E, Y, move the mouse, Enter, to extrude a new bone aligned with the Y world axis.

Set the roll of both bones to 0.

enter image description here

Back in Object mode, select the model, Shift select the armature, go to pose mode, select the oblique bone and press Ctrl P > Bone, to parent the mesh to the rotated bone.

Set the rotation mode of the bones to "Euler XYZ".

Select the straight, bone, Shift select the rotated bone, press Shift Ctrl C > Add Copy Rotation bone constraint.

In the bone constraints panel Apply the copy rot constraints.

Back in object mode, select the mesh and press Alt P > Keep transform, then delete the armature object.

In the "N" properties panel you can read the exact value of the rotations involved in the process (in my example 0,0,7.47059 degrees).

If you press then Ctrl A > Apply all transform, you will end up with an aligned model with all its transform values resetted (000, 000, 111).

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .