2

I'm trying to scale or resize an object to a specific size by picking an edge from that mesh, and then setting that edge to a new measurement, automatically resizing the whole object proportionally. In other poly-based 3d software that I use, it is really easy to do. The tool is called 'tape measure' tool which has the option to resize). How to do that in Blender?

Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51
Emet Derek
  • 95
  • 9

1 Answers1

3

Go tab into Edit Mode and tick Edge Length under Overlays so you can see the length of any selected edge. You can set the length of the selected edge using bpy.ops.object.mesh_edge_length_set().

enter image description here

You can easily resize the entire mesh proportionally after resizing the selected edge using the following script. Simply select an edge and go to Text Editor under the Scripting Tab. Then input the new length value for the set_my_selected_edge_to_length variable in the script and click Run Script.

enter image description here

import bpy
import bmesh

set_my_selected_edge_to_length = 1.43 #your new length for selected edge

context = bpy.context ob = context.object me = ob.data bm = bmesh.from_edit_mesh(me)

def resize(scale): ob.scale = (scale, scale, scale) bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.object.transform_apply(scale=True)

for e in bm.edges: if not e.select: continue scale = set_my_selected_edge_to_length / e.calc_length() resize(scale) break

bm.free()

The Edit Mesh Tools has also pretty useful functions that also include edge resizing. I recommend installing this addon under menu Edit > Preferences > Add-ons > Edit Mesh Tools

enter image description here

The tools are available under Edit Tab > Mesh Tools.

enter image description here

Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51