New clean wireframes operator to easily apply edge split modifier to nicer drawings

This commit is contained in:
Dion Moult
2020-12-10 13:50:43 +11:00
parent b65c1e94ad
commit ce6350a52f
3 changed files with 21 additions and 0 deletions
@@ -230,6 +230,7 @@ if bpy is not None:
operator.SetBlenderClashSetA,
operator.SetBlenderClashSetB,
operator.ExecuteBlenderClash,
operator.CleanWireframes,
prop.StrProperty,
prop.Attribute,
prop.MaterialLayer,
@@ -4845,3 +4845,20 @@ class ExecuteBlenderClash(bpy.types.Operator):
blender_clasher = BlenderClasher()
blender_clasher.process_clash_set()
return {"FINISHED"}
class CleanWireframes(bpy.types.Operator):
bl_idname = "bim.clean_wireframes"
bl_label = "Clean Wireframes"
def execute(self, context):
objects = bpy.data.objects
if bpy.context.selected_objects:
objects = bpy.context.selected_objects
for obj in objects:
if not isinstance(obj.data, bpy.types.Mesh):
continue
# TODO: probably breaks i18n
if not obj.modifiers.get("EdgeSplit"):
obj.modifiers.new("EdgeSplit", "EDGE_SPLIT")
return {"FINISHED"}
@@ -2303,6 +2303,9 @@ class BIM_PT_annotation_utilities(Panel):
def draw(self, context):
layout = self.layout
row = layout.row(align=True)
row.operator("bim.clean_wireframes")
row = layout.row(align=True)
op = row.operator("bim.add_annotation", text="Dim", icon="ARROW_LEFTRIGHT")
op.obj_name = "Dimension"