mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Fix missing IfcDistributionCircuit and IfcElectricalCircuit #6202
When checking if element is assignable to the system.
This commit is contained in:
@@ -39,6 +39,12 @@ group_types: dict[str, tuple[str, ...]] = {
|
|||||||
"IfcSystem": ("IfcProduct",),
|
"IfcSystem": ("IfcProduct",),
|
||||||
"IfcGroup": ("IfcObjectDefinition",),
|
"IfcGroup": ("IfcObjectDefinition",),
|
||||||
}
|
}
|
||||||
|
# Subclasses.
|
||||||
|
group_types["IfcDistributionCircuit"] = group_types["IfcDistributionSystem"]
|
||||||
|
# Replaced by IfcDistributionCircuit in IFC4, though it wasn't limited to IfcDistributionElements:
|
||||||
|
# "Usage of IfcElectricalCircuit is as for the supertype IfcSystem".
|
||||||
|
group_types["IfcElectricalCircuit"] = group_types["IfcSystem"]
|
||||||
|
|
||||||
|
|
||||||
FLOW_DIRECTION = Literal["SINK", "SOURCE", "SOURCEANDSINK", "NOTEDEFINED"]
|
FLOW_DIRECTION = Literal["SINK", "SOURCE", "SOURCEANDSINK", "NOTEDEFINED"]
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,23 @@ import test.bootstrap
|
|||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import ifcopenshell.api.root
|
import ifcopenshell.api.root
|
||||||
import ifcopenshell.api.system
|
import ifcopenshell.api.system
|
||||||
|
import ifcopenshell.util.schema
|
||||||
import ifcopenshell.util.system as subject
|
import ifcopenshell.util.system as subject
|
||||||
|
from typing import get_args
|
||||||
|
|
||||||
|
|
||||||
|
class TestValidateGroupTypes:
|
||||||
|
def test_run(self):
|
||||||
|
ifcsystem_classes = set()
|
||||||
|
for schema_name in get_args(ifcopenshell.util.schema.IFC_SCHEMA):
|
||||||
|
schema = ifcopenshell.schema_by_name(schema_name)
|
||||||
|
declaration = schema.declaration_by_name("IfcSystem")
|
||||||
|
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
|
||||||
|
ifcsystem_classes.update(d.name() for d in declarations)
|
||||||
|
|
||||||
|
used_classes = set(subject.group_types)
|
||||||
|
unused_classes = ifcsystem_classes - used_classes
|
||||||
|
assert not unused_classes
|
||||||
|
|
||||||
|
|
||||||
class TestIsAssignable(test.bootstrap.IFC4):
|
class TestIsAssignable(test.bootstrap.IFC4):
|
||||||
|
|||||||
Reference in New Issue
Block a user