From: Paul RASCLE Date: Tue, 27 Nov 2018 16:46:51 +0000 (+0100) Subject: fix several bugs in SMESH Python plugins (MeshCut, MGSurfOpt, MgCleaner, BlocFissure) X-Git-Tag: V9_2_0rc2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96726c1eae9968fd792f9bbe2f03e57a79c13728;p=modules%2Fsmesh.git fix several bugs in SMESH Python plugins (MeshCut, MGSurfOpt, MgCleaner, BlocFissure) --- diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py index 21216e96e..19d1c41ef 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py @@ -339,12 +339,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): def getResumeData(self, separator="\n"): text="" if self.RB_Fix1.isChecked(): - CheckOrFix="fix1pass" + CheckOrFix="mode_fix" else: - if self.RB_Fix2.isChecked(): - CheckOrFix="fix2pass" - else: - CheckOrFix="check" + CheckOrFix="mode_check" text+="CheckOrFix="+CheckOrFix+separator text+="PreserveTopology="+str(self.CB_PreserveTopology.isChecked())+separator text+="FillHoles="+str(self.CB_FillHoles.isChecked())+separator @@ -377,11 +374,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): tit,value=lig.split("=") if tit=="CheckOrFix": self.RB_Fix1.setChecked(False) - self.RB_Fix2.setChecked(False) self.RB_Check.setChecked(False) - if value=="fix1pass": self.RB_Fix1.setChecked(True) - if value=="fix2pass": self.RB_Fix2.setChecked(True) - if value=="check": self.RB_Check.setChecked(True) + if value=="mode_fix": self.RB_Fix1.setChecked(True) + if value=="mode_check": self.RB_Check.setChecked(True) if tit=="PreserveTopology": self.CB_PreserveTopology.setChecked(value=="True") if tit=="FillHoles": self.CB_FillHoles.setChecked(value=="True") if tit=="MinHoleSize": self.SP_MinHoleSize.setProperty("text", value) @@ -563,12 +558,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): self.fichierOut=deb[0] + "_fix.mesh" self.commande+=" --out "+self.fichierOut if self.RB_Fix1.isChecked(): - self.commande+=" --fix1pass" + self.commande+=" --mode fix" else: - if self.RB_Fix2.isChecked(): - self.commande+=" --fix2pass" - else: - self.commande+=" --check" + self.commande+=" --mode check" if self.CB_PreserveTopology.isChecked(): self.commande+=" --topology respect" else: @@ -590,8 +582,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): def clean(self): self.RB_Check.setChecked(False) - self.RB_Fix1.setChecked(False) - self.RB_Fix2.setChecked(True) + self.RB_Fix1.setChecked(True) self.CB_PreserveTopology.setChecked(False) self.CB_FillHoles.setChecked(False) self.CB_RemeshPlanes.setChecked(False) diff --git a/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui b/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui index 5e3ddbfba..569cc53d9 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui +++ b/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui @@ -19,7 +19,7 @@ - + Qt::Horizontal @@ -34,7 +34,7 @@ - + @@ -67,12 +67,12 @@ Save - - - 18 - 18 - - + + + 18 + 18 + + @@ -80,12 +80,12 @@ Load - - - 18 - 18 - - + + + 18 + 18 + + @@ -120,7 +120,7 @@ - + Qt::Horizontal @@ -135,7 +135,7 @@ - + @@ -164,126 +164,102 @@ Options - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 30 - 20 - - - - - - - - - - - Performs checks only (no fixing). + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 30 + 20 + + + + + + + + + + Performs checks only (no fixing). Writes diagnostics into the output file. Default is to fix with two passes. - - - Only checking - - - false - - - - - - - Analyses and fixes mesh with only the first stage of the cleaning procedure. -Does not write diagnostics into the output file. -Default is to fix with two passes. - - - Fix problems with one pass - - - false - - - - - - - Analyses and fixes mesh with the two stage cleaning procedure. + + + Only checking + + + false + + + + + + + Analyses and fixes mesh with only the first stage of the cleaning procedure. Does not write diagnostics into the output file. Default is to fix with two passes. - - - Fix problems with two passes - - - true - - - - - - - - Disables fixing operations which induce topology modifications. + + + Fix problems + + + false + + + + + + + Disables fixing operations which induce topology modifications. Default is enable topology modifications. (argument --topology) - - - Preserve topology - - - false - - - - - - - Default is not to fill holes. + + + Preserve topology + + + false + + + + + + + Default is not to fill holes. if set: see 'surface size threshold of holes' in 'Advanced remeshing options'. - - - Fill holes - - - false - - - - - - - - Inserts vertices on planes to improve mesh quality . + + + Fill holes + + + false + + + + + + + Inserts vertices on planes to improve mesh quality . May be useful for poor quality triangulations (eg .STL or .DXF triangulations). Default is not to mesh planes. - - - Remesh planes - - - false - + + + Remesh planes + + + false + - - + - - - - - + + @@ -411,8 +387,10 @@ Default is not to mesh planes. You can control -#1 + + false + 20 @@ -421,9 +399,6 @@ Default is not to mesh planes. 25 - - false - @@ -442,8 +417,10 @@ Set 'Fill holes' in 'Simple Remeshing Options'. Surface size threshold of holes to fill (--min_hole_size) -#2 + + false + 20 @@ -452,9 +429,6 @@ Set 'Fill holes' in 'Simple Remeshing Options'. 25 - - false - @@ -475,8 +449,7 @@ Unused in collision resolution . (--tolerance_displacement) - - + 650 @@ -485,19 +458,20 @@ Unused in collision resolution . 30 - - If set default value is computed from model. - - - Computed - - - true - - - -#3 + + If set default value is computed from model. + + + Computed + + + true + + + + false + 20 @@ -506,9 +480,6 @@ Unused in collision resolution . 25 - - false - @@ -528,7 +499,7 @@ Default is computed from model. Distance threshold for two points distinct (--resolution_length) - + 650 @@ -537,17 +508,16 @@ Default is computed from model. 30 - - If set default value is computed from model. - - - Computed - - - true - - -#4 + + If set default value is computed from model. + + + Computed + + + true + + @@ -557,17 +527,17 @@ Default is computed from model. 25 - - 90 - - 0 + 0.000000000000000 + + + 90.000000000000000 - 1 + 1.000000000000000 - 15 + 15.000000000000000 @@ -589,8 +559,10 @@ Default is 15 degrees. Angle threshold for two connected triangles overlapping (--folding_angle) -#5 + + false + 20 @@ -599,9 +571,6 @@ Default is 15 degrees. 25 - - false - @@ -622,7 +591,7 @@ Default is computed from model. (--overlap_distance) - + 650 @@ -631,17 +600,16 @@ Default is computed from model. 30 - - If set default value is computed from model. - - - Computed - - - true - - -#6 + + If set default value is computed from model. + + + Computed + + + true + + @@ -651,17 +619,17 @@ Default is computed from model. 25 - - 90 - - 0 + 0.000000000000000 + + + 90.000000000000000 - 1 + 1.000000000000000 - 15 + 15.000000000000000 @@ -700,8 +668,7 @@ Default is 15 degrees. MGCleaner Generic Options - - + 20 @@ -710,15 +677,14 @@ Default is 15 degrees. 25 - - 10 - - - 3 - - - - + + 10 + + + 3 + + + 130 @@ -732,12 +698,10 @@ Default is 15 degrees. From 0 (no detail) to 10 (very detailed). Default is 3. - - Verbosity level - - - - + + Verbosity level + + @@ -787,8 +751,7 @@ Default is 3. - - + 20 @@ -797,18 +760,17 @@ Default is 3. 31 - - Save - + + Save + 18 18 - - - + + 120 @@ -817,17 +779,16 @@ Default is 3. 31 - - Load - + + Load + 18 18 - - + diff --git a/src/Tools/MeshCut/meshcut_plugin.py b/src/Tools/MeshCut/meshcut_plugin.py index 9af5a3377..65ba70410 100644 --- a/src/Tools/MeshCut/meshcut_plugin.py +++ b/src/Tools/MeshCut/meshcut_plugin.py @@ -50,7 +50,7 @@ def MeshCut(context): infile = fd.selectedFiles()[0] self.ui.le_origMeshFile.setText(infile) insplit = os.path.splitext(str(infile).encode()) - outfile = insplit[0] + '_cut' + insplit[1] + outfile = insplit[0] + '_cut'.encode() + insplit[1] self.ui.le_cutMeshFile.setText(outfile) pass diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index 4aac5cf7c..a28ca5129 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -522,7 +522,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.commande+= " -O G" # This option has not been updated to the new option style yet deb=os.path.splitext(self.fichierIn) - self.fichierOut=deb[0] + "_output.mesh" + self.fichierOut=deb[0].decode() + "_output.mesh" tolerance=self.SP_toStr(self.SP_Tolerance) if not self.RB_Absolute.isChecked(): @@ -540,7 +540,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if self.SP_Memory.value() != 0 : self.commande+=" --max_memory %d" %self.SP_Memory.value() if self.SP_Verbosity.value() != 3 : self.commande+=" --verbose %d" %self.SP_Verbosity.value() - self.commande+=" --in " + self.fichierIn + self.commande+=" --in " + self.fichierIn.decode() self.commande+=" --out " + self.fichierOut print(self.commande) diff --git a/src/Tools/blocFissure/gmu/prolongeWire.py b/src/Tools/blocFissure/gmu/prolongeWire.py index 75cbb518a..989b87c59 100644 --- a/src/Tools/blocFissure/gmu/prolongeWire.py +++ b/src/Tools/blocFissure/gmu/prolongeWire.py @@ -10,7 +10,7 @@ from .orderEdgesFromWire import orderEdgesFromWire # ----------------------------------------------------------------------------- # --- prolongation d'un wire par deux segments tangents -def prolongeWire(aWire, extrem, norms, long): +def prolongeWire(aWire, extrem, norms, lg): """ """ logging.info("start") @@ -22,7 +22,7 @@ def prolongeWire(aWire, extrem, norms, long): uneSeuleEdge = True edgesBout = [] for i, v1 in enumerate(extrem): - exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-int, int)] + exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-lg, lg)] dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)] dists.sort() v2 = dists[-1][-1]