mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix #6414. Allow extracting elements from non-standard IFC schemas.
This commit is contained in:
@@ -55,7 +55,7 @@ class Patcher:
|
|||||||
def patch(self):
|
def patch(self):
|
||||||
self.contained_ins: dict[str, set[ifcopenshell.entity_instance]] = {}
|
self.contained_ins: dict[str, set[ifcopenshell.entity_instance]] = {}
|
||||||
self.aggregates: dict[str, set[ifcopenshell.entity_instance]] = {}
|
self.aggregates: dict[str, set[ifcopenshell.entity_instance]] = {}
|
||||||
self.new = ifcopenshell.file(schema=self.file.schema_identifier)
|
self.new = ifcopenshell.file(schema_version=self.file.schema_version)
|
||||||
self.owner_history = None
|
self.owner_history = None
|
||||||
self.reuse_identities: dict[int, ifcopenshell.entity_instance] = {}
|
self.reuse_identities: dict[int, ifcopenshell.entity_instance] = {}
|
||||||
for owner_history in self.file.by_type("IfcOwnerHistory"):
|
for owner_history in self.file.by_type("IfcOwnerHistory"):
|
||||||
|
|||||||
@@ -75,6 +75,14 @@ class TestExtractElements(test.bootstrap.IFC4):
|
|||||||
assert output.by_type("IfcWall")
|
assert output.by_type("IfcWall")
|
||||||
assert not output.by_type("IfcSlab")
|
assert not output.by_type("IfcSlab")
|
||||||
|
|
||||||
|
def test_extracting_non_standard_schema_version(self):
|
||||||
|
self.file = ifcopenshell.file(schema_version=(4, 3, 0, 0))
|
||||||
|
project = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||||
|
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||||
|
output = ifcpatch.execute({"file": self.file, "recipe": "ExtractElements", "arguments": ["IfcWall"]})
|
||||||
|
assert output.by_type("IfcProject")[0].GlobalId == project.GlobalId
|
||||||
|
assert output.by_type("IfcWall")[0].GlobalId == wall.GlobalId
|
||||||
|
|
||||||
|
|
||||||
class TestExtractElementsIFC2X3(test.bootstrap.IFC2X3, TestExtractElements):
|
class TestExtractElementsIFC2X3(test.bootstrap.IFC2X3, TestExtractElements):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user