mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
util.doc - use release schema version for IFC4X3
As it will be more like to be available in the ifcopenshell package. Related to #4565
This commit is contained in:
@@ -20,8 +20,10 @@ import json
|
||||
from pathlib import Path
|
||||
import copy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
import ifcopenshell.util.attribute
|
||||
import ifcopenshell.util.schema
|
||||
from typing import Optional, Literal
|
||||
|
||||
try:
|
||||
import glob
|
||||
@@ -58,8 +60,8 @@ IFC4x3_SPEC_URL_TEMPLATE = "https://ifc43-docs.standards.buildingsmart.org/IFC/R
|
||||
# child -> description
|
||||
# note: in IFC4x3 there is no children[] for properties
|
||||
|
||||
|
||||
SCHEMA_FILES = {
|
||||
SUPPORTED_SCHEMA = Literal["IFC2X3", "IFC4", "IFC4X3"]
|
||||
SCHEMA_FILES: dict[SUPPORTED_SCHEMA, dict] = {
|
||||
"IFC2X3": {
|
||||
"entities": BASE_MODULE_PATH / "schema/ifc2x3_entities.json",
|
||||
"properties": BASE_MODULE_PATH / "schema/ifc2x3_properties.json",
|
||||
@@ -81,7 +83,11 @@ SCHEMA_FILES = {
|
||||
}
|
||||
|
||||
db = None
|
||||
schema_by_name = {"IFC2X3": None, "IFC4": None, "IFC4X3": None}
|
||||
schema_by_name: dict[SUPPORTED_SCHEMA, Optional[ifcopenshell_wrapper.schema_definition]] = {
|
||||
"IFC2X3": None,
|
||||
"IFC4": None,
|
||||
"IFC4X3": None,
|
||||
}
|
||||
|
||||
|
||||
def get_db(version):
|
||||
@@ -103,11 +109,12 @@ def get_db(version):
|
||||
return db.get(version)
|
||||
|
||||
|
||||
def get_schema_by_name(version: str):
|
||||
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_by_name[version] = ifcopenshell.ifcopenshell_wrapper.schema_by_name(version)
|
||||
schema_name = "IFC4X3_ADD2" if version == "IFC4X3" else version
|
||||
schema_by_name[version] = ifcopenshell_wrapper.schema_by_name(schema_name)
|
||||
return schema_by_name[version]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user