diff --git a/src/bonsai/bonsai/bim/module/drawing/helper.py b/src/bonsai/bonsai/bim/module/drawing/helper.py index 123791f683..ec6e261886 100644 --- a/src/bonsai/bonsai/bim/module/drawing/helper.py +++ b/src/bonsai/bonsai/bim/module/drawing/helper.py @@ -449,5 +449,3 @@ def add_newline_between_words(text, newline_at): start = space_index + 1 # Skip the space itself return "\n".join(result) - - diff --git a/src/bonsai/bonsai/bim/module/drawing/prop.py b/src/bonsai/bonsai/bim/module/drawing/prop.py index fdc7b28160..85410f8354 100644 --- a/src/bonsai/bonsai/bim/module/drawing/prop.py +++ b/src/bonsai/bonsai/bim/module/drawing/prop.py @@ -401,7 +401,7 @@ class DocProperties(PropertyGroup): drawing_font: StringProperty(default="OpenGost Type B TT.ttf", name="Drawing Font") magic_font_scale: bpy.props.FloatProperty(default=0.004118616, name="Font Scale Factor") imperial_precision: StringProperty(default="1/32", name="Imperial Precision") - tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects") + tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects") class BIMCameraProperties(PropertyGroup): diff --git a/src/bonsai/bonsai/bim/module/georeference/decorator.py b/src/bonsai/bonsai/bim/module/georeference/decorator.py index 37af5b26c1..92a735e4fa 100644 --- a/src/bonsai/bonsai/bim/module/georeference/decorator.py +++ b/src/bonsai/bonsai/bim/module/georeference/decorator.py @@ -54,7 +54,7 @@ class GeoreferenceDecorator: def draw_batch(self, shader_type, content_pos, color, indices=None): self.scale = bpy.context.scene.BIMGeoreferenceProperties.visualization_scale - content_pos = [v * self.scale for v in content_pos] + content_pos = [v * self.scale for v in content_pos] shader = self.line_shader if shader_type == "LINES" else self.shader batch = batch_for_shader(shader, shader_type, {"pos": content_pos}, indices=indices) shader.uniform_float("color", color) @@ -75,7 +75,7 @@ class GeoreferenceDecorator: self.addon_prefs = tool.Blender.get_addon_preferences() self.font_id = 0 - font_size = tool.Blender.scale_font_size(12 + (self.scale/8)) + font_size = tool.Blender.scale_font_size(12 + (self.scale / 8)) blf.size(self.font_id, font_size) color = self.addon_prefs.decorations_colour blf.color(self.font_id, *color) diff --git a/src/bonsai/bonsai/bim/module/georeference/prop.py b/src/bonsai/bonsai/bim/module/georeference/prop.py index 74720a4a8f..863eccfd0d 100644 --- a/src/bonsai/bonsai/bim/module/georeference/prop.py +++ b/src/bonsai/bonsai/bim/module/georeference/prop.py @@ -205,7 +205,9 @@ class BIMGeoreferenceProperties(PropertyGroup): default=False, update=update_should_visualise, ) - visualization_scale: IntProperty(name="Visualization Scale", description="Affects the georeference decorator size", default=1, min=1, max=20) + visualization_scale: IntProperty( + name="Visualization Scale", description="Affects the georeference decorator size", default=1, min=1, max=20 + ) grid_north_angle: StringProperty(name="Grid North Angle", update=update_grid_north_angle) x_axis_abscissa: StringProperty(name="X Axis Abscissa", update=update_grid_north_vector) x_axis_ordinate: StringProperty(name="X Axis Ordinate", update=update_grid_north_vector) diff --git a/src/bonsai/bonsai/bim/module/model/decorator.py b/src/bonsai/bonsai/bim/module/model/decorator.py index f2143409bd..f1a3b58a7c 100644 --- a/src/bonsai/bonsai/bim/module/model/decorator.py +++ b/src/bonsai/bonsai/bim/module/model/decorator.py @@ -637,7 +637,7 @@ class PolylineDecorator: default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z projection_point = [] if not self.tool_state: - pass + pass else: if self.tool_state.plane_method: plane_origin = self.tool_state.plane_origin diff --git a/src/bonsai/bonsai/bim/module/search/operator.py b/src/bonsai/bonsai/bim/module/search/operator.py index af27becd4b..992f1cf7aa 100644 --- a/src/bonsai/bonsai/bim/module/search/operator.py +++ b/src/bonsai/bonsai/bim/module/search/operator.py @@ -719,10 +719,9 @@ class SelectSimilar(Operator, tool.Ifc.Operator): value = ifcopenshell.util.selector.get_element_value(element, key) tolerance = bpy.context.scene.DocProperties.tolerance - # Determine the number of decimal places based on the magnitude of the rounding value if tolerance < 1: - decimal_places = max(0, -int(f"{tolerance:.1e}".split('e')[-1])) # Exponent in scientific notation + decimal_places = max(0, -int(f"{tolerance:.1e}".split("e")[-1])) # Exponent in scientific notation formatted_tolerance = f"{tolerance:.{decimal_places}f}" else: formatted_tolerance = f"{tolerance:.1f}" # For values >= 1, one decimal place is enough @@ -752,7 +751,10 @@ class SelectSimilar(Operator, tool.Ifc.Operator): obj.select_set(True) elif obj_value == value: obj.select_set(True) - if isinstance(value, (int, float)): - self.report({"INFO"}, f"Selected all objects that share the same ({key}) value--within a ({formatted_tolerance}) tolerance.") + if isinstance(value, (int, float)): + self.report( + {"INFO"}, + f"Selected all objects that share the same ({key}) value--within a ({formatted_tolerance}) tolerance.", + ) else: - self.report({"INFO"}, f"Selected all objects that share the same ({key}) value") \ No newline at end of file + self.report({"INFO"}, f"Selected all objects that share the same ({key}) value") diff --git a/src/bonsai/bonsai/bim/ui.py b/src/bonsai/bonsai/bim/ui.py index e56a501d22..b1cba5c2ad 100644 --- a/src/bonsai/bonsai/bim/ui.py +++ b/src/bonsai/bonsai/bim/ui.py @@ -383,6 +383,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): row = self.layout.row() row.prop(context.scene.DocProperties, "tolerance") + # Scene panel groups class BIM_PT_tabs(Panel): bl_label = "Bonsai" diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index ac510002ef..6ebad7696f 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -927,7 +927,7 @@ class Drawing(bonsai.core.tool.Drawing): text_data = DecoratorData.get_ifc_text_data(obj) props.font_size = str(text_data["FontSize"]) - props.newline_at = text_data['Newline_At'] + props.newline_at = text_data["Newline_At"] @classmethod def import_assigned_product(cls, obj: bpy.types.Object) -> None: @@ -1715,7 +1715,6 @@ class Drawing(bonsai.core.tool.Drawing): newline_at = ifcopenshell.util.element.get_pset(element, "EPset_Annotation", "Newline_At") return newline_at - @classmethod def has_linework(cls, drawing: ifcopenshell.entity_instance) -> bool: return ifcopenshell.util.element.get_psets(drawing).get("EPset_Drawing", {}).get("HasLinework", False)