mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
#1974 populate attribute map upon schema registration
This commit is contained in:
@@ -52,7 +52,7 @@ except Exception as e:
|
||||
|
||||
from . import guid
|
||||
from .file import file
|
||||
from .entity_instance import entity_instance
|
||||
from .entity_instance import entity_instance, register_schema_attributes
|
||||
|
||||
READ_ERROR = ifcopenshell_wrapper.file_open_status.READ_ERROR
|
||||
NO_HEADER = ifcopenshell_wrapper.file_open_status.NO_HEADER
|
||||
@@ -97,6 +97,7 @@ gcroot = []
|
||||
def register_schema(schema):
|
||||
gcroot.append(schema)
|
||||
ifcopenshell_wrapper.register_schema(schema.schema)
|
||||
register_schema_attributes(schema.schema)
|
||||
|
||||
|
||||
from .main import *
|
||||
|
||||
@@ -51,11 +51,12 @@ def set_derived_atribute(*args):
|
||||
# mapping is built once during initialization of the
|
||||
# module.
|
||||
_method_dict = {}
|
||||
for nm in ifcopenshell_wrapper.schema_names():
|
||||
schema = ifcopenshell_wrapper.schema_by_name(nm)
|
||||
|
||||
|
||||
def register_schema_attributes(schema):
|
||||
for decl in schema.declarations():
|
||||
if hasattr(decl, "argument_types"):
|
||||
fq_name = ".".join((nm, decl.name()))
|
||||
fq_name = ".".join((schema.name(), decl.name()))
|
||||
|
||||
# get type strings as reported by IfcOpenShell C++
|
||||
type_strs = decl.argument_types()
|
||||
@@ -81,6 +82,11 @@ for nm in ifcopenshell_wrapper.schema_names():
|
||||
_method_dict[fq_name] = functions
|
||||
|
||||
|
||||
for nm in ifcopenshell_wrapper.schema_names():
|
||||
schema = ifcopenshell_wrapper.schema_by_name(nm)
|
||||
register_schema_attributes(schema)
|
||||
|
||||
|
||||
class entity_instance(object):
|
||||
"""This is the base Python class for all IFC objects.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user