mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 12:07:59 +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
|
from pathlib import Path
|
||||||
import copy
|
import copy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||||
import ifcopenshell.util.attribute
|
import ifcopenshell.util.attribute
|
||||||
import ifcopenshell.util.schema
|
import ifcopenshell.util.schema
|
||||||
|
from typing import Optional, Literal
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import glob
|
import glob
|
||||||
@@ -58,8 +60,8 @@ IFC4x3_SPEC_URL_TEMPLATE = "https://ifc43-docs.standards.buildingsmart.org/IFC/R
|
|||||||
# child -> description
|
# child -> description
|
||||||
# note: in IFC4x3 there is no children[] for properties
|
# note: in IFC4x3 there is no children[] for properties
|
||||||
|
|
||||||
|
SUPPORTED_SCHEMA = Literal["IFC2X3", "IFC4", "IFC4X3"]
|
||||||
SCHEMA_FILES = {
|
SCHEMA_FILES: dict[SUPPORTED_SCHEMA, dict] = {
|
||||||
"IFC2X3": {
|
"IFC2X3": {
|
||||||
"entities": BASE_MODULE_PATH / "schema/ifc2x3_entities.json",
|
"entities": BASE_MODULE_PATH / "schema/ifc2x3_entities.json",
|
||||||
"properties": BASE_MODULE_PATH / "schema/ifc2x3_properties.json",
|
"properties": BASE_MODULE_PATH / "schema/ifc2x3_properties.json",
|
||||||
@@ -81,7 +83,11 @@ SCHEMA_FILES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
db = None
|
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):
|
def get_db(version):
|
||||||
@@ -103,11 +109,12 @@ def get_db(version):
|
|||||||
return db.get(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
|
global schema_by_name
|
||||||
version = ifcopenshell.util.schema.get_fallback_schema(version)
|
version = ifcopenshell.util.schema.get_fallback_schema(version)
|
||||||
if not schema_by_name[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]
|
return schema_by_name[version]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user