]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022667: EDF 7375 GEOM: Add angle argument to « Create cylinder » function.
authorvsr <vsr@opencascade.com>
Wed, 13 Aug 2014 13:34:03 +0000 (17:34 +0400)
committervsr <vsr@opencascade.com>
Wed, 13 Aug 2014 13:34:03 +0000 (17:34 +0400)
Minor corrections to initial implementation.

17 files changed:
doc/salome/examples/primitives_ex02.py
doc/salome/gui/GEOM/input/creating_cylinder.doc
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
resources/GEOMCatalog.xml.in
src/DlgRef/DlgRef_2Sel3Spin1Check_QTD.ui
src/DlgRef/DlgRef_3Spin1CheckCyl_QTD.ui
src/GEOMImpl/GEOMImpl_CylinderDriver.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_I3DPrimOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestAll.py
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h

index a0e73ff5fbd3c96af4155ae73d64c228d1a983e9..82cf5e4490459ffc5c6b81230eb00143b44ecc49 100644 (file)
@@ -1,46 +1,49 @@
 # Creation of a Cylinder
 
+import math
+
 import salome
 salome.salome_init()
 import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
-import math
 gg = salome.ImportComponentGUI("GEOM")
 
 # create a vertex and a vector
 p1 = geompy.MakeVertex(25, 35, 45)
 p2 = geompy.MakeVertex(70, 70, 70)
-v = geompy.MakeVector(p1, p2)
+v  = geompy.MakeVector(p1, p2)
 
 # create cylinders
-height = 40
-
+height  = 40
 radius1 = 15
+radius2 = 30
+angle1  = 45.  * math.pi / 180.
+angle2  = 210. * math.pi / 180.
+
 cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
-angle1 = 45.*math.pi / 180.
-cylinder1a = geompy.MakeCylinderA(p1, v, radius1, height, angle1)
-geompy.TranslateDXDYDZ(cylinder1a,80.,0.,0.)
 
-radius2 = 30
 cylinder2 = geompy.MakeCylinderRH(radius2, height)
-angle2 = 210.*math.pi / 180.
-cylinder2a = geompy.MakeCylinderRHA(radius2, height, angle2)
-geompy.TranslateDXDYDZ(cylinder2a,80.,0.,0.)
+
+cylinder3 = geompy.MakeCylinderA(p1, v, radius1, height, angle1)
+geompy.TranslateDXDYDZ(cylinder3, 80., 0., 0.)
+
+cylinder4 = geompy.MakeCylinderRHA(radius2, height, angle2)
+geompy.TranslateDXDYDZ(cylinder4, 80., 0., 0.)
 
 # add objects in the study
 id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
 id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
-id_cylinder1a = geompy.addToStudy(cylinder1a,"Cylinder1a")
-id_cylinder2a = geompy.addToStudy(cylinder2a,"Cylinder2a")
+id_cylinder3 = geompy.addToStudy(cylinder3,"Cylinder3")
+id_cylinder4 = geompy.addToStudy(cylinder4,"Cylinder4")
 
 # display the cylinders
 gg.createAndDisplayGO(id_cylinder1)
 gg.setDisplayMode(id_cylinder1,1)
 gg.createAndDisplayGO(id_cylinder2)
 gg.setDisplayMode(id_cylinder2,1)
-gg.createAndDisplayGO(id_cylinder1a)
-gg.setDisplayMode(id_cylinder1a,1)
-gg.createAndDisplayGO(id_cylinder2a)
-gg.setDisplayMode(id_cylinder2a,1)
+gg.createAndDisplayGO(id_cylinder3)
+gg.setDisplayMode(id_cylinder3,1)
+gg.createAndDisplayGO(id_cylinder4)
+gg.setDisplayMode(id_cylinder4,1)
index 49f19bf644418b119736f80b361c3d6308ca0dba..d2c9f78e3829ffa84ac96077af346606cfe1776b 100644 (file)
@@ -10,29 +10,32 @@ Entity - > Primitives - > Cylinder</b>
 
 \n Firstly, you can define a \b Cylinder by the <b>Base Point</b> (the central
 point of the cylinder base), the \b Vector (the axis of the cylinder),
-and its dimensions: the Radius and the Height.
+and its dimensions: the \b Radius and the \b Height. Also, you can optionally specify
+the \b Angle in order to create a portion of cylinder.
+
 \n <b>TUI Command:</b> <em>geompy.MakeCylinder(Point, Axis, Radius, Height)</em>
 \n <b>Arguments:</b>  Name + 1 vertex + 1 vector + 2 values
 (Dimensions: radius and height).
 
-\n \b Angle checkbox and field allow defining an angle to create a portion of cylinder.
 \n <b>TUI Command:</b> <em>geompy.MakeCylinderA(Point, Axis, Radius, Height, Angle)</em>
 \n <b>Arguments:</b>  Name + 1 vertex + 1 vector + 3 values
 (Dimensions: radius, height and angle).
 
 \image html cylinder1.png
 
-\n Secondly, you can define a \b Cylinder by the given radius and the
-height at  the origin of coordinate system. The axis of the cylinder
-will be collinear to the OZ axis of the coordinate system.
+\n Secondly, you can define a \b Cylinder by the given \b Radius and
+\b Height at the origin of coordinate system. The axis of the cylinder
+will be collinear to the OZ axis of the coordinate system. 
+Similarly to first constructor, you can optionally specify the \b Angle
+in order to create a portion of cylinder.
+
 \n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height)</em>
 \n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius and
 height).
 
-\n \b Angle checkbox and field allow defining an angle to create a portion of cylinder at  the origin of coordinate system.
 \n <b>TUI Command:</b> <em>geompy.MakeCylinderRHA(Radius, Height, Angle)</em>
 \n <b>Arguments:</b>  Name + 3 values
-(Dimensions at origin : radius, height and angle).
+(Dimensions at origin: radius, height and angle).
 
 \image html cylinder2.png
 
index c1e4b2c5c63137261d8583a34da5a4b6e19edf2e..86b959374f1d55ed45db1cabb1b34cc2f209d36c 100644 (file)
@@ -1,4 +1,4 @@
-// // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -1494,7 +1494,7 @@ module GEOM
     GEOM_Object MakeCylinderRHA (in double theR, in double theH, in double theA);
 
     /*!
-     *  \brief Create a cylinder with given base point, axis, radius, height and angle.
+     *  \brief Create a cylinder with given base point, axis, radius and height.
      *  \param thePnt Central point of cylinder base.
      *  \param theAxis Cylinder axis.
      *  \param theR Cylinder radius.
@@ -1518,7 +1518,7 @@ module GEOM
                                       in GEOM_Object theAxis,
                                       in double      theR,
                                       in double      theH,
-                                     in double      theA);
+                                      in double      theA);
 
     /*!
      *  \brief Create a cone with given height and radiuses at
index 3c5972437185d6349ed52431261bf2ec8ec4fe94..7787ff4cc4d9e42abb60f372bd65f1286b9ddbfe 100644 (file)
@@ -162,13 +162,13 @@ module GEOM
     GEOM_Object MakeCylinderRH (in double theR,
                                 in double theH) ;
     GEOM_Object MakeCylinderPntVecRHA (in GEOM_Object thePnt,
-                                      in GEOM_Object theAxis,
-                                      in double      theRadius,
-                                      in double      theHeight,
-                                     in double      theAngle) ;
+                                      in GEOM_Object theAxis,
+                                      in double      theRadius,
+                                      in double      theHeight,
+                                      in double      theAngle) ;
     GEOM_Object MakeCylinderRHA (in double theR,
-                                in double theH,
-                               in double theA) ;
+                                in double theH,
+                                in double theA) ;
     GEOM_Object MakeSphere (in double theX,
                             in double theY,
                             in double theZ,
index db3ec4288ccc6c79ec61de4019962f0afe114c12..7ac41f31319c4fc3ac51c65b01d8b6844b709f44 100644 (file)
                         </outParameter-list>
                         <DataStream-list></DataStream-list>
                     </component-service>
-                   <component-service>
+                    <component-service>
                         <service-name>MakeCylinderPntVecRHA</service-name>
                         <service-author></service-author>
                         <service-version></service-version>
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
                             </inParameter>
-                           <inParameter>
+                            <inParameter>
                                 <inParameter-name>theAngle</inParameter-name>
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
                             </inParameter>
-                           <inParameter>
+                            <inParameter>
                                 <inParameter-name>theA</inParameter-name>
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
index d652b9a90cf259398b6485e1bb10ff7f8c149306..07489104b21e028ca6c99c93f18df96c4a62b06e 100644 (file)
   <tabstop>PushButton2</tabstop>
   <tabstop>LineEdit2</tabstop>
   <tabstop>SpinBox_DX</tabstop>
+  <tabstop>SpinBox_DY</tabstop>
+  <tabstop>SpinBox_DZ</tabstop>
+  <tabstop>checkBox</tabstop>
  </tabstops>
  <resources/>
  <connections/>
index 1747f8d5c6713b797b030b35fecb7572b5af894c..7307c920bc4a212a5057f2fd927b0cdda7800613 100644 (file)
   <tabstop>SpinBox_DX</tabstop>
   <tabstop>SpinBox_DY</tabstop>
   <tabstop>SpinBox_DZ</tabstop>
+  <tabstop>checkBox</tabstop>
  </tabstops>
  <resources/>
  <connections/>
index 42dd86b7ce863b0b5acd69cf7b72a2c151529d8e..3c91625b3440790a4358348d62a19c79447fafae 100644 (file)
@@ -109,37 +109,36 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
 
   if (aCI.GetH() < 0.0) aV.Reverse();
   gp_Ax2 anAxes (aP, aV);
-  bool switchAngleVar;
-  if(aType == CYLINDER_R_H || aType == CYLINDER_PNT_VEC_R_H) switchAngleVar = false;
-  else if(aType == CYLINDER_R_H_A || aType == CYLINDER_PNT_VEC_R_H_A) switchAngleVar = true;
-  else return 0;
+
   TopoDS_Shape aShape;
   
-  switch (switchAngleVar) {
-  case false:
-  {
-    BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
-    MC.Build();
-    if (!MC.IsDone()) {
-      StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+  switch (aType) {
+  case CYLINDER_R_H:
+  case CYLINDER_PNT_VEC_R_H:
+    {
+      BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
+      MC.Build();
+      if (!MC.IsDone()) {
+       StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+      }
+      aShape = MC.Shape();
+      break;
     }
-    aShape = MC.Shape();
-    break;
-  }
-  case true:
-  {
-    BRepPrimAPI_MakeCylinder MCA (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
-    MCA.Build();
-    if (!MCA.IsDone()) {
-      StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
-      return 0;
+  case CYLINDER_R_H_A:
+  case CYLINDER_PNT_VEC_R_H_A:
+    {
+      BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
+      MC.Build();
+      if (!MC.IsDone()) {
+       StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
+      }
+      aShape = MC.Shape();
+      break;
     }
-    aShape = MCA.Shape();
-    break;
-  }
   default:
-    return 0;
+    break;
   }
+  
   if (aShape.IsNull()) return 0;
   aFunction->SetValue(aShape);
 
index f3f33f96973e2f67fb5d0c94cd02af3f442dc935..037b33560b63841c874e762bff803be2b29c5a2d 100644 (file)
@@ -646,8 +646,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
-                                                                      Handle(GEOM_Object) theVec,
-                                                                      double theR, double theH, double theA)
+                                                                      Handle(GEOM_Object) theVec,
+                                                                      double theR, double theH, double theA)
 {
   SetErrorCode(KO);
 
index 84a643afcfe23e3fdcddecce66ff06186f59d48f..de227452e41f7cfe88d56403c14b66fa9f5f1a58 100644 (file)
@@ -50,17 +50,17 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH       (double theR, double theH);
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
-                                            Handle(GEOM_Object) theVec,
-                                            double theR, double theH);
+                                                           Handle(GEOM_Object) theVec,
+                                                           double theR, double theH);
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA       (double theR, double theH, double theA);
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
-                                            Handle(GEOM_Object) theVec,
-                                            double theR, double theH, double theA);                                        
+                                                            Handle(GEOM_Object) theVec,
+                                                            double theR, double theH, double theA);                                        
 
   Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H       (double theR1, double theR2, double theH);
   Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
-                                           Handle(GEOM_Object) theVec,
-                                           double theR1, double theR2, double theH);
+                                                          Handle(GEOM_Object) theVec,
+                                                          double theR1, double theR2, double theH);
 
   Standard_EXPORT Handle(GEOM_Object) MakeSphereR    (double theR);
   Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR);
@@ -68,8 +68,8 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor);
 
   Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt,
-                                         Handle(GEOM_Object) theVec,
-                                         double theRMajor, double theRMinor);
+                                                        Handle(GEOM_Object) theVec,
+                                                        double theRMajor, double theRMinor);
 
   Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
                                                      Handle(GEOM_Object) theVec,
index 5f01b7c91f3a83058865cd0d13dc1e208878998a..ef874e8244c2efd72b8a6dfd793553a0d062db87 100644 (file)
@@ -267,8 +267,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
-                                                                CORBA::Double theH,
-                                                               CORBA::Double theA)
+                                                                CORBA::Double theH,
+                                                                CORBA::Double theA)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
index f78e1c0890458fd1dba18f8cd6b05c05b3fd7e77..56c1cbc7b9cc69c4d1af92195e0bfb6b117befcb 100644 (file)
@@ -77,14 +77,14 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
                                              CORBA::Double theH);
                                              
   GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
-                                       CORBA::Double theH,
-                                       CORBA::Double theA);
+                                        CORBA::Double theH,
+                                        CORBA::Double theA);
 
   GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
-                                             GEOM::GEOM_Object_ptr theVec,
-                                             CORBA::Double theR,
-                                             CORBA::Double theH,
-                                             CORBA::Double theA);                                            
+                                              GEOM::GEOM_Object_ptr theVec,
+                                              CORBA::Double theR,
+                                              CORBA::Double theH,
+                                              CORBA::Double theA);                                           
 
   GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1,
                                       CORBA::Double theR2,
index 801ea5e709a2136fb62fa54b781b666e369c24eb..de9ef8b3dd64346764fbe9ccd0b7b1e0ddc1456a 100644 (file)
@@ -1077,10 +1077,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR,
 //  MakeCylinderPntVecRHA:
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
-                                                           GEOM::GEOM_Object_ptr theAxis,
-                                                           CORBA::Double theRadius,
-                                                           CORBA::Double theHeight,
-                                                          CORBA::Double theAngle)
+                                                           GEOM::GEOM_Object_ptr theAxis,
+                                                           CORBA::Double theRadius,
+                                                           CORBA::Double theHeight,
+                                                           CORBA::Double theAngle)
 {
   beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
   MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA");
@@ -1094,8 +1094,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_pt
 //  MakeCylinderRHA:
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR,
-                                                     CORBA::Double theH,
-                                                    CORBA::Double theA)
+                                                     CORBA::Double theH,
+                                                     CORBA::Double theA)
 {
   beginService( " GEOM_Superv_i::MakeCylinderRHA" );
   MESSAGE("GEOM_Superv_i::MakeCylinderRHA");
index 4d827589e4f2dcda60bc6e48474e858208a667a6..708a0dab664eec90150aa61bc4250c5658c97332 100644 (file)
@@ -247,13 +247,13 @@ public:
   GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
                                         CORBA::Double theH);
   GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
-                                              GEOM::GEOM_Object_ptr theAxis,
-                                              CORBA::Double theRadius,
-                                              CORBA::Double theHeight,
-                                             CORBA::Double theAngle);
+                                              GEOM::GEOM_Object_ptr theAxis,
+                                              CORBA::Double theRadius,
+                                              CORBA::Double theHeight,
+                                              CORBA::Double theAngle);
   GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
-                                        CORBA::Double theH,
-                                       CORBA::Double theA);                                    
+                                        CORBA::Double theH,
+                                        CORBA::Double theA);                                   
   GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
                                     CORBA::Double theY,
                                     CORBA::Double theZ,
index 62eec35c830a86497dd19f0341bf1e8702a225d0..b644c196b34bb146ac510209e1f4c5d7f2ae62e3 100644 (file)
@@ -147,20 +147,20 @@ def TestAll (geompy, math):
   tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
 
   #Create base geometry 3D
-  Box      = geompy.MakeBoxTwoPnt(p0, p200)                            #(2 GEOM_Object)->GEOM_Object
-  Box1     = geompy.MakeBoxDXDYDZ(10, 20, 30)                          #(3 Doubles)->GEOM_Object
-  Box2     = geompy.MakeBox(10,20,30, 15,25,35)                        #(6 Doubles)->GEOM_Object
-  Cylinder = geompy.MakeCylinder(p0, vz, radius1, height)              #(2 GEOM_Object, 2 Doubles)->GEOM_Object
-  Cyl1     = geompy.MakeCylinderRH(radius2, height)                    #(2 Doubles)->GEOM_Object
-  Cylinder1= geompy.MakeCylinderA(p0, vz, radius1, height,angle1)      #(2 GEOM_Object, 2 Doubles)->GEOM_Object
-  Cyl2     = geompy.MakeCylinderRHA(radius2, height,angle2)            #(2 Doubles)->GEOM_Object
-  Sphere   = geompy.MakeSpherePntR(p0, radius1)                        #(GEOM_Object, Double)->GEOM_Object
-  Sphere1  = geompy.MakeSphereR(radius)                                #(Double)->GEOM_Object
-  Sphere2  = geompy.MakeSphere(50, 70, 30, radius)                     #(4 Doubles)->GEOM_Object
-  Cone     = geompy.MakeCone(p0, vz, radius2, radius, height)          #(2 GEOM_Object, 3 Doubles)->GEOM_Object
-  Cone1    = geompy.MakeConeR1R2H(radius1, radius, height)             #(3 Doubles)->GEOM_Object
-  Torus    = geompy.MakeTorus(p0, vz, radius2, radius)                 #(2 GEOM_Object, 2 Doubles)->GEOM_Object
-  Torus1   = geompy.MakeTorusRR(radius2, radius1)                      #(2 Doubles)->GEOM_Object
+  Box      = geompy.MakeBoxTwoPnt(p0, p200)                             #(2 GEOM_Object)->GEOM_Object
+  Box1     = geompy.MakeBoxDXDYDZ(10, 20, 30)                           #(3 Doubles)->GEOM_Object
+  Box2     = geompy.MakeBox(10,20,30, 15,25,35)                         #(6 Doubles)->GEOM_Object
+  Cylinder = geompy.MakeCylinder(p0, vz, radius1, height)               #(2 GEOM_Object, 2 Doubles)->GEOM_Object
+  Cyl1     = geompy.MakeCylinderRH(radius2, height)                     #(2 Doubles)->GEOM_Object
+  Cylinder1= geompy.MakeCylinderA(p0, vz, radius1, height, angle1)      #(2 GEOM_Object, 3 Doubles)->GEOM_Object
+  Cyl2     = geompy.MakeCylinderRHA(radius2, height, angle2)            #(3 Doubles)->GEOM_Object
+  Sphere   = geompy.MakeSpherePntR(p0, radius1)                         #(GEOM_Object, Double)->GEOM_Object
+  Sphere1  = geompy.MakeSphereR(radius)                                 #(Double)->GEOM_Object
+  Sphere2  = geompy.MakeSphere(50, 70, 30, radius)                      #(4 Doubles)->GEOM_Object
+  Cone     = geompy.MakeCone(p0, vz, radius2, radius, height)           #(2 GEOM_Object, 3 Doubles)->GEOM_Object
+  Cone1    = geompy.MakeConeR1R2H(radius1, radius, height)              #(3 Doubles)->GEOM_Object
+  Torus    = geompy.MakeTorus(p0, vz, radius2, radius)                  #(2 GEOM_Object, 2 Doubles)->GEOM_Object
+  Torus1   = geompy.MakeTorusRR(radius2, radius1)                       #(2 Doubles)->GEOM_Object
 
   #Boolean (Common, Cut, Fuse, Section)
   Common  = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
index 73e7c03fa73ee7a3ac4f23257b43557e78b69e1a..66333aa2466c12b9064fe82ffea0c274c04502a6 100644 (file)
@@ -166,7 +166,7 @@ void PrimitiveGUI_CylinderDlg::Init()
 
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
   
-  connect(GroupPoints->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
+  connect(GroupPoints->checkBox,     SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
   connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
   
   initName(tr("GEOM_CYLINDER"));
@@ -399,9 +399,10 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
   {
     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
          GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
-         GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+         ( !GroupPoints->checkBox->isChecked() || GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) ) &&
          myPoint && myDir;
-        if(GroupPoints->SpinBox_DZ->value()<=0. || GroupPoints->SpinBox_DZ->value()>=360.) {
+    if ( GroupPoints->checkBox->isChecked() && 
+        ( GroupPoints->SpinBox_DZ->value() <= 0. || GroupPoints->SpinBox_DZ->value() >= 360. ) ) {
       msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
       ok = false;
     }
@@ -410,10 +411,11 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
   {
     ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
          GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
-         GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
-        if(GroupDimensions->SpinBox_DZ->value()<=0. || GroupDimensions->SpinBox_DZ->value()>=360.) {
-           msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
-           ok = false;
+         ( 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";
+      ok = false;
     }
   }
   ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
@@ -428,7 +430,6 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
 bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
 {
   bool res = false;
-  bool BAngle = false;
   
   GEOM::GEOM_Object_var anObj;
 
@@ -436,27 +437,26 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    BAngle = GroupPoints->checkBox->isChecked();
     if ( myPoint && myDir ) {
-      if(!BAngle){
-       anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
+      if ( GroupPoints->checkBox->isChecked() ) {
+       anObj = anOper->MakeCylinderPntVecRHA(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle()*M_PI/180.);
        if (!anObj->_is_nil() && !IsPreview())
        {
          QStringList aParameters;
          aParameters << GroupPoints->SpinBox_DX->text();
          aParameters << GroupPoints->SpinBox_DY->text();
+         aParameters << GroupPoints->SpinBox_DZ->text();
          anObj->SetParameters(aParameters.join(":").toLatin1().constData());
        }
        res = true;
       }
-      else if(BAngle){
-       anObj = anOper->MakeCylinderPntVecRHA(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle()*M_PI/180.);
+      else {
+       anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
        if (!anObj->_is_nil() && !IsPreview())
        {
          QStringList aParameters;
          aParameters << GroupPoints->SpinBox_DX->text();
          aParameters << GroupPoints->SpinBox_DY->text();
-         aParameters << GroupPoints->SpinBox_DZ->text();
          anObj->SetParameters(aParameters.join(":").toLatin1().constData());
        }
        res = true;
@@ -464,26 +464,25 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
     }
     break;
   case 1:
-    BAngle = GroupDimensions->checkBox->isChecked();
-    if(!BAngle){
-      anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
+    if ( GroupDimensions->checkBox->isChecked() ) {
+      anObj = anOper->MakeCylinderRHA(getRadius(), getHeight(), getAngle()*M_PI/180.);
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupDimensions->SpinBox_DX->text();
        aParameters << GroupDimensions->SpinBox_DY->text();
+       aParameters << GroupDimensions->SpinBox_DZ->text();
        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
     }
-    else if(BAngle){
-      anObj = anOper->MakeCylinderRHA(getRadius(), getHeight(), getAngle()*M_PI/180.);
+    else {
+      anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupDimensions->SpinBox_DX->text();
        aParameters << GroupDimensions->SpinBox_DY->text();
-       aParameters << GroupDimensions->SpinBox_DZ->text();
        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
index b79316ba9293f87286239d6c7e0bee5959d709b1..1a5ccc46bd27a8e95025b9d0b2008be7e4231ef2 100644 (file)
@@ -77,7 +77,7 @@ private slots:
   void                               ConstructorsClicked( int );
   void                               ValueChangedInSpinBox();
   void                               SetDoubleSpinBoxStep( double );
-  void                                      ActivateAngle();
+  void                               ActivateAngle();
 };
 
 #endif // PRIMITIVEGUI_CYLINDERDLG_H