From c4232e7407d7fa8ee998cf334c31403460d62888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 24 Sep 2024 11:40:47 -0300 Subject: [PATCH] small fix on 36b4225b1 --- src/bonsai/bonsai/bim/module/model/wall.py | 6 +++--- src/bonsai/bonsai/tool/snap.py | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index 0c72bd1646..4903f9e176 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -569,16 +569,16 @@ class DumbWallGenerator: bpy.context.scene.grease_pencil.layers.remove(layer) return objs - def create_wall_from_2_points(self, coords, round=False): + def create_wall_from_2_points(self, coords, should_round=False): direction = coords[1] - coords[0] length = direction.length - if length < 0.1: + if round(length, 4) < 0.1: return data = {"coords": coords} self.length = length self.rotation = math.atan2(direction[1], direction[0]) - if round: + if should_round: # Round to nearest 50mm (yes, metric for now) self.length = 0.05 * round(length / 0.05) # Round to nearest 5 degrees diff --git a/src/bonsai/bonsai/tool/snap.py b/src/bonsai/bonsai/tool/snap.py index 401ac0f511..0b178f400b 100644 --- a/src/bonsai/bonsai/tool/snap.py +++ b/src/bonsai/bonsai/tool/snap.py @@ -140,13 +140,11 @@ class Snap(bonsai.core.tool.Snap): for point in polyline_data[1:]: # The first can be repeated to form a wall loop if (x, y, z) == (point.x, point.y, point.z): return "Cannot create two points at the same location" - print(type(snap_vertex)) - print(type(polyline_data[-1])) # Avoids creating segments smaller then 0.1. This is a limitation from create_wall_from_2_points length = ( Vector((x, y, z)) - Vector((polyline_data[-1].x, polyline_data[-1].y, polyline_data[-1].z)) ).length - if length < 0.1: + if round(length, 4) < 0.1: return "Cannot create a segment smaller then 10cm" polyline_point = bpy.context.scene.BIMPolylineProperties.polyline_point.add()