mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Use schema_identifier to get IFC4X3 schema more precisely
This commit is contained in:
@@ -237,6 +237,10 @@ def schema_by_name(
|
||||
|
||||
:param schema: Which IFC schema to use, chosen from "IFC2X3", "IFC4",
|
||||
or "IFC4X3". These refer to the ISO approved versions of IFC.
|
||||
E.g. from ``ifcopenshell.file.schema_identifier``.
|
||||
Passing ``ifcopenshell.file.schema`` also will work but may result
|
||||
in not precisely matching schema but it's only conern if you're
|
||||
using not one of the main schemas.
|
||||
:param schema_version: If you want to specify an exact version of IFC
|
||||
that may not be an ISO approved version, use this argument instead
|
||||
of ``schema``. IFC versions on technical.buildingsmart.org are
|
||||
|
||||
@@ -281,7 +281,7 @@ def get_cost_values(cost_item: ifcopenshell.entity_instance) -> list[dict[str, s
|
||||
|
||||
|
||||
def get_cost_schedule_types(file: ifcopenshell.file) -> list[dict[str, str]]:
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(file.schema)
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(file.schema_identifier)
|
||||
results = []
|
||||
declaration = schema.declaration_by_name("IfcCostSchedule")
|
||||
version = file.schema_identifier
|
||||
|
||||
@@ -113,8 +113,7 @@ def get_schema_by_name(version: str) -> ifcopenshell_wrapper.schema_definition:
|
||||
global schema_by_name
|
||||
version = ifcopenshell.util.schema.get_fallback_schema(version)
|
||||
if not schema_by_name[version]:
|
||||
schema_name = "IFC4X3_ADD2" if version == "IFC4X3" else version
|
||||
schema_by_name[version] = ifcopenshell_wrapper.schema_by_name(schema_name)
|
||||
schema_by_name[version] = ifcopenshell.schema_by_name(version)
|
||||
return schema_by_name[version]
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,7 @@ class PsetQto:
|
||||
# fmt: on
|
||||
|
||||
def __init__(self, schema_identifier: str, templates=None) -> None:
|
||||
if schema_identifier == "IFC4X3":
|
||||
schema_identifier = "IFC4X3_ADD2"
|
||||
self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_identifier)
|
||||
self.schema = ifcopenshell.schema_by_name(schema_identifier)
|
||||
if not templates:
|
||||
folder_path = pathlib.Path(__file__).parent.absolute()
|
||||
path = str(folder_path.joinpath("schema", self.templates_path[schema_identifier]))
|
||||
|
||||
Reference in New Issue
Block a user