Commit 672f81f2 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

MeshingTools: Fix mailleurTT path.

No related merge requests found
Pipeline #54925 passed with stages
in 3 minutes and 40 seconds
Showing with 22 additions and 9 deletions
+22 -9
...@@ -30,7 +30,7 @@ from ctypes import ( ...@@ -30,7 +30,7 @@ from ctypes import (
) )
from PyQt5.QtCore import QProcess from PyQt5.QtCore import QProcess
from tools import logger_color_red, logger_color_reset from tools import logger_color_red, logger_color_reset, logger_exception
from Meshing.AMeshingTool import AMeshingTool from Meshing.AMeshingTool import AMeshingTool
logger = logging.getLogger() logger = logging.getLogger()
...@@ -278,7 +278,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -278,7 +278,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
return os.path.abspath( return os.path.abspath(
os.path.join( os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
"..", "..", "..", "mage", f"mailleurTT{ext}" "..", "..", "mage8", f"mailleurTT{ext}"
) )
) )
...@@ -305,6 +305,8 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -305,6 +305,8 @@ class MeshingWithMageMailleurTT(AMeshingTool):
st_file = self.export_reach_to_st(reach, tmp) st_file = self.export_reach_to_st(reach, tmp)
m_file = st_file.rsplit(".ST", 1)[0] + ".M" m_file = st_file.rsplit(".ST", 1)[0] + ".M"
os.sync()
proc = QProcess() proc = QProcess()
proc.setWorkingDirectory(tmp) proc.setWorkingDirectory(tmp)
...@@ -312,7 +314,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -312,7 +314,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
linear = 1 if linear else 0 linear = 1 if linear else 0
logger.info( logger.info(
f"! mailleurTT {st_file} {m_file} " + f"! {self._exe_path()} {st_file} {m_file} " +
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]} " +
...@@ -332,13 +334,22 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -332,13 +334,22 @@ class MeshingWithMageMailleurTT(AMeshingTool):
) )
proc.waitForFinished() proc.waitForFinished()
errors = proc.readAllStandardError() if proc.exitCode() != 0:
if len(errors) != 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( logger.error(
f"{logger_color_red()}{errors}{logger_color_reset()}" f"{logger_color_red()}{errors}{logger_color_reset()}"
) )
else: else:
self.import_m_file(reach, m_file) self.import_m_file(reach, m_file)
return reach return reach
def export_reach_to_st(self, reach, tmp): def export_reach_to_st(self, reach, tmp):
...@@ -350,7 +361,9 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -350,7 +361,9 @@ class MeshingWithMageMailleurTT(AMeshingTool):
return tmp_st return tmp_st
def import_m_file(self, reach, m): def import_m_file(self, reach, m):
reach.purge() if os.path.exists(m):
reach.purge()
logger.debug(f"meshing: Import geometry from {m}") logger.debug(f"meshing: Import geometry from {m}")
reach.import_geometry(m) reach.import_geometry(m)
else:
logger.error(f"meshing: Meshed geometry file {m} do not exists")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment