mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
black format
This commit is contained in:
committed by
Bruno Perdigão
parent
1dc6d4935e
commit
10616df494
@@ -383,7 +383,9 @@ class WallPolylineDecorator:
|
||||
second_to_last_point = None
|
||||
if len(polyline_data) > 1:
|
||||
second_to_last_point_data = polyline_data[len(polyline_data) - 2]
|
||||
second_to_last_point = Vector((second_to_last_point_data.x, second_to_last_point_data.y, second_to_last_point_data.z))
|
||||
second_to_last_point = Vector(
|
||||
(second_to_last_point_data.x, second_to_last_point_data.y, second_to_last_point_data.z)
|
||||
)
|
||||
if not second_to_last_point:
|
||||
# Creates a fake "second to last" point away from the first point but in the same x axis
|
||||
# this allows to calculate the angle relative to x axis when there is only one point
|
||||
@@ -417,7 +419,9 @@ class WallPolylineDecorator:
|
||||
second_to_last_point = None
|
||||
if len(polyline_data) > 2:
|
||||
second_to_last_point_data = polyline_data[len(polyline_data) - 2]
|
||||
second_to_last_point = Vector((second_to_last_point_data.x, second_to_last_point_data.y, second_to_last_point_data.z))
|
||||
second_to_last_point = Vector(
|
||||
(second_to_last_point_data.x, second_to_last_point_data.y, second_to_last_point_data.z)
|
||||
)
|
||||
else:
|
||||
second_to_last_point = Vector((0, 0, 0))
|
||||
|
||||
@@ -427,7 +431,9 @@ class WallPolylineDecorator:
|
||||
angle_degrees = float(cls.input_panel["A"])
|
||||
reference_vector = second_to_last_point - last_point
|
||||
reference_angle = degrees(atan2(reference_vector[1], reference_vector[0]))
|
||||
angle_radians = radians(360 - (angle_degrees - reference_angle)) # Substracting from 360 to make it clockwise
|
||||
angle_radians = radians(
|
||||
360 - (angle_degrees - reference_angle)
|
||||
) # Substracting from 360 to make it clockwise
|
||||
x = last_point[0] + distance * cos(angle_radians)
|
||||
y = last_point[1] + distance * sin(angle_radians)
|
||||
if cls.input_panel:
|
||||
@@ -465,7 +471,6 @@ class WallPolylineDecorator:
|
||||
blf.position(self.font_id, self.mouse_pos[0] + offset, self.mouse_pos[1] + offset - (new_line * i), 0)
|
||||
blf.draw(self.font_id, texts[key] + value)
|
||||
|
||||
|
||||
def __call__(self, context):
|
||||
|
||||
self.addon_prefs = tool.Blender.get_addon_preferences()
|
||||
@@ -546,7 +551,4 @@ class WallPolylineDecorator:
|
||||
self.draw_batch("LINES", [self.axis_start, self.axis_end], decorator_color_unselected, [(0, 1)])
|
||||
|
||||
if self.plane_normal:
|
||||
|
||||
self.draw_batch(
|
||||
"TRIS", [*self.axis_rectangle], (1, 1, 1, 0.1), [(0, 1, 3), (0, 2, 3)]
|
||||
)
|
||||
self.draw_batch("TRIS", [*self.axis_rectangle], (1, 1, 1, 0.1), [(0, 1, 3), (0, 2, 3)])
|
||||
|
||||
@@ -2294,7 +2294,6 @@ class MeasureTool(bpy.types.Operator):
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
bl_label = "Measure Tool"
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.space_data.type == "VIEW_3D"
|
||||
@@ -2315,7 +2314,6 @@ class MeasureTool(bpy.types.Operator):
|
||||
self.input_panel = {"X": "", "Y": "", "Z": "", "D": "", "A": ""}
|
||||
self.snap_angle = None
|
||||
|
||||
|
||||
def modal(self, context, event):
|
||||
|
||||
if event.type == "MOUSEMOVE":
|
||||
@@ -2352,17 +2350,17 @@ class MeasureTool(bpy.types.Operator):
|
||||
if event.shift and event.type == "X":
|
||||
tool.Snap.set_use_default_container(False)
|
||||
WallPolylineDecorator.set_use_default_container(False)
|
||||
tool.Snap.set_snap_plane_method('YZ')
|
||||
tool.Snap.set_snap_plane_method("YZ")
|
||||
|
||||
if event.shift and event.type == "Y":
|
||||
tool.Snap.set_use_default_container(False)
|
||||
WallPolylineDecorator.set_use_default_container(False)
|
||||
tool.Snap.set_snap_plane_method('XZ')
|
||||
tool.Snap.set_snap_plane_method("XZ")
|
||||
|
||||
if event.shift and event.type == "Z":
|
||||
tool.Snap.set_use_default_container(False)
|
||||
WallPolylineDecorator.set_use_default_container(False)
|
||||
tool.Snap.set_snap_plane_method('XY')
|
||||
tool.Snap.set_snap_plane_method("XY")
|
||||
|
||||
if event.value == "RELEASE" and event.type in {"RIGHTMOUSE", "ESC"}:
|
||||
WallPolylineDecorator.uninstall()
|
||||
@@ -2377,7 +2375,7 @@ class MeasureTool(bpy.types.Operator):
|
||||
WallPolylineDecorator.install(context)
|
||||
tool.Snap.set_use_default_container(False)
|
||||
WallPolylineDecorator.set_use_default_container(False)
|
||||
tool.Snap.set_snap_plane_method('No Plane')
|
||||
tool.Snap.set_snap_plane_method("No Plane")
|
||||
WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type)
|
||||
self.visible_objs = tool.Raycast.get_visible_objects(context)
|
||||
for obj in self.visible_objs:
|
||||
|
||||
@@ -138,7 +138,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
last_point = polyline_data[len(polyline_data) - 1]
|
||||
if (x, y, z) == (last_point.x, last_point.y, last_point.z):
|
||||
return
|
||||
|
||||
|
||||
polyline_point = bpy.context.scene.BIMModelProperties.polyline_point.add()
|
||||
polyline_point.x = x
|
||||
polyline_point.y = y
|
||||
@@ -197,8 +197,6 @@ class Snap(bonsai.core.tool.Snap):
|
||||
|
||||
return (v1, v2, v3, v4)
|
||||
|
||||
|
||||
|
||||
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||
polyline_data = bpy.context.scene.BIMModelProperties.polyline_point
|
||||
if polyline_data:
|
||||
@@ -222,7 +220,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
pivot_axis = "Y"
|
||||
if cls.snap_plane_method == "YZ":
|
||||
pivot_axis = "X"
|
||||
|
||||
|
||||
rectangle_data = create_axis_rectangle_data(last_point)
|
||||
WallPolylineDecorator.set_axis_rectangle(rectangle_data)
|
||||
for axis in snap_axis:
|
||||
@@ -282,6 +280,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
|
||||
# except Exception as e:
|
||||
# cls.update_snaping_point(snap_point[0], snap_point[1])
|
||||
|
||||
@classmethod
|
||||
def snaping_movement(cls, context, event, objs_2d_bbox):
|
||||
region = context.region
|
||||
@@ -301,7 +300,6 @@ class Snap(bonsai.core.tool.Snap):
|
||||
(offset, -offset),
|
||||
)
|
||||
|
||||
|
||||
def select_plane_method():
|
||||
if cls.snap_plane_method == "No Plane":
|
||||
camera_rotation = rv3d.view_rotation
|
||||
@@ -384,7 +382,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
WallPolylineDecorator.set_plane(plane_origin, plane_normal)
|
||||
intersection = tool.Raycast.ray_cast_to_plane(context, event, plane_origin, plane_normal)
|
||||
|
||||
if cls.snap_plane_method in {"XY", "XZ", "YZ"} :
|
||||
if cls.snap_plane_method in {"XY", "XZ", "YZ"}:
|
||||
# Locks snap into an angle axis
|
||||
if event.shift:
|
||||
rot_intersection, _, axis_start, axis_end = cls.snap_on_axis(intersection, cls.snap_angle)
|
||||
@@ -418,7 +416,6 @@ class Snap(bonsai.core.tool.Snap):
|
||||
else:
|
||||
cls.update_snaping_point(intersection, "Plane")
|
||||
|
||||
|
||||
@classmethod
|
||||
def validate_input(cls, input_number):
|
||||
grammar = """
|
||||
@@ -465,4 +462,3 @@ class Snap(bonsai.core.tool.Snap):
|
||||
return True, str(result)
|
||||
except:
|
||||
return False, "0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user