49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
|
|
import bpy
|
||
|
|
import numpy as np
|
||
|
|
|
||
|
|
bpy.ops.wm.open_mainfile(filepath="characters/female/lena_nude/hires_work/01_imported.blend")
|
||
|
|
obj = bpy.context.selected_objects[0]
|
||
|
|
print(f"Working on {obj.name}")
|
||
|
|
|
||
|
|
mesh = obj.data
|
||
|
|
bpy.context.view_layer.objects.active = obj
|
||
|
|
bpy.ops.object.mode_set(mode="OBJECT")
|
||
|
|
|
||
|
|
import bmesh
|
||
|
|
bm = bmesh.new()
|
||
|
|
bm.from_mesh(mesh)
|
||
|
|
bm.edges.ensure_lookup_table()
|
||
|
|
|
||
|
|
boundary_edges = [e for e in bm.edges if e.is_boundary]
|
||
|
|
print(f"Total boundary edges: {len(boundary_edges)}")
|
||
|
|
|
||
|
|
hems = [
|
||
|
|
{"name": "bra_band", "z": 0.637, "width": 0.005},
|
||
|
|
{"name": "armholes", "z": 0.685, "width": 0.005},
|
||
|
|
{"name": "neckline", "z": 0.734, "width": 0.005},
|
||
|
|
{"name": "briefs_waist", "z": 0.588, "width": 0.005},
|
||
|
|
{"name": "leg_openings", "z": 0.490, "width": 0.005}
|
||
|
|
]
|
||
|
|
|
||
|
|
for hem in hems:
|
||
|
|
z_min = hem["z"] - hem["width"]
|
||
|
|
z_max = hem["z"] + hem["width"]
|
||
|
|
count = 0
|
||
|
|
for e in boundary_edges:
|
||
|
|
v1 = e.verts[0].co.z
|
||
|
|
v2 = e.verts[1].co.z
|
||
|
|
if z_min <= v1 <= z_max or z_min <= v2 <= z_max:
|
||
|
|
count += 1
|
||
|
|
print(f"{hem["name"]} ({hem["z"]:.3f}): {count} boundary edges")
|
||
|
|
|
||
|
|
z_thigh_min, z_thigh_max = 0.28, 0.34
|
||
|
|
thigh_count = 0
|
||
|
|
for e in boundary_edges:
|
||
|
|
v1 = e.verts[0].co.z
|
||
|
|
v2 = e.verts[1].co.z
|
||
|
|
if z_thigh_min <= v1 <= z_thigh_max or z_thigh_min <= v2 <= z_thigh_max:
|
||
|
|
thigh_count += 1
|
||
|
|
print(f"Control band (thigh 0.28-0.34): {thigh_count} boundary edges")
|
||
|
|
|
||
|
|
bm.free()
|