mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Polytool: added on screen snap information.
This commit is contained in:
@@ -308,6 +308,7 @@ class PolylineDecorator:
|
||||
angle_snap_loc = None
|
||||
use_default_container = False
|
||||
instructions = None
|
||||
snap_info = None
|
||||
|
||||
@classmethod
|
||||
def install(cls, context):
|
||||
@@ -360,6 +361,10 @@ class PolylineDecorator:
|
||||
def set_instructions(cls, instructions):
|
||||
cls.instructions = instructions
|
||||
|
||||
@classmethod
|
||||
def set_snap_info(cls, snap_info):
|
||||
cls.snap_info = snap_info
|
||||
|
||||
@classmethod
|
||||
def calculate_distance_and_angle(cls, context, is_input_on):
|
||||
|
||||
@@ -614,6 +619,11 @@ class PolylineDecorator:
|
||||
blf.position(self.font_id, position, 10, 0)
|
||||
blf.draw(self.font_id, self.instructions)
|
||||
|
||||
text_w, text_h = blf.dimensions(0, self.snap_info)
|
||||
position = (region.width / 2) - (text_w / 2)
|
||||
blf.position(self.font_id, position, 30, 0)
|
||||
blf.draw(self.font_id, self.snap_info)
|
||||
|
||||
|
||||
def __call__(self, context):
|
||||
|
||||
|
||||
@@ -106,6 +106,11 @@ class Snap(bonsai.core.tool.Snap):
|
||||
except:
|
||||
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_point.add()
|
||||
|
||||
info = f"""Snap: {snap_type}
|
||||
Axis:{cls.snap_axis_method}
|
||||
Plane:{cls.snap_plane_method}
|
||||
"""
|
||||
PolylineDecorator.set_snap_info(info)
|
||||
snap_vertex.x = snap_point[0]
|
||||
snap_vertex.y = snap_point[1]
|
||||
snap_vertex.z = snap_point[2]
|
||||
@@ -456,6 +461,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
|
||||
detected_snaps.append({"Plane": intersection})
|
||||
|
||||
|
||||
return detected_snaps
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user