mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Fix issue where "C" to close polyline where not updating measurement dimension.
This commit is contained in:
@@ -803,7 +803,23 @@ class PolylineOperator:
|
|||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
if event.value == "PRESS" and event.type == "C":
|
if event.value == "PRESS" and event.type == "C":
|
||||||
tool.Polyline.close_polyline()
|
# Get the first point coordinates to close the polyline
|
||||||
|
polyline_data = bpy.context.scene.BIMPolylineProperties.insertion_polyline
|
||||||
|
polyline_points = polyline_data[0].polyline_points if polyline_data else []
|
||||||
|
if len(polyline_points) > 2:
|
||||||
|
first_point = polyline_points[0]
|
||||||
|
last_point = polyline_points[-1]
|
||||||
|
if not (first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z):
|
||||||
|
self.input_ui.set_value("X", first_point.x)
|
||||||
|
self.input_ui.set_value("Y", first_point.y)
|
||||||
|
if self.input_ui.get_number_value("Z") is not None:
|
||||||
|
self.input_ui.set_value("Z", first_point.z)
|
||||||
|
else:
|
||||||
|
self.input_ui.set_value("Z", 0)
|
||||||
|
result = tool.Polyline.insert_polyline_point(self.input_ui, self.tool_state)
|
||||||
|
if result:
|
||||||
|
self.report({"WARNING"}, result)
|
||||||
|
|
||||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
|
|||||||
@@ -568,22 +568,6 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
total_length = tool.Polyline.format_input_ui_units(total_length)
|
total_length = tool.Polyline.format_input_ui_units(total_length)
|
||||||
polyline_data.total_length = total_length
|
polyline_data.total_length = total_length
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def close_polyline(cls) -> None:
|
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.insertion_polyline
|
|
||||||
polyline_points = polyline_data[0].polyline_points if polyline_data else []
|
|
||||||
if len(polyline_points) > 2:
|
|
||||||
first_point = polyline_points[0]
|
|
||||||
last_point = polyline_points[-1]
|
|
||||||
if not (first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z):
|
|
||||||
polyline_point = polyline_points.add()
|
|
||||||
polyline_point.x = first_point.x
|
|
||||||
polyline_point.y = first_point.y
|
|
||||||
polyline_point.z = first_point.z
|
|
||||||
polyline_point.dim = first_point.dim
|
|
||||||
polyline_point.angle = first_point.angle
|
|
||||||
polyline_point.position = first_point.position
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_polyline(cls) -> None:
|
def clear_polyline(cls) -> None:
|
||||||
bpy.context.scene.BIMPolylineProperties.insertion_polyline.clear()
|
bpy.context.scene.BIMPolylineProperties.insertion_polyline.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user