diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 37aa0c1dab..ae40e3b53c 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -208,6 +208,8 @@ if bpy is not None: operator.CopyPropertyToSelection, operator.CreateShapeFromStepId, operator.SelectHighPolygonMeshes, + operator.InspectFromStepId, + operator.InspectFromObject, operator.RefreshDrawingList, operator.GetRepresentationIfcParameters, operator.UpdateIfcRepresentation, @@ -241,6 +243,7 @@ if bpy is not None: prop.BcfTopicDocumentReference, prop.BcfTopicRelatedTopic, prop.Subcontext, + prop.Attribute, prop.BIMProperties, prop.BIMDebugProperties, prop.BCFProperties, @@ -248,7 +251,6 @@ if bpy is not None: prop.BIMLibrary, prop.MapConversion, prop.TargetCRS, - prop.Attribute, prop.IfcParameter, prop.BoundaryCondition, prop.PsetQto, diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index 79d94930e9..7780caca8b 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -4341,6 +4341,49 @@ class SelectHighPolygonMeshes(bpy.types.Operator): return {"FINISHED"} +class InspectFromStepId(bpy.types.Operator): + bl_idname = "bim.inspect_from_step_id" + bl_label = "Inspect From STEP ID" + step_id: bpy.props.IntProperty() + guid: bpy.props.StringProperty() + + def execute(self, context): + self.file = ifc.IfcStore.get_file() + if self.step_id: + bpy.context.scene.BIMDebugProperties.active_step_id = self.step_id + element = self.file.by_id(self.step_id) + else: + pass + while len(bpy.context.scene.BIMDebugProperties.attributes) > 0: + bpy.context.scene.BIMDebugProperties.attributes.remove(0) + while len(bpy.context.scene.BIMDebugProperties.inverse_attributes) > 0: + bpy.context.scene.BIMDebugProperties.inverse_attributes.remove(0) + for key, value in element.get_info().items(): + new = bpy.context.scene.BIMDebugProperties.attributes.add() + new.name = key + new.string_value = str(value) + if isinstance(value, ifcopenshell.entity_instance): + new.int_value = int(value.id()) + + for key in dir(element): + if not key[0].isalpha() or key[0] != key[0].upper() or key in element.get_info() or not getattr(element, key): + continue + new = bpy.context.scene.BIMDebugProperties.inverse_attributes.add() + new.name = key + new.string_value = str(getattr(element, key)) + if isinstance(value, ifcopenshell.entity_instance): + new.int_value = int(value.id()) + return {"FINISHED"} + + +class InspectFromObject(bpy.types.Operator): + bl_idname = "bim.inspect_from_object" + bl_label = "Inspect From Object" + + def execute(self, context): + return {"FINISHED"} + + class RefreshDrawingList(bpy.types.Operator): bl_idname = "bim.refresh_drawing_list" bl_label = "Refresh Drawing List" diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 54c3da6005..904c7c9162 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -1668,6 +1668,10 @@ class BIMObjectProperties(PropertyGroup): class BIMDebugProperties(PropertyGroup): step_id: IntProperty(name="STEP ID") number_of_polygons: IntProperty(name="Number of Polygons") + active_step_id: IntProperty(name="STEP ID") + step_id_breadcrumb: CollectionProperty(name="STEP ID Breadcrumb", type=StrProperty) + attributes: CollectionProperty(name="Attributes", type=Attribute) + inverse_attributes: CollectionProperty(name="Inverse Attributes", type=Attribute) class BIMMaterialProperties(PropertyGroup): diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 5cb69efbc3..ca3ecab3bf 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -2228,19 +2228,46 @@ class BIM_PT_debug(Panel): layout = self.layout scene = context.scene - bim_props = scene.BIMProperties - debug_props = scene.BIMDebugProperties + props = scene.BIMDebugProperties row = layout.row() - row.prop(debug_props, "step_id", text="") + row.prop(props, "step_id", text="") row = layout.row() row.operator("bim.create_shape_from_step_id") row = layout.row() - row.prop(debug_props, "number_of_polygons", text="") + row.prop(props, "number_of_polygons", text="") row = layout.row() row.operator("bim.select_high_polygon_meshes") + layout.label(text="Inspector:") + + row = layout.row() + row.prop(props, "active_step_id", text="") + row = layout.row(align=True) + row.operator("bim.inspect_from_step_id").step_id = bpy.context.scene.BIMDebugProperties.active_step_id + row.operator("bim.inspect_from_object") + + if props.attributes: + layout.label(text="Direct attributes:") + + for index, attribute in enumerate(props.attributes): + row = layout.row(align=True) + row.prop(attribute, "name", text="") + row.prop(attribute, "string_value", text="") + if attribute.int_value: + row.operator("bim.inspect_from_step_id", icon="DISCLOSURE_TRI_RIGHT", text="").step_id = attribute.int_value + + if props.inverse_attributes: + layout.label(text="Inverse attributes:") + + for index, attribute in enumerate(props.inverse_attributes): + row = layout.row(align=True) + row.prop(attribute, "name", text="") + row.prop(attribute, "string_value", text="") + if attribute.int_value: + row.operator("bim.inspect_from_step_id", icon="DISCLOSURE_TRI_RIGHT", text="").step_id = attribute.int_value + def ifc_units(self, context): scene = context.scene