|
| 1 | +# IfcOpenShell - IFC toolkit and geometry engine |
| 2 | +# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com> |
| 3 | +# |
| 4 | +# This file is part of IfcOpenShell. |
| 5 | +# |
| 6 | +# IfcOpenShell is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Lesser General Public License as published by |
| 8 | +# the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# IfcOpenShell is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +import pytest |
| 20 | +import test.bootstrap |
| 21 | +import ifcopenshell.api |
| 22 | +import ifcopenshell.util.system |
| 23 | + |
| 24 | + |
| 25 | +class TestUnassignSystem(test.bootstrap.IFC4): |
| 26 | + def test_unassign_system(self): |
| 27 | + element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment") |
| 28 | + element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment") |
| 29 | + element3 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment") |
| 30 | + system = ifcopenshell.api.run("system.add_system", self.file) |
| 31 | + ifcopenshell.api.run("system.assign_system", self.file, products=[element, element2, element3], system=system) |
| 32 | + ifcopenshell.api.run("system.unassign_system", self.file, products=[element2, element3], system=system) |
| 33 | + assert ifcopenshell.util.system.get_system_elements(system) == [element] |
| 34 | + |
| 35 | + ifcopenshell.api.run("system.unassign_system", self.file, products=[element], system=system) |
| 36 | + assert ifcopenshell.util.system.get_system_elements(system) == [] |
| 37 | + |
| 38 | + |
| 39 | +class TestUnassignSystemIFC2X3(test.bootstrap.IFC2X3, TestUnassignSystem): |
| 40 | + pass |
0 commit comments