New feature to select high polygon meshes

This commit is contained in:
Dion Moult
2020-09-07 11:28:35 +10:00
parent 14c824dfee
commit 24c00c0235
4 changed files with 29 additions and 0 deletions
@@ -200,6 +200,7 @@ if bpy is not None:
operator.RemoveDrawingStyleAttribute,
operator.CopyPropertyToSelection,
operator.CreateShapeFromStepId,
operator.SelectHighPolygonMeshes,
prop.StrProperty,
prop.Variable,
prop.Role,
@@ -3963,3 +3963,24 @@ class CreateShapeFromStepId(bpy.types.Operator):
obj = bpy.data.objects.new('Debug', mesh)
bpy.context.scene.collection.objects.link(obj)
return {'FINISHED'}
class SelectHighPolygonMeshes(bpy.types.Operator):
bl_idname = 'bim.select_high_polygon_meshes'
bl_label = 'Select High Polygon Meshes'
def execute(self, context):
results = {}
for obj in bpy.data.objects:
if not isinstance(obj.data, bpy.types.Mesh) \
or len(obj.data.polygons) < int(bpy.context.scene.BIMDebugProperties.number_of_polygons):
continue
try:
obj.select_set(True)
except:
# If it is not in the view layer
pass
relating_type = obj.BIMObjectProperties.relating_type
if relating_type:
relating_type.select_set(True)
return {'FINISHED'}
@@ -1353,6 +1353,7 @@ class BIMObjectProperties(PropertyGroup):
class BIMDebugProperties(PropertyGroup):
step_id: IntProperty(name="STEP ID")
number_of_polygons: IntProperty(name="Number of Polygons")
class BIMMaterialProperties(PropertyGroup):
@@ -2026,6 +2026,12 @@ class BIM_PT_debug(Panel):
row = layout.row()
row.operator('bim.create_shape_from_step_id')
row = layout.row()
row.prop(debug_props, 'number_of_polygons', text='')
row = layout.row()
row.operator('bim.select_high_polygon_meshes')
def ifc_units(self, context):
scene = context.scene