]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Minor fixes to handle boundary values of the angle for the portion of cylinder primitive.
authorFlorian BRUNET <FB15EB3N@dsp0657834.(none)>
Mon, 4 May 2015 13:04:24 +0000 (15:04 +0200)
committervsr <vsr@opencascade.com>
Tue, 5 May 2015 13:04:28 +0000 (16:04 +0300)
src/GEOM_SWIG/geomBuilder.py
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx

index ccbad10f6e1362c92019b2635ef515658ecc595d..f932a632a2147d3fdb7c85af77f1f971c30c5b88 100644 (file)
@@ -3055,10 +3055,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
            if flag:
                 theA = theA*math.pi/180.
-            anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
-            RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
-            anObj.SetParameters(Parameters)
-            self._autoPublish(anObj, theName, "cylinder")
+           if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
+           anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
+           RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
+           anObj.SetParameters(Parameters)
+           self._autoPublish(anObj, theName, "cylinder")
             return anObj
 
         ## Create a cylinder with given radius and height at
@@ -3136,6 +3138,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
             if flag:
                 theA = theA*math.pi/180.
+            if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
             anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
             RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
             anObj.SetParameters(Parameters)
index 9149eee9f681658a690e6e7465d89734ae22bd47..fd30c9b4462be889ee3fa99ed287cf06e6ee7e9d 100644 (file)
@@ -411,7 +411,7 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
   {
     ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
          GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
-         ( GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
+         ( !GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
     if ( GroupDimensions->checkBox->isChecked() &&
         ( GroupDimensions->SpinBox_DZ->value() <= 0. || GroupDimensions->SpinBox_DZ->value() >= 360. ) ) {
       msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";