Newer
Older
use_select_history=True,
)
geom_dupe = ret["geom"]
verts_dupe = [v for v in geom_dupe if isinstance(v, bmesh.types.BMVert)]
edges_dupe = [e for e in geom_dupe if isinstance(e, bmesh.types.BMEdge)]
faces_dupe = [f for f in geom_dupe if isinstance(f, bmesh.types.BMFace)]
del ret
if pg.plane == "LO" and mode == "d":
vector_delta = view_coords(vector_delta.x, vector_delta.y, vector_delta.z)
elif pg.plane == "LO" and mode == "i":
vector_delta = view_dir(pg.distance, pg.angle)
bmesh.ops.translate(bm, verts=verts_dupe, vec=vector_delta)
update_sel(bm, verts_dupe, edges_dupe, faces_dupe)
bmesh.update_edit_mesh(obj.data)
def fillet_geometry(context, pg, mode, obj, bm, verts, values):
"""Fillet Geometry.
Args:
context: Blender bpy.context instance.
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
verts: The object's selected vertices, or selected history vertices
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
"""
if not obj.mode == "EDIT":
pg.error = PDT_ERR_FILEDIT
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return
if mode in {"i", "v"}:
vert_bool = True
vert_bool = False
# Note that passing an empty parameter results in that parameter being seen as "0"
# _offset <= 0 is ignored since a bevel/fillet radius must be > 0 to make sense
_offset = float(values[0])
if _segments < 1:
_segments = 1 # This is a single, flat segment (ignores profile)
_profile = float(values[2])
if _profile < 0.0 or _profile > 1.0:
_profile = 0.5 # This is a circular profile
if mode == "i":
# Fillet & Intersect Two Edges
# Always use Current Selection
verts = [v for v in bm.verts if v.select]
edges = [e for e in bm.edges if e.select]
if len(edges) == 2 and len(verts) == 4:
plane = pg.plane
v_active = edges[0].verts[0]
v_other = edges[0].verts[1]
v_last = edges[1].verts[0]
v_first = edges[1].verts[1]
vector_delta, done = intersection(v_active.co,
v_other.co,
v_last.co,
v_first.co,
plane
)
pg.error = f"{PDT_ERR_INT_LINES} {plane} {PDT_LAB_PLANE}"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
raise PDT_IntersectionError
if (v_active.co - vector_delta).length < (v_other.co - vector_delta).length:
v_active.co = vector_delta
v_other.select_set(False)
else:
v_other.co = vector_delta
v_active.select_set(False)
if (v_last.co - vector_delta).length < (v_first.co - vector_delta).length:
v_last.co = vector_delta
v_first.select_set(False)
else:
v_first.co = vector_delta
v_last.select_set(False)
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
else:
pg.error = f"{PDT_ERR_SEL_4_VERTS} {len(verts)} Vert(s), {len(edges)} Edge(s))"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
raise PDT_SelectionError
bpy.ops.mesh.bevel(
offset_type="OFFSET",
offset=_offset,
segments=_segments,
profile=_profile,
vertex_only=vert_bool
)