fix bim.assign_container uses after a9a4b0c + add TODOs

This commit is contained in:
Andrej730
2024-07-31 15:46:26 +05:00
parent 93ea1f98ac
commit 94ed0cd59c
5 changed files with 15 additions and 5 deletions
@@ -59,6 +59,7 @@ class DereferenceStructure(bpy.types.Operator, tool.Ifc.Operator):
class AssignContainer(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_container"
bl_label = "Assign Container"
bl_description = "Assign current default container to the selected objects"
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
@@ -72,6 +72,7 @@ def update_relating_container_from_object(self, context):
return
container = ifcopenshell.util.element.get_container(element)
if container:
# TODO: currently broken and relating_container_object is not used in UI.
bpy.ops.bim.assign_container(structure=container.id())
else:
bpy.ops.bim.disable_editing_container()
@@ -36,6 +36,10 @@ class BIM_PT_spatial(Panel):
return SpatialData.data["poll"]
def draw(self, context):
# TODO: expose relating_container_object so users could
# assign container without switching default container back and forth
# just for 1 operation.
if not SpatialData.is_loaded:
SpatialData.load()
+3 -2
View File
@@ -33,7 +33,8 @@ Scenario: Resize to storey
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And the variable "storey" is "tool.Ifc.get().by_type('IfcBuildingStorey')[0].id()"
And I press "bim.assign_container(structure={storey})"
And I press "bim.set_default_container(container={storey})"
And I press "bim.assign_container()"
When I press "bim.resize_to_storey(total_storeys=1)"
Then nothing happens
@@ -56,4 +57,4 @@ Scenario: Enabling and disabling IFC Sverchok
And I press "preferences.addon_enable(module="sverchok")"
And I press "preferences.addon_enable(module="ifcsverchok")"
And I press "preferences.addon_disable(module="sverchok")"
And I press "preferences.addon_disable(module="ifcsverchok")"
And I press "preferences.addon_disable(module="ifcsverchok")"
@@ -27,7 +27,8 @@ Scenario: Assign container
And the object "IfcWall/Cube" is selected
And I press "bim.enable_editing_container"
And the variable "site" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
When I press "bim.assign_container(structure={site})"
And I press "bim.set_default_container(container={site})"
When I press "bim.assign_container()"
Then the object "IfcWall/Cube" is in the collection "IfcSite/My Site"
Scenario: Copy to container
@@ -80,7 +81,8 @@ Scenario: Select container
And the object "IfcWall/Cube" is selected
And I press "bim.enable_editing_container"
And the variable "site" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
And I press "bim.assign_container(structure={site})"
And I press "bim.set_default_container(container={site})"
And I press "bim.assign_container()"
When I press "bim.select_container"
Then nothing happens
@@ -94,7 +96,8 @@ Scenario: Select similar container
And the object "IfcWall/Cube" is selected
And I press "bim.enable_editing_container"
And the variable "site" is "tool.Ifc.get().by_type('IfcSite')[0].id()"
And I press "bim.assign_container(structure={site})"
And I press "bim.set_default_container(container={site})"
And I press "bim.assign_container()"
When I press "bim.select_similar_container"
Then nothing happens