This commit is contained in:
Andrej730
2024-11-25 16:48:51 +05:00
parent a4145ecec2
commit fb70374876
8 changed files with 16 additions and 14 deletions
@@ -449,5 +449,3 @@ def add_newline_between_words(text, newline_at):
start = space_index + 1 # Skip the space itself
return "\n".join(result)
+1 -1
View File
@@ -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):
@@ -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)
@@ -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)
@@ -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
@@ -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")
self.report({"INFO"}, f"Selected all objects that share the same ({key}) value")
+1
View File
@@ -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"
+1 -2
View File
@@ -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)