# How to change an unknown diameter of a hole to a specific size?

I have a cube with several holes in it. Now I need to change the size of one hole to 6.34 mm diameter. What is the best way to do this?

• What shape are the holes? It's easy for square shapes (as edge length = diameter). Commented Nov 6, 2015 at 16:19
• The hole is round. Commented Nov 7, 2015 at 2:14

The LoopTools add-on proposed by TLousky, is obviously massively convenient and exactly what you want.

Given the above statement, the rest of this answer might be slightly academic, but can still be useful if you are interested in how something like this is scripted. My solution works on the assumption that:

• the hole is a circle, and its vertices are the only things selected.
• the object has all transforms applied
• find the average coordinate (center of circle)
• let it find the diameter by checking the distance between the average coordinate and any of the vertices.
• use the average vector as a pivot point to scale away from.

code:

# This example assumes we have a mesh object in edit-mode

import bpy
import bmesh
from mathutils import Vector

def get_average_vector_of_selection(bm):
avg_vector = Vector()
num_vecs = 0
for v in bm.verts:
if v.select:
num_vecs += 1
avg_vector += v.co
return (avg_vector / num_vecs)

for v in bm.verts:
if v.select:
return (average-v.co).length

average = get_average_vector_of_selection(bm)
# bpy.context.scene.cursor_location = average

return

for v in bm.verts:
if v.select:
new_vec = (average).lerp(v.co, 1/amount_to_rescale)
v.co = new_vec

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

bmesh.update_edit_mesh(me, True)

• If the points are evenly distributed, then the coordinate average is the center of the circle. If the points are NOT evenly distributed, it is probably not the center of the circle. Commented Nov 10, 2015 at 21:17

Another way to achieve this is using the LoopTools addon's 'Circle tool'.

If the addon is not active on your system, go to the User Settings (CtrlAltU) > Addons > Mesh > LoopTools and activate it using the small checkbox on the right:

In Edit Mode select the loop or loops you want to resize, then either from the Tool Shelf > LoopTools or the Specials Menu (W > LoopTools) choose the 'Circle tool':

Toggle the "Radius" option on, then type in the radius you want (diameter / 2) for the hole:

• That works but, Whats is the unit of radius? I want to set it in cm or what ever, not scale unit! Commented Apr 23, 2019 at 4:59
1. Make a cylinder at the right place and size.

2. Create a vertex group and add the vertices around the hole to it.

3. Add a shrinkwrap modifier (to the cube), select the cylinder as the object and limit it to the vertex group.

You may have to move the vertices from the cube into roughly the right position. As you see, they follow the cylinder but as they are not evenly spaced, the resulting hole is not very regular.

• Step 2 - do you mean create a vertices group of original hole's outline. How do I add to the hole in it? Step 3 - who do I "limit it to the vertex group"? Commented Nov 7, 2015 at 2:19
• I'll add some screenshots. Commented Nov 7, 2015 at 8:40