|
2 | 2 | from PyQt5 import uic |
3 | 3 | from PyQt5.QtCore import Qt |
4 | 4 |
|
| 5 | +from itertools import chain |
5 | 6 | import re |
6 | 7 | from numbers import Number |
7 | 8 | import numpy as np |
@@ -146,8 +147,8 @@ def _create_connections(self): |
146 | 147 | self.y_line_edit.editingFinished.connect(self.xyz_apply_evaluation_callback) |
147 | 148 | self.z_line_edit.editingFinished.connect(self.xyz_apply_evaluation_callback) |
148 | 149 |
|
149 | | - self.bending_options_combobox.currentIndexChanged.connect(self.xyz_changed_callback) |
150 | | - self.bending_radius_line_edit.textChanged.connect(self.xyz_changed_callback) |
| 150 | + self.bending_options_combobox.currentIndexChanged.connect(self.bending_options_changed_callback) |
| 151 | + self.bending_radius_line_edit.textChanged.connect(self.bending_options_changed_callback) |
151 | 152 |
|
152 | 153 | self.division_combobox.currentTextChanged.connect(self.division_type_changed_callback) |
153 | 154 | self.division_slider.valueChanged.connect(self.division_slider_callback) |
@@ -190,6 +191,7 @@ def selection_callback(self): |
190 | 191 | self._set_xyz_to_selected_point() |
191 | 192 |
|
192 | 193 | if not self.pipeline.selected_structures: |
| 194 | + self.pipeline.main_editor.remove_collapsed_bends() |
193 | 195 | self.cancel_division_callback() |
194 | 196 |
|
195 | 197 | self._update_permissions() |
@@ -353,6 +355,15 @@ def get_pipe_diameter(self): |
353 | 355 |
|
354 | 356 | return diameter |
355 | 357 |
|
| 358 | + def bending_options_changed_callback(self): |
| 359 | + if self.pipeline.selected_structures: |
| 360 | + self._update_bending_radius_of_selected_structures() |
| 361 | + self.update_bending_radius_visibility() |
| 362 | + self._update_permissions() |
| 363 | + self.render_widget.update_plot(reset_camera=False) |
| 364 | + else: |
| 365 | + self.xyz_changed_callback() |
| 366 | + |
356 | 367 | def xyz_changed_callback(self): |
357 | 368 | try: |
358 | 369 | self.update_bending_radius_visibility() |
@@ -607,6 +618,18 @@ def _xyz_point_callback(self, xyz): |
607 | 618 | def _update_material_of_selected_structures(self): |
608 | 619 | for structure in self.pipeline.selected_structures: |
609 | 620 | structure.extra_info["material_info"] = self.current_material_info |
| 621 | + |
| 622 | + def _update_bending_radius_of_selected_structures(self): |
| 623 | + if not isinstance(self.current_options, PipeOptions): |
| 624 | + return |
| 625 | + |
| 626 | + for structure in self.pipeline.selected_structures: |
| 627 | + if not isinstance(structure, Bend): |
| 628 | + pass |
| 629 | + bending_radius = self.pipe_options._get_bending_radius(structure.diameter) |
| 630 | + structure.curvature = bending_radius |
| 631 | + |
| 632 | + self.pipeline.recalculate_curvatures() |
610 | 633 |
|
611 | 634 | def _unit_abreviation(self, unit): |
612 | 635 | if self.length_unit == "meter": |
|
0 commit comments