mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
New feature to select high polygon meshes
This commit is contained in:
@@ -200,6 +200,7 @@ if bpy is not None:
|
|||||||
operator.RemoveDrawingStyleAttribute,
|
operator.RemoveDrawingStyleAttribute,
|
||||||
operator.CopyPropertyToSelection,
|
operator.CopyPropertyToSelection,
|
||||||
operator.CreateShapeFromStepId,
|
operator.CreateShapeFromStepId,
|
||||||
|
operator.SelectHighPolygonMeshes,
|
||||||
prop.StrProperty,
|
prop.StrProperty,
|
||||||
prop.Variable,
|
prop.Variable,
|
||||||
prop.Role,
|
prop.Role,
|
||||||
|
|||||||
@@ -3963,3 +3963,24 @@ class CreateShapeFromStepId(bpy.types.Operator):
|
|||||||
obj = bpy.data.objects.new('Debug', mesh)
|
obj = bpy.data.objects.new('Debug', mesh)
|
||||||
bpy.context.scene.collection.objects.link(obj)
|
bpy.context.scene.collection.objects.link(obj)
|
||||||
return {'FINISHED'}
|
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):
|
class BIMDebugProperties(PropertyGroup):
|
||||||
step_id: IntProperty(name="STEP ID")
|
step_id: IntProperty(name="STEP ID")
|
||||||
|
number_of_polygons: IntProperty(name="Number of Polygons")
|
||||||
|
|
||||||
|
|
||||||
class BIMMaterialProperties(PropertyGroup):
|
class BIMMaterialProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -2026,6 +2026,12 @@ class BIM_PT_debug(Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator('bim.create_shape_from_step_id')
|
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):
|
def ifc_units(self, context):
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
|
|||||||
Reference in New Issue
Block a user