diff --git a/src/bonsai/bonsai/bim/module/bsdd/prop.py b/src/bonsai/bonsai/bim/module/bsdd/prop.py index d595ad8018..5103358b6e 100644 --- a/src/bonsai/bonsai/bim/module/bsdd/prop.py +++ b/src/bonsai/bonsai/bim/module/bsdd/prop.py @@ -160,7 +160,7 @@ class BIMBSDDProperties(PropertyGroup): default=False, ) classification_psets: CollectionProperty(name="Classification Psets", type=BSDDPset) - + if TYPE_CHECKING: active_dictionary: str active_dictionary: str @@ -179,7 +179,7 @@ class BIMBSDDProperties(PropertyGroup): should_filter_ifc_class: bool use_only_ifc_properties: bool classification_psets: bpy.types.bpy_prop_collection_idprop[BSDDPset] - + @property def active_class(self) -> Union[BSDDClassification, None]: return tool.Blender.get_active_uilist_element(self.classes, self.active_class_index) diff --git a/src/bonsai/bonsai/bim/module/bsdd/ui.py b/src/bonsai/bonsai/bim/module/bsdd/ui.py index f49f48abb9..c6966c01d8 100644 --- a/src/bonsai/bonsai/bim/module/bsdd/ui.py +++ b/src/bonsai/bonsai/bim/module/bsdd/ui.py @@ -83,6 +83,7 @@ class BIM_PT_bsdd(Panel): row = self.layout.row() row.operator("bim.load_bsdd_dictionaries") + class BIM_UL_bsdd_dictionaries(UIList): def draw_item( self, diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 55804498ec..66a1482acc 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -3871,7 +3871,6 @@ class AddReferenceImage(bpy.types.Operator, tool.Ifc.Operator, ImportHelper): layout.prop(self, "x_length") layout.prop(self, "y_length") - def _execute(self, context): project_props = tool.Project.get_project_props() project_props.load_indexed_maps = self.show_texture_solid_mode @@ -3900,7 +3899,7 @@ class AddReferenceImage(bpy.types.Operator, tool.Ifc.Operator, ImportHelper): unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file) hx = self.x_length * 0.5 / unit_scale hy = self.y_length * 0.5 / unit_scale - verts = [(-hx, -hy, 0.0), ( hx, -hy, 0.0), ( hx, hy, 0.0), (-hx, hy, 0.0)] + verts = [(-hx, -hy, 0.0), (hx, -hy, 0.0), (hx, hy, 0.0), (-hx, hy, 0.0)] item = builder.mesh(verts, [[0, 1, 2, 3]]) ifc_context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW") diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 9ea6ba72f5..f8389cb3af 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -897,7 +897,7 @@ class OverrideDelete(bpy.types.Operator): if not is_valid_data_block: continue - + element = tool.Ifc.get_entity(obj) if element: if tool.Geometry.is_locked(element): diff --git a/src/bonsai/bonsai/bim/ui.py b/src/bonsai/bonsai/bim/ui.py index ad1c14787d..4cacd49e42 100644 --- a/src/bonsai/bonsai/bim/ui.py +++ b/src/bonsai/bonsai/bim/ui.py @@ -658,7 +658,8 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): name="Load Test Dictionaries", description="Load dictionaries that are for testing only", default=False ) bsdd_baseurl: StringProperty( - name="bSDD API Base URL", description="Base URL for data dictionary API requests, e.g. https://api.bsdd.buildingsmart.org/api/", + name="bSDD API Base URL", + description="Base URL for data dictionary API requests, e.g. https://api.bsdd.buildingsmart.org/api/", default="https://api.bsdd.buildingsmart.org/api/", ) should_disable_undo_on_save: BoolProperty( diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index 63c876dae1..9c01ce8c20 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -1581,8 +1581,12 @@ class Blender(bonsai.core.tool.Blender): default_scale = default_dpi * default_pixel_size system = bpy.context.preferences.system system_scale = system.dpi * system.pixel_size - return (system_scale / default_scale) * base_size *platform_scale * tool.Blender.get_addon_preferences().decorator_font_scale - + return ( + (system_scale / default_scale) + * base_size + * platform_scale + * tool.Blender.get_addon_preferences().decorator_font_scale + ) @classmethod def apply_transform_as_local(cls, obj: bpy.types.Object) -> bool: diff --git a/src/bonsai/bonsai/tool/georeference.py b/src/bonsai/bonsai/tool/georeference.py index 6e39d88fe8..0c47002a36 100644 --- a/src/bonsai/bonsai/tool/georeference.py +++ b/src/bonsai/bonsai/tool/georeference.py @@ -316,7 +316,9 @@ class Georeference(bonsai.core.tool.Georeference): @classmethod def global2local(cls, matrix, is_specified_in_map_units: bool) -> tuple[float, float, float]: - matrix = ifcopenshell.util.geolocation.auto_global2local(tool.Ifc.get(), matrix, is_specified_in_map_units=is_specified_in_map_units) + matrix = ifcopenshell.util.geolocation.auto_global2local( + tool.Ifc.get(), matrix, is_specified_in_map_units=is_specified_in_map_units + ) props = cls.get_georeference_props() if props.has_blender_offset: matrix = ifcopenshell.util.geolocation.global2local( diff --git a/src/bonsai/test/tool/test_drawing.py b/src/bonsai/test/tool/test_drawing.py index 69d7fbde92..3fa2e68cae 100644 --- a/src/bonsai/test/tool/test_drawing.py +++ b/src/bonsai/test/tool/test_drawing.py @@ -162,7 +162,7 @@ class TestEditTextLiterals(NewFile): context = ifc.createIfcGeometricRepresentationSubContext(ContextType="Plan", ContextIdentifier="Annotation") item = ifc.createIfcTextLiteralWithExtent(Literal="Literal", Path="RIGHT", BoxAlignment="bottom-left") builder = ShapeBuilder(tool.Ifc.get()) - polyline = builder.polyline([(0.,0.,0.), (1.,0.,0.)]) + polyline = builder.polyline([(0.0, 0.0, 0.0), (1.0, 0.0, 0.0)]) representation = ifc.createIfcShapeRepresentation(ContextOfItems=context, Items=[item, polyline]) element.Representation.Representations = [representation] tool.Ifc.link(element, obj) diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py index a5675a4dc2..28a9f6ef49 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py @@ -36,7 +36,7 @@ def _create_offset_curve_representation( expected_type = "IfcAlignment" if not alignment.is_a(expected_type): raise TypeError(f"Expected {expected_type} but got {alignment.is_a()}") - + expected_type = "IfcPointByDistanceExpression" for offset in offsets: if not offset.is_a(expected_type): diff --git a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py index ef3c3c3ef0..578e561e79 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py +++ b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py @@ -217,7 +217,8 @@ for id in to_emit: statements.append("%s << %s" % (id, stmt)) if __name__ == "__main__": - print(r""" + print( + r""" # This file is generated by IfcOpenShell ifcexpressparser bootstrap.py from __future__ import annotations @@ -256,4 +257,6 @@ if __name__ == "__main__": mdl = importlib.import_module(output) mdl.Generator(m).emit() sys.stdout.write(m.schema.name) -""" % ("\n ".join(statements))) +""" + % ("\n ".join(statements)) + ) diff --git a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py index d7595ad6cb..e017c03d7a 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py +++ b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py @@ -363,18 +363,24 @@ class EarlyBoundCodeWriter: ) ) - self.statements[self.statements.index("{factory_placeholder}")] = """ + self.statements[self.statements.index("{factory_placeholder}")] = ( + """ class %(schema_name)s_instance_factory : public IfcParse::instance_factory { virtual IfcUtil::IfcBaseClass* operator()(const IfcParse::declaration* decl, IfcEntityInstanceData&& data) const { %(instance_mapping)s } }; -""" % locals() +""" + % locals() + ) "" - self.statements[self.statements.index("{string_pool_placeholder}")] = """ + self.statements[self.statements.index("{string_pool_placeholder}")] = ( + """ const std::string strings[] = {%s}; -""" % ",".join(map(lambda s: '"%s"s' % s, self.strings)) +""" + % ",".join(map(lambda s: '"%s"s' % s, self.strings)) + ) def __str__(self): return "\n".join(self.statements) diff --git a/src/ifcopenshell-python/test/util/test_selector.py b/src/ifcopenshell-python/test/util/test_selector.py index 3c94876a66..b8302e0f4a 100644 --- a/src/ifcopenshell-python/test/util/test_selector.py +++ b/src/ifcopenshell-python/test/util/test_selector.py @@ -54,7 +54,7 @@ class TestFormat(test.bootstrap.IFC4): def test_number_formatting(self): assert subject.format("round(123, 5)") == "125" assert subject.format('round("123", 5)') == "125" - assert subject.format('round(-123, 5)') == "-125" + assert subject.format("round(-123, 5)") == "-125" assert subject.format("int(123.123)") == "123" assert subject.format("int(123)") == "123" assert subject.format("number(123)") == "123" @@ -79,14 +79,14 @@ class TestFormat(test.bootstrap.IFC4): assert subject.format('imperial_length(3.0, 4, "foot", "foot", False)') == "3' - 0\"" def test_variable_formatting(self): - assert subject.format('{{undefined}}') is None - assert subject.format('upper({{undefined}})') == "NONE" - assert subject.format('int({{undefined}})') == "0" + assert subject.format("{{undefined}}") is None + assert subject.format("upper({{undefined}})") == "NONE" + assert subject.format("int({{undefined}})") == "0" element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") - assert subject.format('{{undefined}}', element) is None - assert subject.format('{{class}}', element) == "IfcWall" - assert subject.format('{{ class }}', element) == "IfcWall" - assert subject.format('upper({{ class }})', element) == "IFCWALL" + assert subject.format("{{undefined}}", element) is None + assert subject.format("{{class}}", element) == "IfcWall" + assert subject.format("{{ class }}", element) == "IfcWall" + assert subject.format("upper({{ class }})", element) == "IFCWALL" def test_list_formatting(self): element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") @@ -98,17 +98,17 @@ class TestFormat(test.bootstrap.IFC4): layer = ifcopenshell.api.material.add_layer(self.file, layer_set=material_set, material=material2) layer = ifcopenshell.api.material.add_layer(self.file, layer_set=material_set, material=material3) ifcopenshell.api.material.assign_material(self.file, products=[element], material=material_set) - assert subject.format('{{materials.Name}}', element) == "CON01, CON03, CON02" - assert subject.format('sort({{materials.Name}})', element) == "CON01, CON02, CON03" - assert subject.format('reverse({{materials.Name}})', element) == "CON02, CON03, CON01" + assert subject.format("{{materials.Name}}", element) == "CON01, CON03, CON02" + assert subject.format("sort({{materials.Name}})", element) == "CON01, CON02, CON03" + assert subject.format("reverse({{materials.Name}})", element) == "CON02, CON03, CON01" assert subject.format('join("-", {{materials.Name}})', element) == "CON01-CON03-CON02" def test_expressions(self): - assert subject.format('2+3') == "5" - assert subject.format('-2+3') == "1" - assert subject.format('2-3') == "-1" - assert subject.format('3*2') == "6" - assert subject.format('3/2') == "1.5" + assert subject.format("2+3") == "5" + assert subject.format("-2+3") == "1" + assert subject.format("2-3") == "-1" + assert subject.format("3*2") == "6" + assert subject.format("3/2") == "1.5" class TestGetElementValue(test.bootstrap.IFC4):