]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
best chordal deviation BR_pluginMGCleaner
authorcvw <cvw>
Mon, 17 Jun 2013 14:08:05 +0000 (14:08 +0000)
committercvw <cvw>
Mon, 17 Jun 2013 14:08:05 +0000 (14:08 +0000)
src/Tools/YamsPlug/YamsPlugDialog.ui
src/Tools/YamsPlug/monYamsPlugDialog.py

index 2679f857ec463da8f444056eb7a160329b2cc001..1afc115ac8ee389743ae1f2057a3549882f4049d 100644 (file)
@@ -243,7 +243,7 @@ resulting mesh.
 This option modifies the geometry.</string>
            </property>
            <property name="text">
-            <string>Smoothing (S)</string>
+            <string>Sandpapering (S)</string>
            </property>
            <property name="checked">
             <bool>false</bool>
@@ -323,100 +323,70 @@ good quality elements</string>
         <rect>
          <x>10</x>
          <y>420</y>
-         <width>300</width>
+         <width>750</width>
          <height>70</height>
         </rect>
        </property>
+       <property name="toolTip">
+        <string>This parameter enables the user to bound the maximal chordal deviation allowed,
+that is the maximal distance allowed between the detected curve and the plane P
+of the corresponding mesh face.
+In other words, it avoids having faces too far away from the curve they should represent.</string>
+       </property>
        <property name="title">
-        <string>Units</string>
+        <string>Chordal deviation Tolerance</string>
        </property>
-       <widget class="QRadioButton" name="RB_Absolute">
+       <widget class="QLineEdit" name="SP_Tolerance">
         <property name="geometry">
          <rect>
-          <x>10</x>
+          <x>40</x>
           <y>30</y>
           <width>110</width>
           <height>24</height>
          </rect>
         </property>
         <property name="toolTip">
-         <string>Values are expressed in the model units.</string>
-        </property>
-        <property name="text">
-         <string>Absolute</string>
-        </property>
-        <property name="checked">
-         <bool>false</bool>
+         <string>If the Units parameter is relative, epsilon max correspond to (per thousand) s*Tolerance/1000, where s is the size of the bounding box of the domain.
+If the Units parameter is absolute, the tolerance parameter is expressed in model units:
+  if P=2 and point coordinates are given in millimeters, the maximal chordal deviation is 2 mm.</string>
         </property>
        </widget>
-       <widget class="QRadioButton" name="RB_Relative">
+       <widget class="QRadioButton" name="RB_Absolute">
         <property name="geometry">
          <rect>
-          <x>160</x>
+          <x>220</x>
           <y>30</y>
-          <width>110</width>
+          <width>120</width>
           <height>24</height>
          </rect>
         </property>
         <property name="toolTip">
-         <string>Values are relative to the bounding box size.</string>
+         <string>Values are expressed in the model units.</string>
         </property>
         <property name="text">
-         <string>Relative</string>
+         <string>Absolute units</string>
         </property>
         <property name="checked">
-         <bool>true</bool>
+         <bool>false</bool>
         </property>
        </widget>
-      </widget>
-      <widget class="QGroupBox" name="GBTolerance_2">
-       <property name="geometry">
-        <rect>
-         <x>410</x>
-         <y>420</y>
-         <width>351</width>
-         <height>71</height>
-        </rect>
-       </property>
-       <property name="toolTip">
-        <string>This parameter enables the user to bound the maximal chordal deviation allowed,
-that is the maximal distance allowed between the detected curve
-and the plane P of the corresponding mesh face.
-In other words, it avoids having faces too far away from the curve they should represent.</string>
-       </property>
-       <property name="title">
-        <string>Chordal deviation Tolerance</string>
-       </property>
-       <widget class="QDoubleSpinBox" name="SP_Tolerance">
+       <widget class="QRadioButton" name="RB_Relative">
         <property name="geometry">
          <rect>
-          <x>40</x>
+          <x>350</x>
           <y>30</y>
-          <width>81</width>
-          <height>23</height>
+          <width>120</width>
+          <height>24</height>
          </rect>
         </property>
-        <property name="font">
-         <font>
-          <stylestrategy>PreferDefault</stylestrategy>
-         </font>
-        </property>
-        <property name="mouseTracking">
-         <bool>true</bool>
-        </property>
         <property name="toolTip">
-         <string>If the Units parameter is relative, epsilon max correspond to 0.0001*s*Tolerance, where s is the size of the bounding box of the domain.
-If the Units parameter is absolute, the tolerance parameter is expressed in model units:
-  if P=2 and point coordinates are given in millimeters, the maximal chordal deviation is 2 mm.</string>
+         <string>Values are relative (per thousand) to the bounding box size.</string>
         </property>
-        <property name="maximum">
-         <double>100000.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>1.000000000000000</double>
+        <property name="text">
+         <string>Relative units</string>
         </property>
