# Center (snap) hole in object

Trying to center a hole in a door, on the vertical axis only.

What is the fastest way to proceed?

I've read this answer from Cegaton Can I snap to the center (midpoint) of an edge? Someone asked if this this operation could be done if the two sets to be aligned belong to the same object, in edit mode, the answer was positive. However if I do as described, (snap selection to cursor), the hole is collapsed to the 3D cursor.

You can do this in 3 stages, that do involve the cursor but in a different manner:

1. Select the outer border vertices of your door and snap you cursor to this selection (ShiftS > Cursor to Selected). This will move the cursor to the center of your door object.
2. Now, select the geometry delimiting your hole.
3. Open the Properties Panel (N), and copy the XYZ values from the 3D Cursor location to the Median (which represents the center location of your selection). This will move your selection to the cursor, while maintaining the shape of the hole. EDIT: Or instead of copying values, you can use the snap tool to move the selection to the cursor (ShiftS > Snap Selection To Cursor (Offset). The offset option makes sure the selection moves while maintaining its shape (thanks @Mr Zak!).

Result:

• Yes that indeed works (by copying only X and Y values as I wanted to keep the height), thanks! I'm selecting your answer, but I've also posted my own which uses the snap tool. – mins Nov 26 '15 at 20:47
• You could simplify step 3 by using Shift+S > Selection to Cursor (Offset) instead of copying values. – Mr Zak Nov 27 '15 at 14:08
• Cool, will have to try that when I get home – TLousky Nov 27 '15 at 15:39

I'm answering myself since I've found the most logical solution (though not the fastest).

I wanted to have the median point of the hole faces aligned with the center of the top face. I discovered in the snapping tool a possibility to mark several points (possibly giving more weight to some of them). We can use this possibility this way:

• Select the faces to be aligned (or the vertexes or the edges).

• Activate Snap in the 3D view header. Snapping with Ctrl key is not sufficient.

• Select Vertices for the type of elements to snap to.

• Select Center as the part to snap onto the target.

• Activate Snap onto itself, else only other objects can be targets.

Now for the actual snapping:

• Activate grab (G) and local Y in this case (Y+Y).

• Hoover over one of the four vertices of the top face. When the snap target is confirmed (circle), press A to mark this vertex.

• Repeat the last step for the other 3 vertexes.

• Complete the operation with the mouse left button.

Note that marking only two vertices diagonally opposed would be enough in the present case.

I would:

• temporarily subdivide one of the edges of the top face,
• set the snap mode to Vertices,
• set the pivot to Individual Origins
• select the two inner faces as you show on your image,
• G+Y to grab and move and hold Ctrl to enable snapping, and snap to the upper vertex.
• then dissolve the top vertex (X -> Dissolve Vertices)

Here's a cheeky script that lets you mid-align all selected faces, with the Active Face. accepts x,y,z as axis comands.

import bpy
import bmesh

def distribute_and_align(mode, axis):

obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)

if mode == 'Align_Mid':

a = bm.faces.active.calc_center_median()
amount = getattr(a, axis)

for f in bm.faces:
if f == bm.faces.active:
continue
if f.select == True:
p = f.calc_center_median()
pamount = getattr(p, axis)

diff = amount - pamount
for v in f.verts:
co = v.co
pos = getattr(co, axis)
setattr(co, axis, pos+diff)

bmesh.update_edit_mesh(me, True)

distribute_and_align(mode='Align_Mid', axis='z')

• That works, but the Snap onto itself needs to be turned on. – mins Nov 26 '15 at 20:20

An alternative is using the inset tool to generate the window.

In Edit Mode select the front and back faces of the door.

Then press I to activate the Inset tool, and drag to change the thickness.

That will generate a set of new faces centered in the middle of the door.

To shape the window use then scale on the Z or X axis. That way you can make sure that your window will remain centered in the axis you need.

1. Select the perimeter faces of the door
2. Press Shift+s to show the Snap Menu
3. Into Snap Menu Click on Cursor to Selected (the 3D cursor moves to the center of the selected faces)
4. Select the perimeter faces of the window hole
5. Make sure that into Pivot Point menu you have selected one option different from Active element: with such option active the following steps might fail.
6. Press Shift+s again for the Snap Menu
7. Into Snap Menu click on Selection to Cursor (Offset)

Done.