Port locations are now auto synchronised when hiding ports

This commit is contained in:
Dion Moult
2022-05-03 16:50:55 +10:00
parent 96babc4506
commit c5773b5665
9 changed files with 54 additions and 33 deletions
+13 -4
View File
@@ -93,22 +93,31 @@ class TestSelectSystemProducts:
class TestShowPorts:
def test_run(self, system):
system.get_ports("element").should_be_called().will_return(["port"])
system.load_ports(["port"]).should_be_called()
system.load_ports("element", ["port"]).should_be_called()
system.select_elements(["port"]).should_be_called()
subject.show_ports(system, element="element")
class TestHidePorts:
def test_run(self, system):
def test_run(self, ifc, system):
ifc.get_object("element").should_be_called().will_return("obj")
ifc.is_moved("obj").should_be_called().will_return(True)
system.run_geometry_edit_object_placement(obj="obj").should_be_called()
system.get_ports("element").should_be_called().will_return(["port"])
ifc.get_object("port").should_be_called().will_return("port_obj")
ifc.is_moved("port_obj").should_be_called().will_return(True)
system.run_geometry_edit_object_placement(obj="port_obj").should_be_called()
system.delete_element_objects(["port"]).should_be_called()
subject.hide_ports(system, element="element")
subject.hide_ports(ifc, system, element="element")
class TestAddPort:
def test_run(self, ifc, system):
system.get_ports("element").should_be_called().will_return(["port"])
system.load_ports(["port"]).should_be_called()
system.load_ports("element", ["port"]).should_be_called()
system.create_empty_at_cursor_with_element_orientation("element").should_be_called().will_return("obj")
system.run_root_assign_class(obj="obj", ifc_class="IfcDistributionPort").should_be_called().will_return("port")
ifc.run("system.assign_port", element="element", port="port").should_be_called()
+8 -2
View File
@@ -177,15 +177,21 @@ class TestLoadPorts(NewFile):
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", ifc)
tool.Ifc().set(ifc)
element = ifc.createIfcChiller()
port = ifc.createIfcDistributionPort()
subject.load_ports([port])
subject.load_ports(element, [port])
obj = tool.Ifc.get_object(port)
assert obj
assert obj.users_collection
assert list(obj.location) == [0, 0, 0]
class TestRunAssignClassOperator(NewFile):
class TestRunGeometryEditObjectPlacement(NewFile):
def test_nothing(self):
pass
class TestRunRootAssignClass(NewFile):
def test_nothing(self):
pass