From d74c78eff5c06ce820d4fb43e65f666571b71ede Mon Sep 17 00:00:00 2001
From: Theophile Terraz <theophile.terraz@inrae.fr>
Date: Thu, 21 Dec 2023 15:56:59 +0100
Subject: [PATCH] get GL order for meshing

---
 src/Meshing/Mage.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Meshing/Mage.py b/src/Meshing/Mage.py
index 5a32f614..be331df5 100644
--- a/src/Meshing/Mage.py
+++ b/src/Meshing/Mage.py
@@ -188,7 +188,9 @@ class MeshingWithMage(AMeshingTool):
             ns, npts_max = self.get_reach_stat()
 
             gl = reach.compute_guidelines()
-            self.complete_cross_section(gl[0])
+            # we make sure that the lines are in the left-ti-right order
+            guide_list = [x.name for x in reach.profiles[0].named_points() if x in gl[0]]
+            self.complete_cross_section(guide_list)
             self.interpolate_cross_section(ns, step)
             self.purge()
 
@@ -221,8 +223,9 @@ class MeshingWithMage(AMeshingTool):
         return ns, npts_max
 
     def complete_cross_section(self, gl=[]):
-        gl1 = ["un"]+list(gl)
-        gl2 = list(gl)+["np"]
+        gl1 = ["un"]+gl
+        gl2 = gl+["np"]
+        print (gl1)
         for l in zip(gl1, gl2):
             self.st_to_m_compl(0, l[0], l[1])
 
-- 
GitLab