mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
get_info_2 to support excluding identifier
This commit is contained in:
@@ -435,7 +435,7 @@ class entity_instance:
|
||||
elif None in (self.wrapped_data.file, other.wrapped_data.file):
|
||||
# when not added to a file, we can only compare attribute values
|
||||
# and we need this for where rule evaluation
|
||||
return self.get_info(recursive=True, include_identifier=False) == other.get_info(
|
||||
return self.get_info_2(recursive=True, include_identifier=False) == other.get_info_2(
|
||||
recursive=True, include_identifier=False
|
||||
)
|
||||
else:
|
||||
@@ -632,14 +632,12 @@ class entity_instance:
|
||||
Method has exactly the same signature as `.get_info()` but it doesn't support getting information non-recursively.
|
||||
|
||||
Currently supported arguments values:
|
||||
* include_identifier: `True`
|
||||
* recursive: `True` (will fail with default `False` value from `.get_info()`)
|
||||
* return_type: `dict`
|
||||
* ignore: `()` (empty tuple)
|
||||
"""
|
||||
|
||||
assert include_identifier
|
||||
assert recursive
|
||||
assert return_type is dict
|
||||
assert len(ignore) == 0
|
||||
return ifcopenshell_wrapper.get_info_cpp(self.wrapped_data)
|
||||
return ifcopenshell_wrapper.get_info_cpp(self.wrapped_data, include_identifier)
|
||||
|
||||
@@ -58,3 +58,12 @@ class TestGetInfo2(test.bootstrap.IFC4):
|
||||
{"Coordinates": (3.0,), "id": 5, "type": "IfcCartesianPoint"},
|
||||
),
|
||||
)
|
||||
|
||||
def test_exclude_identifier(self):
|
||||
brep = self.file.create_entity("IfcFacetedBrep")
|
||||
shell = self.file.create_entity("IfcClosedShell")
|
||||
brep.Outer = shell
|
||||
assert brep.get_info_2(recursive=True, include_identifier=False) == {
|
||||
"Outer": {"CfsFaces": None, "type": "IfcClosedShell"},
|
||||
"type": "IfcFacetedBrep",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user