This commit is contained in:
Andrej730
2025-06-18 11:37:20 +05:00
parent 8c5affaae6
commit c68b0c7280
25 changed files with 137 additions and 94 deletions
@@ -708,7 +708,7 @@ class cylinder(surface):
def matrix(self): ...
class declaration:
def _is(self, *args: str) -> bool: ...
def _is(self, *args: Union[str, declaration]) -> bool: ...
def as_entity(self) -> Union[entity, None]: ...
def as_enumeration_type(self) -> Union[enumeration_type, None]: ...
def as_select_type(self) -> Union[select_type, None]: ...
@@ -25,7 +25,8 @@ import ifcopenshell.api.control
class TestAddCostItemQuantity(test.bootstrap.IFC4):
def test_run(self):
schema = ifcopenshell.schema_by_name(self.file.schema)
quantity_types = [t.name() for t in schema.declaration_by_name("IfcPhysicalSimpleQuantity").subtypes()]
assert (entity := schema.declaration_by_name("IfcPhysicalSimpleQuantity").as_entity())
quantity_types = [t.name() for t in entity.subtypes()]
schedule = ifcopenshell.api.cost.add_cost_schedule(self.file)
item = ifcopenshell.api.cost.add_cost_item(self.file, cost_schedule=schedule)
wall = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
@@ -26,8 +26,10 @@ import ifcopenshell.util.resource
class TestAddResourceQuantity(test.bootstrap.IFC4):
def test_run(self):
schema = ifcopenshell.schema_by_name(self.file.schema)
quantity_types = [t.name() for t in schema.declaration_by_name("IfcPhysicalSimpleQuantity").subtypes()]
resource_types = [t.name() for t in schema.declaration_by_name("IfcConstructionResource").subtypes()]
assert (quantity_entity := schema.declaration_by_name("IfcPhysicalSimpleQuantity").as_entity())
quantity_types = [t.name() for t in quantity_entity.subtypes()]
assert (resource_entity := schema.declaration_by_name("IfcConstructionResource").as_entity())
resource_types = [t.name() for t in resource_entity.subtypes()]
self.file.create_entity("IfcProject") # add_resource
@@ -31,7 +31,8 @@ class TestValidateGroupTypes:
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")
declaration = schema.declaration_by_name("IfcSystem").as_entity()
assert declaration
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
ifcsystem_classes.update(d.name() for d in declarations)
@@ -227,7 +227,8 @@ class TestFormatLength(test.bootstrap.IFC4):
class TestIsAttrType(test.bootstrap.IFC4):
def test_run(self):
schema = ifcopenshell.schema_by_name("IFC4")
declaration = schema.declaration_by_name("IfcPropertySingleValue")
declaration = schema.declaration_by_name("IfcPropertySingleValue").as_entity()
assert declaration
nominal_value = declaration.attribute_by_index(2).type_of_attribute()
assert subject.is_attr_type(nominal_value, "IfcValue")
assert subject.is_attr_type(nominal_value, "IfcLengthMeasure")