From 0eb987fc0759c46c0a2babefe108442fe39d2ea0 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 12 Jan 2025 22:43:41 +1100 Subject: [PATCH] Black --- src/bonsai/bonsai/bim/module/model/prop.py | 4 +++- .../ifcopenshell/api/unit/add_derived_unit.py | 21 +++++++++++-------- src/ifctester/ifctester/facet.py | 13 ++++++++++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/prop.py b/src/bonsai/bonsai/bim/module/model/prop.py index 4325a3e9fb..afc93db5d3 100644 --- a/src/bonsai/bonsai/bim/module/model/prop.py +++ b/src/bonsai/bonsai/bim/module/model/prop.py @@ -167,7 +167,9 @@ class BIMModelProperties(PropertyGroup): rl2: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for windows") # Used for plan calculation points such as in room generation rl3: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for space calculation") - x_angle: bpy.props.FloatProperty(name="X Angle", default=0, subtype="ANGLE", min=math.radians(-180), max=math.radians(180), update=update_x_angle) + x_angle: bpy.props.FloatProperty( + name="X Angle", default=0, subtype="ANGLE", min=math.radians(-180), max=math.radians(180), update=update_x_angle + ) type_page: bpy.props.IntProperty(name="Type Page", default=1, update=update_type_page) type_name: bpy.props.StringProperty(name="Name", default="TYPEX") boundary_class: bpy.props.EnumProperty(items=get_boundary_class, name="Boundary Class") diff --git a/src/ifcopenshell-python/ifcopenshell/api/unit/add_derived_unit.py b/src/ifcopenshell-python/ifcopenshell/api/unit/add_derived_unit.py index 90271acb4f..8a68e5727f 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/unit/add_derived_unit.py +++ b/src/ifcopenshell-python/ifcopenshell/api/unit/add_derived_unit.py @@ -20,7 +20,9 @@ import ifcopenshell.util.unit from typing import Any, Optional -def add_derived_unit(file: ifcopenshell.file, unit_type: str, userdefinedtype : str, attributes: dict[ifcopenshell.entity_instance, int]) -> ifcopenshell.entity_instance: +def add_derived_unit( + file: ifcopenshell.file, unit_type: str, userdefinedtype: str, attributes: dict[ifcopenshell.entity_instance, int] +) -> ifcopenshell.entity_instance: """Add a new Derive unit The supported types are ANGULARVELOCITYUNIT, AREADENSITYUNIT, COMPOUNDPLANEANGLEUNIT, @@ -68,13 +70,14 @@ def add_derived_unit(file: ifcopenshell.file, unit_type: str, userdefinedtype : """ settings = {"unit_type": unit_type, "attributes": attributes} - + derive_unit_elements = [] - for named_unit in settings['attributes']: - derive_unit_elements.append(file.create_entity("IfcDerivedUnitElement", Unit=named_unit, Exponent = settings['attributes'][named_unit])) - - return file.create_entity("IfcDerivedUnit", - Elements = derive_unit_elements, - UnitType=settings["unit_type"], - UserDefinedType=userdefinedtype) + for named_unit in settings["attributes"]: + derive_unit_elements.append( + file.create_entity("IfcDerivedUnitElement", Unit=named_unit, Exponent=settings["attributes"][named_unit]) + ) + + return file.create_entity( + "IfcDerivedUnit", Elements=derive_unit_elements, UnitType=settings["unit_type"], UserDefinedType=userdefinedtype + ) diff --git a/src/ifctester/ifctester/facet.py b/src/ifctester/ifctester/facet.py index fd23006b43..15562454f1 100644 --- a/src/ifctester/ifctester/facet.py +++ b/src/ifctester/ifctester/facet.py @@ -998,8 +998,17 @@ class Restriction: for constraint, value in self.options.items(): value = [value] if not isinstance(value, list) else value for v in value: - if constraint in ["length", "minLength", "maxLength", "maxExclusive", "maxInclusive", - "minExclusive", "minInclusive", "totalDigits", "fractionDigits"]: + if constraint in [ + "length", + "minLength", + "maxLength", + "maxExclusive", + "maxInclusive", + "minExclusive", + "minInclusive", + "totalDigits", + "fractionDigits", + ]: value_dict = {"@value": v} else: value_dict = {"@value": str(v)}