-        <property name="value">
-         <double>0.100000000000000</double>
+        <property name="checked">
+         <bool>true</bool>
         </property>
        </widget>
       </widget>
index 1518ae9f535f7f1db83ff27388a3e4c13113e67d..6e6088c11fc9cc86b7f575dcac512bc86764747d 100644 (file)
@@ -72,6 +72,14 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     self.LE_ParamsFile.setText(self.paramsFile)
     self.LE_MeshFile.setText("")
     self.LE_MeshSmesh.setText("")
+    
+    v1=QDoubleValidator(self)
+    v1.setBottom(0.)
+    #v1.setTop(1000.) #per thousand... only if relative
+    v1.setDecimals(2)
+    self.SP_Tolerance.setValidator(v1)
+    self.SP_Tolerance.titleForWarning="Chordal Tolerance"
+    
     self.resize(800, 600)
     self.clean()
 
@@ -215,16 +223,44 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     self.num+=1
     return True
 
+  def SP_toStr(self, widget):
+    """only for a QLineEdit widget"""
+    #cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
+    try:
+      val=float(widget.text())
+    except:
+      QMessageBox.warning(self, widget.titleForWarning, "float value is incorrect: '"+widget.text()+"'")
+      res=str(widget.validator().bottom())
+      widget.setProperty("text", res)
+      return res
+    valtest=widget.validator().bottom()
+    if valtest!=None:
+      if val<valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is under minimum: "+str(val)+" < "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res
+    valtest=widget.validator().top()
+    if valtest!=None:
+      if val>valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is over maximum: "+str(val)+" > "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res    
+    return str(val)
+
   def getResumeData(self, separator="\n"):
     text=""
     for RB in self.GBOptim.findChildren(QRadioButton,):
       if RB.isChecked()==True:
         text+="Optimisation="+RB.text()+separator
         break
-    for RB in self.GBUnit.findChildren(QRadioButton,):
-      if RB.isChecked()==True:
-        text+="Units="+RB.text()+separator
-    text+="ChordalToleranceDeviation="+str(self.SP_Tolerance.value())+separator
+    if self.RB_Absolute.isChecked():
+      text+="Units=absolute"+separator
+    else:
+      text+="Units=relative"+separator
+    v=self.SP_toStr(self.SP_Tolerance)
+    text+="ChordalToleranceDeviation="+v+separator
     text+="RidgeDetection="+str(self.CB_Ridge.isChecked())+separator
     text+="SplitEdge="+str(self.CB_SplitEdge.isChecked())+separator
     text+="PointSmoothing="+str(self.CB_Point.isChecked())+separator
@@ -254,7 +290,14 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
             if RB.text()==value :
               RB.setChecked(True)
               break
-        if tit=="ChordalToleranceDeviation": self.SP_Tolerance.setProperty("value", float(value))
+        if tit=="Units":
+          if value=="absolute":
+            self.RB_Absolute.setChecked(True)
+            self.RB_Relative.setChecked(False)
+          else:
+            self.RB_Absolute.setChecked(False)
+            self.RB_Relative.setChecked(True)
+        if tit=="ChordalToleranceDeviation": self.SP_Tolerance.setProperty("text", float(value))
         if tit=="RidgeDetection": self.CB_Ridge.setChecked(value=="True")
         if tit=="SplitEdge": self.CB_SplitEdge.setChecked(value=="True")
         if tit=="PointSmoothing": self.CB_Point.setChecked(value=="True")
@@ -408,9 +451,11 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
         self.commande+=" -Dabsolute"
     else :
         self.commande+=" -Drelative"
-    self.commande+=",tolerance=%f"%self.SP_Tolerance.value()
-    if self.CB_Ridge.isChecked()==False : self.commande+=",nr"
-    if self.CB_Point.isChecked()==False : self.commande+=",ns"
+    
+    v=self.SP_toStr(self.SP_Tolerance)
+    self.commande+=",tolerance="+v
+    if self.CB_Ridge.isChecked()==False : self.commande+=",-nr"
+    if self.CB_Point.isChecked()==False : self.commande+=",-ns"
     if self.SP_Geomapp.value()!=0.04 : self.commande+=",geomapp=%f"%self.SP_Geomapp.value()
     if self.SP_Ridge.value()!=45.0 : self.commande+=",ridge=%f"%self.SP_Ridge.value()
     if self.SP_MaxSize.value()!=100 : self.commande+=",maxsize=%f"%self.SP_MaxSize.value()
@@ -433,7 +478,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     self.RB_1.setChecked(False)
     self.RB_Absolute.setChecked(False)
     self.RB_Relative.setChecked(True)
-    self.SP_Tolerance.setProperty("value", 0.1)
+    self.SP_Tolerance.setProperty("text", "10.")
     self.SP_Geomapp.setProperty("value", 0.04)
     self.SP_Ridge.setProperty("value", 45.0)
     self.SP_Gradation.setProperty("value", 1.3)