From: cvw Date: Mon, 17 Jun 2013 14:08:05 +0000 (+0000) Subject: best chordal deviation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_pluginMGCleaner;p=modules%2Fsmesh.git best chordal deviation --- diff --git a/src/Tools/YamsPlug/YamsPlugDialog.ui b/src/Tools/YamsPlug/YamsPlugDialog.ui index 2679f857e..1afc115ac 100644 --- a/src/Tools/YamsPlug/YamsPlugDialog.ui +++ b/src/Tools/YamsPlug/YamsPlugDialog.ui @@ -243,7 +243,7 @@ resulting mesh. This option modifies the geometry. - Smoothing (S) + Sandpapering (S) false @@ -323,100 +323,70 @@ good quality elements 10 420 - 300 + 750 70 + + 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. + - Units + Chordal deviation Tolerance - + - 10 + 40 30 110 24 - Values are expressed in the model units. - - - Absolute - - - false + 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. - + - 160 + 220 30 - 110 + 120 24 - Values are relative to the bounding box size. + Values are expressed in the model units. - Relative + Absolute units - true + false - - - - - 410 - 420 - 351 - 71 - - - - 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. - - - Chordal deviation Tolerance - - + - 40 + 350 30 - 81 - 23 + 120 + 24 - - - PreferDefault - - - - true - - 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. + Values are relative (per thousand) to the bounding box size. - - 100000.000000000000000 - - - 1.000000000000000 + + Relative units - - 0.100000000000000 + + true diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index 1518ae9f5..6e6088c11 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -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 valvaltest: + 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)