]> 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. fbt/minor_fixes_portion_cylinder_primitive
authorFlorian BRUNET <FB15EB3N@dsp0657834.(none)>
Mon, 4 May 2015 13:04:24 +0000 (15:04 +0200)
committerFlorian BRUNET <FB15EB3N@dsp0657834.(none)>
Mon, 4 May 2015 13:04:24 +0000 (15:04 +0200)
src/GEOM_SWIG/geomBuilder.py
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx

index ccbad10f6e1362c92019b2635ef515658ecc595d..5bbfc8e60245086e783395e55bd4912029c22e45 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")
+           anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
+           if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
+           RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
+           anObj.SetParameters(Parameters)
+           self._autoPublish(anObj, theName, "cylinder")
             return anObj
 
         ## Create a cylinder with given radius and height at
@@ -3137,6 +3139,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             if flag:
                 theA = theA*math.pi/180.
             anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
+            if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
             RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "cylinder")
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";