mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Meshing: Prepare code for next 'mailleurTT' version.
parent
db87b1e214
commit
ef583fc9bb
|
|
@ -293,6 +293,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
|||
def meshing(self, reach,
|
||||
step: float = 50,
|
||||
limites=[-1, -1],
|
||||
origin=0,
|
||||
directrices=['un', 'np'],
|
||||
lplan: bool = False,
|
||||
lm: int = 3,
|
||||
|
|
@ -310,27 +311,37 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
|||
proc = QProcess()
|
||||
proc.setWorkingDirectory(tmp)
|
||||
|
||||
# Mage section index 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()} {st_file} {m_file} " +
|
||||
f"! {self._exe_path()} " +
|
||||
f"{st_file} {m_file} " +
|
||||
f"{str(step)} " +
|
||||
f"{limites[0]} {limites[1]} " +
|
||||
f"{directrices[0]} {directrices[1]} " +
|
||||
f"{lplan} {lm} {linear}"
|
||||
f"{lplan} {lm} {linear} " +
|
||||
f"mesh {origin}"
|
||||
)
|
||||
proc.start(
|
||||
self._exe_path(),
|
||||
list(map(
|
||||
list(
|
||||
map(
|
||||
str,
|
||||
[
|
||||
st_file, m_file, step,
|
||||
limites[0], limites[1],
|
||||
directrices[0], directrices[1],
|
||||
lplan, lm, linear
|
||||
lplan, lm, linear,
|
||||
"mesh", origin
|
||||
]
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
proc.waitForFinished()
|
||||
|
||||
|
|
@ -347,9 +358,9 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
|||
logger.error(
|
||||
f"{logger_color_red()}{errors}{logger_color_reset()}"
|
||||
)
|
||||
else:
|
||||
self.import_m_file(reach, m_file)
|
||||
return reach
|
||||
|
||||
self.import_m_file(reach, m_file)
|
||||
return reach
|
||||
|
||||
def export_reach_to_st(self, reach, tmp):
|
||||
|
|
|
|||
|
|
@ -560,12 +560,20 @@ class Reach(SQLSubModel):
|
|||
# Import/Export
|
||||
|
||||
def import_geometry(self, file_path_name: str):
|
||||
if file_path_name.endswith(".st"):
|
||||
ext = file_path_name.split(".")
|
||||
if len(ext) > 0:
|
||||
ext = ext[-1].lower()
|
||||
|
||||
if ext in ['st', 'm']:
|
||||
return self.import_geometry_st(file_path_name)
|
||||
elif file_path_name.endswith(".shp"):
|
||||
|
||||
if ext in ['shp']:
|
||||
return self.import_geometry_shp(file_path_name)
|
||||
else:
|
||||
return []
|
||||
|
||||
raise FileFormatError(
|
||||
file_path_name,
|
||||
f"Geometry file extention ({ext}) unkown"
|
||||
)
|
||||
|
||||
@timer
|
||||
def import_geometry_shp(self, file_path_name: str):
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class MeshingDialog(PamhyrDialog):
|
|||
self._end_cs = -1
|
||||
self._begin_dir = "un"
|
||||
self._end_dir = "np"
|
||||
self._origin = self._reach.profile(0)
|
||||
|
||||
self._init_default_values_profiles()
|
||||
self._init_default_values_guidelines()
|
||||
|
|
@ -76,7 +77,7 @@ class MeshingDialog(PamhyrDialog):
|
|||
)
|
||||
)
|
||||
)
|
||||
self.set_combobox_text("comboBox_lm", self._lm)
|
||||
self.set_combobox_text("comboBox_lm", lm_dict[self._lm])
|
||||
|
||||
if self._linear:
|
||||
self.set_radio_button("radioButton_linear", True)
|
||||
|
|
@ -88,6 +89,7 @@ class MeshingDialog(PamhyrDialog):
|
|||
|
||||
self.combobox_add_items("comboBox_begin_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_end_kp", profiles[-1])
|
||||
|
|
@ -135,6 +137,10 @@ class MeshingDialog(PamhyrDialog):
|
|||
def lplan(self):
|
||||
return self._lplan
|
||||
|
||||
@property
|
||||
def origin(self):
|
||||
return self._origin
|
||||
|
||||
@property
|
||||
def lm(self):
|
||||
return int(self._lm)
|
||||
|
|
@ -145,11 +151,11 @@ class MeshingDialog(PamhyrDialog):
|
|||
|
||||
@property
|
||||
def begin_cs(self):
|
||||
return self._begin_cs + 1
|
||||
return self._begin_cs
|
||||
|
||||
@property
|
||||
def end_cs(self):
|
||||
return self._end_cs + 1
|
||||
return self._end_cs
|
||||
|
||||
@property
|
||||
def begin_dir(self):
|
||||
|
|
@ -171,6 +177,9 @@ class MeshingDialog(PamhyrDialog):
|
|||
self._begin_cs = self.profiles.index(p1)
|
||||
self._end_cs = self.profiles.index(p2)
|
||||
|
||||
origin = self.get_combobox_text("comboBox_origin")
|
||||
self._origin = self.profiles.index(origin)
|
||||
|
||||
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
||||
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
||||
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ class GeometryTranslate(MainTranslate):
|
|||
}
|
||||
|
||||
self._sub_dict["lm_dict"] = {
|
||||
"1": _translate("Geometry", "First guideline"),
|
||||
"2": _translate("Geometry", "Second guideline"),
|
||||
"3": _translate("Geometry", "Means between the two guideline"),
|
||||
"1": _translate("Geometry", "the first guide-line"),
|
||||
"2": _translate("Geometry", "the second guide-line"),
|
||||
"3": _translate("Geometry", "the means between the two guide-lines"),
|
||||
}
|
||||
|
||||
self._sub_dict["r_lm_dict"] = {}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from PyQt5.QtWidgets import (
|
|||
)
|
||||
|
||||
from Model.Geometry import Reach
|
||||
from Model.Except import exception_message_box
|
||||
|
||||
from Meshing.Mage import MeshingWithMage
|
||||
|
||||
|
|
@ -209,8 +210,11 @@ class ImportCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
if self._profiles is None:
|
||||
try:
|
||||
self._profiles = self._reach.import_geometry(self._filename)
|
||||
self._profiles.reverse()
|
||||
except Exception as e:
|
||||
exception_message_box(e)
|
||||
else:
|
||||
for profile in self._profiles:
|
||||
self._reach.insert_profile(self._row, profile)
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ class GeometryWindow(PamhyrWindow):
|
|||
data = {
|
||||
"step": dlg.space_step,
|
||||
"limites": [dlg.begin_cs, dlg.end_cs],
|
||||
"origin" : dlg.origin,
|
||||
"directrices": [dlg.begin_dir, dlg.end_dir],
|
||||
"lplan": dlg.lplan,
|
||||
"lm": dlg.lm,
|
||||
|
|
|
|||
|
|
@ -6,14 +6,108 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>288</height>
|
||||
<width>608</width>
|
||||
<height>342</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Section space step (m)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_space_step">
|
||||
<property name="maximum">
|
||||
<double>999999.989999999990687</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>50.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Type of interpolation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_spline">
|
||||
<property name="text">
|
||||
<string>Spline</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_linear">
|
||||
<property name="text">
|
||||
<string>Linear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
@ -66,181 +160,77 @@
|
|||
</item>
|
||||
</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">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>First guide line</string>
|
||||
<string>First guide-line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_begin_gl">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last guide line</string>
|
||||
<string>Second guide-line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="comboBox_end_gl">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Section space step (m)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_space_step">
|
||||
<property name="maximum">
|
||||
<double>9999.989999999999782</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>50.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Distance computation guild line</string>
|
||||
<string>Takes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_lm">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Type of interpolation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_spline">
|
||||
<property name="text">
|
||||
<string>Spline</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_linear">
|
||||
<property name="text">
|
||||
<string>Linear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
Loading…
Reference in New Issue