Skip to content

Commit

Permalink
3D-Print: remove Clean Isolated tool
Browse files Browse the repository at this point in the history
This is already handeled by Make Manifold.
  • Loading branch information
mrachinskiy committed Oct 9, 2019
1 parent 3d1eb9c commit 8aa0fcd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
1 change: 0 additions & 1 deletion object_print3d_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class SceneProperties(PropertyGroup):
operators.MESH_OT_print3d_check_sharp,
operators.MESH_OT_print3d_check_overhang,
operators.MESH_OT_print3d_check_all,
operators.MESH_OT_print3d_clean_isolated,
operators.MESH_OT_print3d_clean_distorted,
# operators.MESH_OT_print3d_clean_thin,
operators.MESH_OT_print3d_clean_non_manifold,
Expand Down
62 changes: 0 additions & 62 deletions object_print3d_utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,68 +337,6 @@ def execute(self, context):
return {'FINISHED'}


class MESH_OT_print3d_clean_isolated(Operator):
bl_idname = "mesh.print3d_clean_isolated"
bl_label = "3D-Print Clean Isolated"
bl_description = "Cleanup isolated vertices and edges"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
obj = context.active_object
bm = mesh_helpers.bmesh_from_object(obj)

change = False

def face_is_isolated(ele):
for loop in ele.loops:
loop_next = loop.link_loop_radial_next
if loop is not loop_next:
return False
return True

def edge_is_isolated(ele):
return ele.is_wire

def vert_is_isolated(ele):
return not bool(ele.link_edges)

# --- face
elems_remove = [ele for ele in bm.faces if face_is_isolated(ele)]
remove = bm.faces.remove
for ele in elems_remove:
remove(ele)
change |= bool(elems_remove)
face_count = len(elems_remove)
del elems_remove

# --- edge
elems_remove = [ele for ele in bm.edges if edge_is_isolated(ele)]
remove = bm.edges.remove
for ele in elems_remove:
remove(ele)
change |= bool(elems_remove)
edge_count = len(elems_remove)
del elems_remove

# --- vert
elems_remove = [ele for ele in bm.verts if vert_is_isolated(ele)]
remove = bm.verts.remove
for ele in elems_remove:
remove(ele)
change |= bool(elems_remove)
vert_count = len(elems_remove)
del elems_remove
# ---

self.report({'INFO'}, f"Removed Verts: {vert_count}, Edges: {edge_count}, Faces: {face_count}")

if change:
mesh_helpers.bmesh_to_object(obj, bm)
return {'FINISHED'}

return {'CANCELLED'}


class MESH_OT_print3d_clean_distorted(Operator):
bl_idname = "mesh.print3d_clean_distorted"
bl_label = "3D-Print Clean Distorted"
Expand Down
4 changes: 1 addition & 3 deletions object_print3d_utils/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def draw(self, context):

print_3d = context.scene.print_3d

col = layout.column(align=True)
col.operator("mesh.print3d_clean_isolated", text="Isolated")
row = col.row(align=True)
row = layout.row(align=True)
row.operator("mesh.print3d_clean_distorted", text="Distorted")
row.prop(print_3d, "angle_distort", text="")
layout.operator("mesh.print3d_clean_non_manifold", text="Make Manifold")
Expand Down

0 comments on commit 8aa0fcd

Please sign in to comment.