diff --git a/src/blenderbim/blenderbim/bim/module/model/decorator.py b/src/blenderbim/blenderbim/bim/module/model/decorator.py index 584745f11d..663ec888bf 100644 --- a/src/blenderbim/blenderbim/bim/module/model/decorator.py +++ b/src/blenderbim/blenderbim/bim/module/model/decorator.py @@ -301,6 +301,8 @@ class WallPolylineDecorator: mouse_pos = None input_panel = None input_type = None + angle_snap_mat = None + angle_snap_loc = None @classmethod @@ -331,6 +333,11 @@ class WallPolylineDecorator: cls.input_panel = input_panel cls.input_type = input_type + @classmethod + def set_angle_axis_line(cls, angle_snap_mat, angle_snap_loc): + cls.angle_snap_mat = angle_snap_mat + cls.angle_snap_loc = angle_snap_loc + @classmethod def calculate_distance_and_angle(cls, context, is_input_on): try: @@ -476,9 +483,22 @@ class WallPolylineDecorator: # Line between last polyline point and mouse - edges = [[0, 1]] if snap_prop.snap_type != "Plane" and snap_prop.z != 0: self.draw_batch("LINES", [polyline_points[-1]] + projection_point, decorator_color_unselected, edges) else: self.draw_batch("LINES", [polyline_points[-1]] + mouse_point, decorator_color_unselected, edges) + + # Line for angle axis snap + print("TYPE", snap_prop.snap_type) + if snap_prop.snap_type == 'Axis': + length = 1000 + direction = Vector((1, 0, 0)) + rot_dir = self.angle_snap_mat.inverted() @ direction + start = self.angle_snap_loc + rot_dir * length + end = self.angle_snap_loc - rot_dir * length + print("START", start) + print("END", end) + self.line_shader.uniform_float("lineWidth", 1.0) + self.draw_batch("LINES", [start, end], decorator_color_unselected, [(0,1)]) + diff --git a/src/blenderbim/blenderbim/bim/module/model/wall.py b/src/blenderbim/blenderbim/bim/module/model/wall.py index d1fa81c248..e89a3c2608 100644 --- a/src/blenderbim/blenderbim/bim/module/model/wall.py +++ b/src/blenderbim/blenderbim/bim/module/model/wall.py @@ -486,7 +486,7 @@ class DrawPolylineWall(bpy.types.Operator): else: if rot_intersection: - tool.Snaping.update_snaping_point(rot_intersection, "Plane") + tool.Snaping.update_snaping_point(rot_intersection, "Axis") else: tool.Snaping.update_snaping_point(intersection, "Plane") diff --git a/src/blenderbim/blenderbim/tool/snaping.py b/src/blenderbim/blenderbim/tool/snaping.py index e69b774c64..02aa59cc34 100644 --- a/src/blenderbim/blenderbim/tool/snaping.py +++ b/src/blenderbim/blenderbim/tool/snaping.py @@ -18,6 +18,7 @@ import bpy import blenderbim.core.tool +from blenderbim.bim.module.model.decorator import WallPolylineDecorator import math import mathutils from mathutils import Matrix, Vector @@ -113,6 +114,7 @@ class Snaping(blenderbim.core.tool.Snaping): for i in range(12): angle = 30 * i rot_mat = Matrix.Rotation(math.radians(360 - angle), 3, 'Z') + WallPolylineDecorator.set_angle_axis_line(rot_mat, last_point) rot_intersection = rot_mat @ translated_intersection print("ROT_INT", rot_intersection) is_on_rot_axis = abs(rot_intersection.y) <= 0.60