UI for assigning controls to flow elements #3981

Example - https://imgur.com/a/CZQIoHp
This commit is contained in:
Andrej730
2023-11-09 17:16:32 +05:00
parent 72b3f1e967
commit fd69d91776
7 changed files with 214 additions and 0 deletions
@@ -101,3 +101,28 @@ Scenario: Select system products
And I press "bim.assign_system(system={system})"
When I press "bim.select_system_products(system={system})"
Then nothing happens
Scenario: Assign flow controls to flow element_type
Given an empty IFC project
And I add an empty
And the object "Empty" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcActuator"
And I press "bim.assign_class"
And I add an empty
And the object "Empty" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcActuator"
And I press "bim.assign_class"
And I add an empty
And the object "Empty" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcFlowSegment"
And I press "bim.assign_class"
And the object "IfcActuator/Empty" is selected
And additionally the object "IfcActuator/Empty.001" is selected
And additionally the object "IfcFlowSegment/Empty" is selected
When I press "bim.assign_unassign_flow_control(assign=True)"
And the variable "assigned_controls" is "set(tool.System.get_flow_element_controls({ifc}.by_type('IfcFlowSegment')[0]))"
Then the variable "assigned_controls" is "set[{ifc}.by_type('IfcActuator')]"
+27
View File
@@ -277,3 +277,30 @@ class TestSetActiveSystem(NewFile):
system = ifcopenshell.api.run("system.add_system", ifc, ifc_class="IfcSystem")
subject.set_active_edited_system(system)
assert bpy.context.scene.BIMSystemProperties.edited_system_id == system.id()
class TestFlowElementAndControls(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
flow_element = ifc.createIfcFlowSegment()
flow_control = ifc.createIfcController()
flow_control1 = ifc.createIfcController()
assert len(subject.get_flow_element_controls(flow_element)) == 0
assert subject.get_flow_control_flow_element(flow_control) == None
ifcopenshell.api.run(
"system.assign_flow_control",
ifc,
related_flow_control=flow_control,
relating_flow_element=flow_element,
)
ifcopenshell.api.run(
"system.assign_flow_control",
ifc,
related_flow_control=flow_control1,
relating_flow_element=flow_element,
)
controls = subject.get_flow_element_controls(flow_element)
assert set(controls) == set((flow_control, flow_control1))
assert subject.get_flow_control_flow_element(flow_control) == flow_element