mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 04:09:58 +00:00
util.element: read property sets inside an IfcPropertySetDefinitionSet (#6330)
get_pset and get_psets assumed RelatingPropertyDefinition is a single property
definition and read definition.Name directly. When it is an
IfcPropertySetDefinitionSet (a defined type wrapping a list of property set
definitions) that attribute access raised AttributeError, so an element whose
psets are grouped in a set returned none of them.
Unpack IfcPropertySetDefinitionSet into its members in both loops and process
each one. Single property definitions and the psets_only and qtos_only filters
are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit a3950ac191)
This commit is contained in:
committed by
Dion Moult
parent
af762ca810
commit
c4609a634c
@@ -112,8 +112,14 @@ def get_pset(
|
|||||||
for relationship in is_defined_by:
|
for relationship in is_defined_by:
|
||||||
if relationship.is_a("IfcRelDefinesByProperties"):
|
if relationship.is_a("IfcRelDefinesByProperties"):
|
||||||
definition = relationship.RelatingPropertyDefinition
|
definition = relationship.RelatingPropertyDefinition
|
||||||
if definition.Name == name:
|
# IfcPropertySetDefinitionSet is a defined type wrapping a list
|
||||||
pset = definition
|
# of property set definitions, so unpack it into its members.
|
||||||
|
if definition.is_a("IfcPropertySetDefinitionSet"):
|
||||||
|
definitions = definition.wrappedValue
|
||||||
|
else:
|
||||||
|
definitions = (definition,)
|
||||||
|
pset = next((d for d in definitions if d.Name == name), None)
|
||||||
|
if pset:
|
||||||
break
|
break
|
||||||
|
|
||||||
if pset:
|
if pset:
|
||||||
@@ -221,15 +227,22 @@ def get_psets(
|
|||||||
for relationship in is_defined_by:
|
for relationship in is_defined_by:
|
||||||
if relationship.is_a("IfcRelDefinesByProperties"):
|
if relationship.is_a("IfcRelDefinesByProperties"):
|
||||||
definition = relationship.RelatingPropertyDefinition
|
definition = relationship.RelatingPropertyDefinition
|
||||||
if (
|
# IfcPropertySetDefinitionSet is a defined type wrapping a list
|
||||||
psets_only
|
# of property set definitions, so unpack it into its members.
|
||||||
and not definition.is_a("IfcPropertySet")
|
if definition.is_a("IfcPropertySetDefinitionSet"):
|
||||||
and not definition.is_a("IfcPreDefinedPropertySet")
|
definitions = definition.wrappedValue
|
||||||
):
|
else:
|
||||||
continue
|
definitions = (definition,)
|
||||||
if qtos_only and not definition.is_a("IfcElementQuantity"):
|
for definition in definitions:
|
||||||
continue
|
if (
|
||||||
psets.setdefault(definition.Name, {}).update(get_property_definition(definition, verbose=verbose))
|
psets_only
|
||||||
|
and not definition.is_a("IfcPropertySet")
|
||||||
|
and not definition.is_a("IfcPreDefinedPropertySet")
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
if qtos_only and not definition.is_a("IfcElementQuantity"):
|
||||||
|
continue
|
||||||
|
psets.setdefault(definition.Name, {}).update(get_property_definition(definition, verbose=verbose))
|
||||||
return psets
|
return psets
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user