this was a beautiful accident.
#2.78a
#Scale Vertices To Cube
import bpy
import bmesh
from mathutils import Vector
def scale_to_cube(obj, ForceMDist=1.0):
# Ensure we're in edit mode
bpy.ops.object.mode_set(mode='EDIT');
# Get a BMesh from the active object
bm = bmesh.from_edit_mesh(obj.data);
# Get the selected vertices
verts = [v for v in bm.verts if v.select];
if verts:
# Calculate the center of the selected vertices
center = sum((v.co for v in verts), Vector()) / len(verts);
# Calculate the maximum distance from the center to a vertex
max_dist = max((v.co - center).length for v in verts);
# Scale each vertex to form a cube
for v in verts:
dist = (v.co - center).length;
if dist > 0: # Avoid division by zero
# Calculate the scaling factor based on distance
scale_factor = (1 - (dist / max_dist)) ** ForceMDist;
# Scale the vertex towards the center
v.co = center + (v.co - center) * scale_factor;
# Update the mesh
bmesh.update_edit_mesh(obj.data, True);
# Get the active object
active_obj = bpy.context.object
# Scale the selected vertices to a cube
scale_to_cube(active_obj, 0.15) # Adjust ForceMDist as needed
but basically it allows you to take a sphere object and deform it into a conch (tweak it only slightly for best results)