fix several bugs in SMESH Python plugins (MeshCut, MGSurfOpt, MgCleaner, BlocFissure)

This commit is contained in:
Paul RASCLE 2018-11-27 17:46:51 +01:00
parent 2aed859fcd
commit 96726c1eae
5 changed files with 193 additions and 241 deletions

View File

@ -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)

View File

@ -19,7 +19,7 @@
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<item>
<spacer name="horizontalSpacer_xx">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -34,7 +34,7 @@
</size>
</property>
</spacer>
</item>
</item>
<item>
<widget class="QPushButton" name="PB_OK">
<property name="text">
@ -67,12 +67,12 @@
<property name="text">
<string>Save</string>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
@ -80,12 +80,12 @@
<property name="text">
<string>Load</string>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
@ -120,7 +120,7 @@
</property>
</widget>
</item>
<item>
<item>
<spacer name="horizontalSpacer_xx">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -135,7 +135,7 @@
</size>
</property>
</spacer>
</item>
</item>
</layout>
</item>
<item row="1" column="0">
@ -164,126 +164,102 @@
<property name="title">
<string>Options</string>
</property>
<layout class="QHBoxLayout" name="RBLayoutopt">
<item>
<spacer name="horizontalSpacer_xx">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="RBLayout1">
<item>
<widget class="QRadioButton" name="RB_Check">
<property name="toolTip">
<string>Performs checks only (no fixing).
<layout class="QHBoxLayout" name="RBLayoutopt">
<item>
<spacer name="horizontalSpacer_xx">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="RBLayout1">
<item>
<widget class="QRadioButton" name="RB_Check">
<property name="toolTip">
<string>Performs checks only (no fixing).
Writes diagnostics into the output file.
Default is to fix with two passes.</string>
</property>
<property name="text">
<string>Only checking</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RB_Fix1">
<property name="toolTip">
<string>Analyses and fixes mesh with only the first stage of the cleaning procedure.
</property>
<property name="text">
<string>Only checking</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RB_Fix1">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Fix problems with one pass</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RB_Fix2">
<property name="toolTip">
<string>Analyses and fixes mesh with the two stage cleaning procedure.
Does not write diagnostics into the output file.
Default is to fix with two passes.</string>
</property>
<property name="text">
<string>Fix problems with two passes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_PreserveTopology">
<property name="toolTip">
<string>Disables fixing operations which induce topology modifications.
</property>
<property name="text">
<string>Fix problems</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_PreserveTopology">
<property name="toolTip">
<string>Disables fixing operations which induce topology modifications.
Default is enable topology modifications.
(argument --topology)</string>
</property>
<property name="text">
<string>Preserve topology</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_FillHoles">
<property name="toolTip">
<string>Default is not to fill holes.
</property>
<property name="text">
<string>Preserve topology</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_FillHoles">
<property name="toolTip">
<string>Default is not to fill holes.
if set: see 'surface size threshold of holes' in 'Advanced remeshing options'.</string>
</property>
<property name="text">
<string>Fill holes</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_RemeshPlanes">
<property name="toolTip">
<string>Inserts vertices on planes to improve mesh quality .
</property>
<property name="text">
<string>Fill holes</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CB_RemeshPlanes">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Remesh planes</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</property>
<property name="text">
<string>Remesh planes</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
@ -411,8 +387,10 @@ Default is not to mesh planes.</string>
<property name="title">
<string>You can control</string>
</property>
#1
<widget class="QLineEdit" name="SP_MinHoleSize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
@ -421,9 +399,6 @@ Default is not to mesh planes.</string>
<height>25</height>
</rect>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="LA_minHoleSize">
<property name="geometry">
@ -442,8 +417,10 @@ Set 'Fill holes' in 'Simple Remeshing Options'.</string>
<string>Surface size threshold of holes to fill (--min_hole_size)</string>
</property>
</widget>
#2
<widget class="QLineEdit" name="SP_ToleranceDisplacement">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
@ -452,9 +429,6 @@ Set 'Fill holes' in 'Simple Remeshing Options'.</string>
<height>25</height>
</rect>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="LA_toleranceDisplacement">
<property name="geometry">
@ -475,8 +449,7 @@ Unused in collision resolution .
(--tolerance_displacement)</string>
</property>
</widget>
<widget class="QCheckBox" name="CB_ComputedToleranceDisplacement">
<widget class="QCheckBox" name="CB_ComputedToleranceDisplacement">
<property name="geometry">
<rect>
<x>650</x>
@ -485,19 +458,20 @@ Unused in collision resolution .
<height>30</height>
</rect>
</property>
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
#3
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="SP_ResolutionLength">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
@ -506,9 +480,6 @@ Unused in collision resolution .
<height>25</height>
</rect>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="LA_resolutionLength">
<property name="geometry">
@ -528,7 +499,7 @@ Default is computed from model.</string>
<string>Distance threshold for two points distinct (--resolution_length)</string>
</property>
</widget>
<widget class="QCheckBox" name="CB_ComputedResolutionLength">
<widget class="QCheckBox" name="CB_ComputedResolutionLength">
<property name="geometry">
<rect>
<x>650</x>
@ -537,17 +508,16 @@ Default is computed from model.</string>
<height>30</height>
</rect>
</property>
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
#4
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QDoubleSpinBox" name="SP_FoldingAngle">
<property name="geometry">
<rect>
@ -557,17 +527,17 @@ Default is computed from model.</string>
<height>25</height>
</rect>
</property>
<property name="maximum">
<double>90</double>
</property>
<property name="minimum">
<double>0</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
<property name="singleStep">
<double>1</double>
<double>1.000000000000000</double>
</property>
<property name="value">
<double>15</double>
<double>15.000000000000000</double>
</property>
</widget>
<widget class="QLabel" name="LA_foldingAngle">
@ -589,8 +559,10 @@ Default is 15 degrees.</string>
<string>Angle threshold for two connected triangles overlapping (--folding_angle)</string>
</property>
</widget>
#5
<widget class="QLineEdit" name="SP_OverlapDistance">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
@ -599,9 +571,6 @@ Default is 15 degrees.</string>
<height>25</height>
</rect>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="LA_overlapDistance">
<property name="geometry">
@ -622,7 +591,7 @@ Default is computed from model.</string>
(--overlap_distance)</string>
</property>
</widget>
<widget class="QCheckBox" name="CB_ComputedOverlapDistance">
<widget class="QCheckBox" name="CB_ComputedOverlapDistance">
<property name="geometry">
<rect>
<x>650</x>
@ -631,17 +600,16 @@ Default is computed from model.</string>
<height>30</height>
</rect>
</property>
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
#6
<property name="toolTip">
<string>If set default value is computed from model.</string>
</property>
<property name="text">
<string>Computed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QDoubleSpinBox" name="SP_OverlapAngle">
<property name="geometry">
<rect>
@ -651,17 +619,17 @@ Default is computed from model.</string>
<height>25</height>
</rect>
</property>
<property name="maximum">
<double>90</double>
</property>
<property name="minimum">
<double>0</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
<property name="singleStep">
<double>1</double>
<double>1.000000000000000</double>
</property>
<property name="value">
<double>15</double>
<double>15.000000000000000</double>
</property>
</widget>
<widget class="QLabel" name="LA_overlapAngle">
@ -700,8 +668,7 @@ Default is 15 degrees.</string>
<property name="title">
<string>MGCleaner Generic Options</string>
</property>
<widget class="QSpinBox" name="SP_Verbosity">
<widget class="QSpinBox" name="SP_Verbosity">
<property name="geometry">
<rect>
<x>20</x>
@ -710,15 +677,14 @@ Default is 15 degrees.</string>
<height>25</height>
</rect>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>130</x>
@ -732,12 +698,10 @@ Default is 15 degrees.</string>
From 0 (no detail) to 10 (very detailed).
Default is 3.</string>
</property>
<property name="text">
<string>Verbosity level</string>
</property>
</widget>
<property name="text">
<string>Verbosity level</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_6">
<property name="geometry">
@ -787,8 +751,7 @@ Default is 3.</string>
</rect>
</property>
</widget>
<widget class="QPushButton" name="PB_Save">
<widget class="QPushButton" name="PB_Save">
<property name="geometry">
<rect>
<x>20</x>
@ -797,18 +760,17 @@ Default is 3.</string>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
<widget class="QPushButton" name="PB_Load">
</widget>
<widget class="QPushButton" name="PB_Load">
<property name="geometry">
<rect>
<x>120</x>
@ -817,17 +779,16 @@ Default is 3.</string>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Load</string>
</property>
<property name="text">
<string>Load</string>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>

View File

@ -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

View File

@ -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)

View File

@ -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]