mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
Add select entities (2023_07_17)
This commit is contained in:
@@ -24,6 +24,7 @@ classes = (
|
|||||||
operator.SelectSpecs,
|
operator.SelectSpecs,
|
||||||
operator.SelectIfcTesterIfcFile,
|
operator.SelectIfcTesterIfcFile,
|
||||||
operator.SelectRequirement,
|
operator.SelectRequirement,
|
||||||
|
operator.SelectEntity,
|
||||||
prop.FailedEntities,
|
prop.FailedEntities,
|
||||||
prop.Specification,
|
prop.Specification,
|
||||||
prop.IfcTesterProperties,
|
prop.IfcTesterProperties,
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class ExecuteIfcTester(bpy.types.Operator):
|
|||||||
print("Finished loading:", time.time() - start)
|
print("Finished loading:", time.time() - start)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
specs.validate(ifc)
|
specs.validate(ifc)
|
||||||
|
print(specs)
|
||||||
|
|
||||||
print("Finished validating:", time.time() - start)
|
print("Finished validating:", time.time() - start)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
@@ -128,8 +129,21 @@ class SelectRequirement(bpy.types.Operator):
|
|||||||
print(failed_entities)
|
print(failed_entities)
|
||||||
for e in failed_entities:
|
for e in failed_entities:
|
||||||
new_entity = props.failed_entities.add()
|
new_entity = props.failed_entities.add()
|
||||||
new_entity.reason = e['reason']
|
|
||||||
new_entity.element = e['element']
|
new_entity.element = e['element']
|
||||||
|
new_entity.reason = e['reason']
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
class SelectEntity(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_entity"
|
||||||
|
bl_label = "Select Entity"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
ifc_id: bpy.props.IntProperty()
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
for obj in context.scene.objects:
|
||||||
|
if obj.BIMObjectProperties.ifc_definition_id == self.ifc_id:
|
||||||
|
obj.select_set(True)
|
||||||
|
bpy.context.view_layer.objects.active = obj
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -83,14 +83,16 @@ class BIM_PT_tester(Panel):
|
|||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.label(text=f" {c}. {req['description']}")
|
row.label(text=f" {c}. {req['description']}")
|
||||||
if req['status']:
|
if req['status']:
|
||||||
row.label(text="PASS")
|
row.label(text="PASS", icon="CHECKMARK")
|
||||||
else:
|
else:
|
||||||
row.label(text="FAIL")
|
row.label(text="FAIL", icon="CANCEL")
|
||||||
op = row.operator("bim.select_requirement", text="", icon="RESTRICT_SELECT_OFF")
|
op = row.operator("bim.select_requirement", text="", icon="LONGDISPLAY")
|
||||||
op.spec_index = i
|
op.spec_index = i
|
||||||
op.req_index = c - 1
|
op.req_index = c - 1
|
||||||
c += 1
|
c += 1
|
||||||
if props.has_entities:
|
if props.has_entities:
|
||||||
|
row = self.layout.row()
|
||||||
|
row.label(text = "Failed entities :")
|
||||||
self.layout.template_list(
|
self.layout.template_list(
|
||||||
"BIM_UL_tester_failed_entities",
|
"BIM_UL_tester_failed_entities",
|
||||||
"",
|
"",
|
||||||
@@ -116,9 +118,15 @@ class BIM_UL_tester_specifications(UIList):
|
|||||||
class BIM_UL_tester_failed_entities(UIList):
|
class BIM_UL_tester_failed_entities(UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
props = context.scene.IfcTesterProperties
|
props = context.scene.IfcTesterProperties
|
||||||
|
ifc_file = tool.Ifc.get()
|
||||||
if item:
|
if item:
|
||||||
icon = "WORDWRAP_ON"
|
icon = "WORDWRAP_ON"
|
||||||
|
ifc_id = int(item.element[1:item.element.find('=')])
|
||||||
|
entity = ifc_file.by_id(ifc_id)
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
|
row.label(text=f'{entity.Name} [{entity.is_a()}]')
|
||||||
row.label(text=item.reason)
|
row.label(text=item.reason)
|
||||||
row.label(text=eval(item.element).Name)
|
op = row.operator("bim.select_entity", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
|
op.ifc_id = entity.id()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user