Bump binary versions in makefiles; add backwards compatibility to logger usage in python #8167

This commit is contained in:
Thomas Krijnen
2026-06-15 09:56:36 +02:00
parent 22707fa534
commit 6a6756de66
10 changed files with 70 additions and 39 deletions
@@ -145,7 +145,8 @@ class configuration:
config.set(
"snippets",
"print all wall ids",
self.config_encode("""
self.config_encode(
"""
###########################################################################
# A simple script that iterates over all walls in the current model #
# and prints their Globally unique IDs (GUIDS) to the console window #
@@ -153,13 +154,15 @@ class configuration:
for wall in model.by_type("IfcWall"):
print ("wall with global id: "+str(wall.GlobalId))
""".lstrip()),
""".lstrip()
),
)
config.set(
"snippets",
"print properties of current selection",
self.config_encode("""
self.config_encode(
"""
###########################################################################
# A simple script that iterates over all IfcPropertySets of the currently #
# selected object and prints them to the console #
@@ -177,7 +180,8 @@ if selection:
for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties:
print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue))
print ("\\n")
""".lstrip()),
""".lstrip()
),
)
with open(conf_file, "w") as configfile:
config.write(configfile)
@@ -302,8 +302,8 @@ class iterator(ifcopenshell_wrapper.Iterator):
logger=None,
):
self.settings = settings
if logger is None:
logger = ifcopenshell_wrapper.logger.Root()
if logger is None and (logger_type := getattr(ifcopenshell_wrapper, "logger", None)):
logger = logger_type.Root()
if isinstance(file_or_filename, file):
self.file = file
file_or_filename = file_or_filename.wrapped_data
@@ -336,19 +336,18 @@ class iterator(ifcopenshell_wrapper.Iterator):
else:
initializer = ifcopenshell_wrapper.construct_iterator_with_include_exclude
self.this = initializer(
args = (
geometry_library,
self.settings,
file_or_filename,
include_or_exclude,
include is not None,
num_threads,
logger,
)
self.this = initializer(*args, *((logger,) if logger is not None else ()))
else:
self.this = ifcopenshell_wrapper.construct_iterator(
geometry_library, self.settings, file_or_filename, num_threads, logger
)
args = (geometry_library, self.settings, file_or_filename, num_threads)
self.this = ifcopenshell_wrapper.construct_iterator(*args, *((logger,) if logger is not None else ()))
if has_occ:
@@ -517,7 +516,11 @@ def create_shape(
return wrap_shape_creation(
settings,
ifcopenshell_wrapper.create_shape(
settings, inst.wrapped_data, repr.wrapped_data if repr is not None else None, geometry_library, *(filter(None, (logger,)))
settings,
inst.wrapped_data,
repr.wrapped_data if repr is not None else None,
geometry_library,
*((logger,) if logger is not None else ()),
),
)