Geometry: Add meshing action with mage internal meshing functions.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-12-20 11:36:46 +01:00
1 parent e965e2b4c1
commit 097b5eb7fc
6 files changed
+313 -12

No files matched your search

+29 -12
View File
@@ -247,6 +247,11 @@ class Reach(SQLSubModel):
self._update_profile_numbers()
self._status.modified()
def purge(self):
self._profiles = []
self._update_profile_numbers()
self._status.modified()
def move_up_profile(self, index: int):
if index < len(self.profiles):
next = index - 1
@@ -525,6 +530,8 @@ class Reach(SQLSubModel):
list_header = []
stop_code = "999.999"
logger.debug(f"Import geometry from {filename}")
with open(filename, encoding="utf-8") as file_st:
for line in file_st:
if not (line.startswith("#") or line.startswith("*")):
@@ -563,21 +570,31 @@ class Reach(SQLSubModel):
# TODO: Move this function to model reach
def export_reach(self, filename):
with open(f"{filename}", "w") as file_st:
for index in range(len(self.profiles)):
profile = self.profiles[index]
with open(f"{filename}", "w") as st:
cnt = 0
for profile in self.profiles:
num = f"{cnt:>6}"
c1 = f"{profile.code1:>6}"
c2 = f"{profile.code2:>6}"
t = f"{len(profile.points):>6}"
kp = f"{profile.kp:>12f}"[0:12]
pname = profile.name
if profile.name == "":
pname = f"p{profile.id:>3}".replace(" ", "0")
for v in profile.header:
file_st.write(f"{v:>6}")
file_st.write("\n")
st.write(f"{num}{c1}{c2}{t} {kp} {pname}\n")
for point in self._data.profile[index_pro].points:
for i in [point.x, point.y, point.z, point.name]:
file_st.write(f"{i:>13.4f}")
file_st.write("\n")
for point in profile.points:
x = f"{point.x:<12.4f}"[0:12]
y = f"{point.y:<12.4f}"[0:12]
z = f"{point.z:<12.4f}"[0:12]
n = f"{point.name:<3}"
file_st.write(" 999.9990 999.9990 999.9990")
file_st.write("\n")
st.write(f"{x} {y} {z} {n}\n")
st.write(" 999.9990 999.9990 999.9990")
st.write("\n")
cnt += 1
def get_incline(self):
first = self.profile(0)