mirror of https://gitlab.com/pamhyr/pamhyr2
restructure meshing
parent
9d0168a9ee
commit
9e79178d0f
|
|
@ -297,7 +297,8 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
directrices=['un', 'np'],
|
directrices=['un', 'np'],
|
||||||
lplan: bool = False,
|
lplan: bool = False,
|
||||||
lm: int = 3,
|
lm: int = 3,
|
||||||
linear: bool = False):
|
linear: bool = False,
|
||||||
|
origin_value = 0.0):
|
||||||
if reach is None or len(reach.profiles) == 0:
|
if reach is None or len(reach.profiles) == 0:
|
||||||
return reach
|
return reach
|
||||||
|
|
||||||
|
|
@ -320,11 +321,12 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
logger.info(
|
logger.info(
|
||||||
f"! {self._exe_path()} " +
|
f"! {self._exe_path()} " +
|
||||||
f"{st_file} {m_file} " +
|
f"{st_file} {m_file} " +
|
||||||
|
f"mesh " +
|
||||||
f"{str(step)} " +
|
f"{str(step)} " +
|
||||||
f"{limites[0]} {limites[1]} " +
|
f"{limites[0]} {limites[1]} " +
|
||||||
f"{directrices[0]} {directrices[1]} " +
|
f"{directrices[0]} {directrices[1]} " +
|
||||||
f"{lplan} {lm} {linear} " +
|
f"{lplan} {lm} {linear} " +
|
||||||
f"mesh {origin}"
|
f"{origin} "
|
||||||
)
|
)
|
||||||
proc.start(
|
proc.start(
|
||||||
self._exe_path(),
|
self._exe_path(),
|
||||||
|
|
@ -332,11 +334,86 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
map(
|
map(
|
||||||
str,
|
str,
|
||||||
[
|
[
|
||||||
st_file, m_file, step,
|
st_file, m_file,
|
||||||
|
"mesh", step,
|
||||||
limites[0], limites[1],
|
limites[0], limites[1],
|
||||||
directrices[0], directrices[1],
|
directrices[0], directrices[1],
|
||||||
lplan, lm, linear,
|
lplan, lm, linear, origin, origin_value
|
||||||
"mesh", origin
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
proc.waitForFinished()
|
||||||
|
|
||||||
|
if proc.exitCode() != 0:
|
||||||
|
logger.error(
|
||||||
|
f"{logger_color_red()}" +
|
||||||
|
f"MailleurTT error: {proc.exitCode()}" +
|
||||||
|
f"{logger_color_reset()}"
|
||||||
|
)
|
||||||
|
outputs = proc.readAllStandardOutput()
|
||||||
|
logger.debug(outputs)
|
||||||
|
|
||||||
|
errors = proc.readAllStandardError()
|
||||||
|
logger.error(
|
||||||
|
f"{logger_color_red()}{errors}{logger_color_reset()}"
|
||||||
|
)
|
||||||
|
return reach
|
||||||
|
|
||||||
|
self.import_m_file(reach, m_file)
|
||||||
|
return reach
|
||||||
|
|
||||||
|
def update_kp(self, reach,
|
||||||
|
step: float = 50,
|
||||||
|
limites=[-1, -1],
|
||||||
|
origin=0,
|
||||||
|
directrices=['un', 'np'],
|
||||||
|
lplan: bool = False,
|
||||||
|
lm: int = 3,
|
||||||
|
linear: bool = False,
|
||||||
|
origin_value = 0.0):
|
||||||
|
if reach is None or len(reach.profiles) == 0:
|
||||||
|
return reach
|
||||||
|
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
logger.debug(f"temp file: {tmp}")
|
||||||
|
st_file = self.export_reach_to_st(reach, tmp)
|
||||||
|
m_file = st_file.rsplit(".ST", 1)[0] + ".M"
|
||||||
|
|
||||||
|
os.sync()
|
||||||
|
|
||||||
|
proc = QProcess()
|
||||||
|
proc.setWorkingDirectory(tmp)
|
||||||
|
|
||||||
|
# Mage section indices start at 1
|
||||||
|
origin += 1
|
||||||
|
limites[0] += 1
|
||||||
|
limites[1] += 1
|
||||||
|
|
||||||
|
lplan = 1 if lplan else 0
|
||||||
|
linear = 1 if linear else 0
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
f"! {self._exe_path()} " +
|
||||||
|
f"{st_file} {m_file} " +
|
||||||
|
f"update_kp " +
|
||||||
|
f"{str(step)} " +
|
||||||
|
f"{limites[0]} {limites[1]} " +
|
||||||
|
f"{directrices[0]} {directrices[1]} " +
|
||||||
|
f"{lplan} {lm} {linear} " +
|
||||||
|
f"{origin} "
|
||||||
|
)
|
||||||
|
proc.start(
|
||||||
|
self._exe_path(),
|
||||||
|
list(
|
||||||
|
map(
|
||||||
|
str,
|
||||||
|
[
|
||||||
|
st_file, m_file,
|
||||||
|
"update_kp", step,
|
||||||
|
limites[0], limites[1],
|
||||||
|
directrices[0], directrices[1],
|
||||||
|
lplan, lm, linear, origin, origin_value
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -68,17 +68,6 @@ class MeshingDialog(PamhyrDialog):
|
||||||
self._space_step
|
self._space_step
|
||||||
)
|
)
|
||||||
|
|
||||||
lm_dict = self._trad.get_dict("lm_dict")
|
|
||||||
self.combobox_add_items(
|
|
||||||
"comboBox_lm", list(
|
|
||||||
map(
|
|
||||||
lambda x: lm_dict[x],
|
|
||||||
["1", "2", "3"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self.set_combobox_text("comboBox_lm", lm_dict[self._lm])
|
|
||||||
|
|
||||||
if self._linear:
|
if self._linear:
|
||||||
self.set_radio_button("radioButton_linear", True)
|
self.set_radio_button("radioButton_linear", True)
|
||||||
else:
|
else:
|
||||||
|
|
@ -89,7 +78,6 @@ class MeshingDialog(PamhyrDialog):
|
||||||
|
|
||||||
self.combobox_add_items("comboBox_begin_kp", profiles)
|
self.combobox_add_items("comboBox_begin_kp", profiles)
|
||||||
self.combobox_add_items("comboBox_end_kp", profiles)
|
self.combobox_add_items("comboBox_end_kp", profiles)
|
||||||
self.combobox_add_items("comboBox_origin", profiles)
|
|
||||||
|
|
||||||
self.set_combobox_text("comboBox_begin_kp", profiles[0])
|
self.set_combobox_text("comboBox_begin_kp", profiles[0])
|
||||||
self.set_combobox_text("comboBox_end_kp", profiles[-1])
|
self.set_combobox_text("comboBox_end_kp", profiles[-1])
|
||||||
|
|
@ -120,8 +108,8 @@ class MeshingDialog(PamhyrDialog):
|
||||||
gl, _ = self._reach.compute_guidelines()
|
gl, _ = self._reach.compute_guidelines()
|
||||||
gl = list(gl)
|
gl = list(gl)
|
||||||
|
|
||||||
bgl = ['un'] + gl
|
bgl = ['un'] + gl + ['np']
|
||||||
egl = gl + ['np']
|
egl = ['un'] + gl + ['np']
|
||||||
|
|
||||||
self.combobox_add_items("comboBox_begin_gl", bgl)
|
self.combobox_add_items("comboBox_begin_gl", bgl)
|
||||||
self.combobox_add_items("comboBox_end_gl", egl)
|
self.combobox_add_items("comboBox_end_gl", egl)
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,19 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
MeshingCommand(
|
MeshingCommand(
|
||||||
self._data, mesher, data
|
self._data, mesher, data, "mesh"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
|
def update_kp(self, mesher, data):
|
||||||
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
|
self._undo.push(
|
||||||
|
MeshingCommand(
|
||||||
|
self._data, mesher, data, "update_kp"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,12 +222,13 @@ class ImportCommand(QUndoCommand):
|
||||||
|
|
||||||
|
|
||||||
class MeshingCommand(QUndoCommand):
|
class MeshingCommand(QUndoCommand):
|
||||||
def __init__(self, reach, mesher, data):
|
def __init__(self, reach, mesher, data, command):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._reach = reach
|
self._reach = reach
|
||||||
self._data = data
|
self._data = data
|
||||||
self._mesher = mesher
|
self._mesher = mesher
|
||||||
|
self._command = command
|
||||||
|
|
||||||
self._profiles = reach.profiles.copy()
|
self._profiles = reach.profiles.copy()
|
||||||
self._profiles.reverse()
|
self._profiles.reverse()
|
||||||
|
|
@ -242,6 +243,12 @@ class MeshingCommand(QUndoCommand):
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
if self._new_profiles is None:
|
if self._new_profiles is None:
|
||||||
|
if self._command == "update_kp":
|
||||||
|
self._mesher.update_kp(
|
||||||
|
self._reach,
|
||||||
|
**self._data
|
||||||
|
)
|
||||||
|
else:
|
||||||
self._mesher.meshing(
|
self._mesher.meshing(
|
||||||
self._reach,
|
self._reach,
|
||||||
**self._data
|
**self._data
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ from View.Geometry.PlotXY import PlotXY
|
||||||
from View.Geometry.PlotAC import PlotAC
|
from View.Geometry.PlotAC import PlotAC
|
||||||
from View.Geometry.PlotKPZ import PlotKPZ
|
from View.Geometry.PlotKPZ import PlotKPZ
|
||||||
from View.Geometry.MeshingDialog import MeshingDialog
|
from View.Geometry.MeshingDialog import MeshingDialog
|
||||||
|
from View.Geometry.UpdateKPDialog import UpdateKPDialog
|
||||||
from View.Geometry.Translate import GeometryTranslate
|
from View.Geometry.Translate import GeometryTranslate
|
||||||
from View.Geometry.Profile.Window import ProfileWindow
|
from View.Geometry.Profile.Window import ProfileWindow
|
||||||
|
|
||||||
|
|
@ -321,10 +322,36 @@ class GeometryWindow(PamhyrWindow):
|
||||||
src_except=e
|
src_except=e
|
||||||
)
|
)
|
||||||
|
|
||||||
pyqtSlot(bool)
|
def update_kp(self):
|
||||||
|
try:
|
||||||
|
dlg = UpdateKPDialog(
|
||||||
|
reach=self._reach,
|
||||||
|
trad=self._trad,
|
||||||
|
parent=self
|
||||||
|
)
|
||||||
|
if dlg.exec():
|
||||||
|
data = {
|
||||||
|
"origin": dlg.origin,
|
||||||
|
"directrices": [dlg.begin_dir, dlg.end_dir],
|
||||||
|
"origin_value": dlg.origin_value,
|
||||||
|
}
|
||||||
|
self._update_kp(data)
|
||||||
|
except Exception as e:
|
||||||
|
logger_exception(e)
|
||||||
|
return
|
||||||
|
|
||||||
def changed_profile_slot(self, status):
|
def _update_kp(self, data):
|
||||||
self.update_view1 = status
|
try:
|
||||||
|
mesher = MeshingWithMageMailleurTT()
|
||||||
|
self._table.update_kp(mesher, data)
|
||||||
|
except Exception as e:
|
||||||
|
logger_exception(e)
|
||||||
|
raise ExternFileMissingError(
|
||||||
|
module="mage",
|
||||||
|
filename="MailleurTT",
|
||||||
|
path=MeshingWithMageMailleurTT._path(),
|
||||||
|
src_except=e
|
||||||
|
)
|
||||||
|
|
||||||
def plot_xy(self):
|
def plot_xy(self):
|
||||||
self.tableView.model().blockSignals(True)
|
self.tableView.model().blockSignals(True)
|
||||||
|
|
@ -509,9 +536,6 @@ class GeometryWindow(PamhyrWindow):
|
||||||
self._table.move_down(row)
|
self._table.move_down(row)
|
||||||
self.select_current_profile()
|
self.select_current_profile()
|
||||||
|
|
||||||
def update_kp(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def purge(self):
|
def purge(self):
|
||||||
self._table.purge()
|
self._table.purge()
|
||||||
self.update_redraw()
|
self.update_redraw()
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>608</width>
|
<width>520</width>
|
||||||
<height>342</height>
|
<height>341</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
@ -108,6 +108,49 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Distance computation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Second guide-line</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>First guide-line</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_end_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_begin_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
@ -115,8 +158,6 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
|
@ -137,7 +178,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
|
|
@ -159,78 +200,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
|
||||||
<property name="title">
|
|
||||||
<string>Distance computation</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>Original section</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_origin"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>First guide-line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_begin_gl">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Second guide-line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBox_end_gl">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Takes</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_lm">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue