mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix bug where pie update container didn't work.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.core.spatial
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
@@ -67,8 +69,8 @@ class PieUpdateContainer(bpy.types.Operator):
|
||||
for collection in obj.users_collection:
|
||||
spatial_obj = bpy.data.objects.get(collection.name)
|
||||
if spatial_obj and spatial_obj.BIMObjectProperties.ifc_definition_id:
|
||||
bpy.ops.bim.assign_container(
|
||||
relating_structure=spatial_obj.BIMObjectProperties.ifc_definition_id, related_element=obj.name
|
||||
blenderbim.core.spatial.assign_container(
|
||||
tool.Ifc, tool.Collector, tool.Spatial, structure_obj=spatial_obj, element_obj=obj
|
||||
)
|
||||
break
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -24,7 +24,7 @@ classes = (
|
||||
operator.ColourByAttribute,
|
||||
operator.ColourByClass,
|
||||
operator.ColourByPset,
|
||||
operator.IfcTypeFilterSelectingAction, #Add selecting/deselecting all operator
|
||||
operator.ToggleFilterSelection,
|
||||
operator.ResetObjectColours,
|
||||
operator.SelectAttribute,
|
||||
operator.SelectGlobalId,
|
||||
|
||||
@@ -322,19 +322,22 @@ class ResetObjectColours(bpy.types.Operator):
|
||||
obj.color = (1, 1, 1, 1)
|
||||
return {"FINISHED"}
|
||||
|
||||
class IfcTypeFilterSelectingAction(bpy.types.Operator):
|
||||
|
||||
class ToggleFilterSelection(bpy.types.Operator):
|
||||
"Click to select/deselect all ifctype"
|
||||
bl_idname = "bim.ifctype_filter_selecting_action"
|
||||
bl_label = "IfcType Filter Selecting Action"
|
||||
selecting_action: bpy.props.EnumProperty(items=( ("SELECT",'Select',"") , ("DESELECT","Deselect","") ))
|
||||
bl_idname = "bim.toggle_filter_selection"
|
||||
bl_label = "Toggle Filter Selection"
|
||||
action: bpy.props.EnumProperty(items=(("SELECT", "Select", ""), ("DESELECT", "Deselect", "")))
|
||||
|
||||
def execute(self, context):
|
||||
if self.selecting_action == "SELECT":
|
||||
if self.action == "SELECT":
|
||||
self.selecting_actionbool = True
|
||||
else:
|
||||
self.selecting_actionbool = False
|
||||
for ifcelement in bpy.context.scene.BIMSearchProperties.filter_classes:
|
||||
ifcelement.is_selected = self.selecting_actionbool
|
||||
return {'FINISHED'}
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ActivateIfcTypeFilter(bpy.types.Operator):
|
||||
"It helps you to filter your selection by IFC class"
|
||||
@@ -371,8 +374,10 @@ class ActivateIfcTypeFilter(bpy.types.Operator):
|
||||
"filter_classes",
|
||||
context.scene.BIMSearchProperties,
|
||||
"filter_classes_index",
|
||||
rows = 20 if len(bpy.context.scene.BIMSearchProperties.filter_classes) > 20 else len(bpy.context.scene.BIMSearchProperties.filter_classes),
|
||||
rows=20
|
||||
if len(bpy.context.scene.BIMSearchProperties.filter_classes) > 20
|
||||
else len(bpy.context.scene.BIMSearchProperties.filter_classes),
|
||||
)
|
||||
row = self.layout.row()
|
||||
row.operator(IfcTypeFilterSelectingAction.bl_idname, text = "Select All").selecting_action = "SELECT"
|
||||
row.operator(IfcTypeFilterSelectingAction.bl_idname, text = "Deselect All").selecting_action = "DESELECT"
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.toggle_filter_selection", text="Select All").action = "SELECT"
|
||||
row.operator("bim.toggle_filter_selection", text="Deselect All").action = "DESELECT"
|
||||
|
||||
@@ -50,7 +50,7 @@ def update_is_selected(self, context):
|
||||
class BIMFilterClasses(PropertyGroup):
|
||||
name: StringProperty(name="Name")
|
||||
is_selected: BoolProperty(name="Is Selected", default=True, update=update_is_selected)
|
||||
total: IntProperty(name="Total")
|
||||
total: IntProperty(name="Total")
|
||||
unselected_objects: CollectionProperty(type=ObjProperty, name="Unfiltered Objects")
|
||||
|
||||
|
||||
|
||||
@@ -78,8 +78,10 @@ class BIM_UL_ifctype_filter(bpy.types.UIList):
|
||||
split = layout
|
||||
split.use_property_split = True
|
||||
split.use_property_decorate = False
|
||||
split.prop(item, "is_selected", text="", icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT")
|
||||
split.prop(
|
||||
item, "is_selected", text="", emboss=False, icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT"
|
||||
)
|
||||
split.prop(item, "name", text="", emboss=False, slider=True)
|
||||
split = split.column()
|
||||
split.scale_x = 0.5
|
||||
split.label(text=str(item.total))
|
||||
split.label(text=str(item.total))
|
||||
|
||||
@@ -1141,6 +1141,7 @@ class ImportPP(bpy.types.Operator, ImportHelper):
|
||||
print("Import finished in {:.2f} seconds".format(time.time() - start))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ImportMSP(bpy.types.Operator, ImportHelper):
|
||||
bl_idname = "import_msp.bim"
|
||||
bl_label = "Import MSP"
|
||||
|
||||
@@ -37,3 +37,11 @@ Scenario: Add grid
|
||||
And the object "IfcGridAxis/01" is an "IfcGridAxis"
|
||||
And the object "IfcGridAxis/02" is an "IfcGridAxis"
|
||||
And the object "IfcGridAxis/03" is an "IfcGridAxis"
|
||||
|
||||
Scenario: Pie update container
|
||||
Given an empty Blender session
|
||||
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
|
||||
Then the object "IfcSlab/Slab" is in the collection "IfcBuildingStorey/Ground Floor"
|
||||
When the object "IfcSlab/Slab" is placed in the collection "IfcBuildingStorey/Level 1"
|
||||
And I press "bim.pie_update_container"
|
||||
Then nothing happens
|
||||
|
||||
Reference in New Issue
Block a user