MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _serialize_attribute

Function _serialize_attribute

src/ifcquery/ifcquery/info.py:168–174  ·  view source on GitHub ↗

Convert an IFC attribute value to a JSON-serializable form.

(value: Any)

Source from the content-addressed store, hash-verified

166
167
168def _serialize_attribute(value: Any) -> Any:
169 """Convert an IFC attribute value to a JSON-serializable form."""
170 if isinstance(value, ifcopenshell.entity_instance):
171 return {"id": value.id(), "type": value.is_a()}
172 if isinstance(value, tuple):
173 return [_serialize_attribute(v) for v in value]
174 return value
175
176
177def _material_to_dict(material: ifcopenshell.entity_instance | None) -> dict[str, Any] | None:

Callers 1

infoFunction · 0.85

Calls 2

idMethod · 0.45
is_aMethod · 0.45

Tested by

no test coverage detected