]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Add an Angle option in the cylinder primitive in order to build portion of cylinders...
authorFlorian Brunet <florian.brunet@opencascade.com>
Tue, 5 Aug 2014 12:42:10 +0000 (14:42 +0200)
committerFlorian Brunet <florian.brunet@opencascade.com>
Tue, 5 Aug 2014 12:42:10 +0000 (14:42 +0200)
19 files changed:
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
resources/GEOMCatalog.xml.in
src/DlgRef/CMakeLists.txt
src/DlgRef/DlgRef.cxx
src/DlgRef/DlgRef.h
src/DlgRef/DlgRef_3Spin1CheckCyl_QTD.ui [new file with mode: 0644]
src/GEOMImpl/GEOMImpl_CylinderDriver.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_ICylinder.hxx
src/GEOMImpl/GEOMImpl_Types.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/geomBuilder.py
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h

index bbaafca6b54fd00f8758ad997505abe4ccae0e1f..94fbc0acddeb55950329b1f44faf531bdcb75e8d 100644 (file)
@@ -1471,28 +1471,31 @@ module GEOM
     GEOM_Object MakeDiskR (in double theR, in short theOrientation);
 
     /*!
-     *  \brief Create a cylinder with given radius and height at
+     *  \brief Create a cylinder with given radius, height and angle (portion of cylinder) at
      *  the origin of coordinate system.
      *
      *  Axis of the cylinder will be collinear to the OZ axis of the coordinate system.
      *  \param theR Cylinder radius.
      *  \param theH Cylinder height.
+     *  \param theA Cylinder angle.
      *  \return New GEOM_Object, containing the created cylinder.
      */
-    GEOM_Object MakeCylinderRH (in double theR, in double theH);
+    GEOM_Object MakeCylinderRH (in double theR, in double theH, in double theA);
 
     /*!
-     *  \brief Create a cylinder with given base point, axis, radius and height.
+     *  \brief Create a cylinder with given base point, axis, radius, height and angle (portion of cylinder).
      *  \param thePnt Central point of cylinder base.
      *  \param theAxis Cylinder axis.
      *  \param theR Cylinder radius.
      *  \param theH Cylinder height.
+     *  \param theA Cylinder angle.
      *  \return New GEOM_Object, containing the created cylinder.
      */
     GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt,
                                       in GEOM_Object theAxis,
                                       in double      theR,
-                                      in double      theH);
+                                      in double      theH,
+                                     in double      theA);
 
     /*!
      *  \brief Create a cone with given height and radiuses at
index 07f7fe92fe7e74af9614f9fd5d46648644e3c182..c56f0ca57334e4485864a84eb5a302814227fe6b 100644 (file)
@@ -158,9 +158,11 @@ module GEOM
     GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt,
                                       in GEOM_Object theAxis,
                                       in double      theRadius,
-                                      in double      theHeight) ;
+                                      in double      theHeight,
+                                     in double      theAngle) ;
     GEOM_Object MakeCylinderRH (in double theR,
-                                in double theH) ;
+                                in double theH,
+                               in double theA) ;
     GEOM_Object MakeSphere (in double theX,
                             in double theY,
                             in double theZ,
index e9d665cd23c53d1ebe3cdcfac86fc4eff53f0677..43438b5bdfbe2f184d7cf250d17ff9b5126590c7 100644 (file)
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
                             </inParameter>
+                           <inParameter>
+                                <inParameter-name>theAngle</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>                         
                         </inParameter-list>
                         <outParameter-list>
                             <outParameter>
                                 <inParameter-type>double</inParameter-type>
                                 <inParameter-comment>unknown</inParameter-comment>
                             </inParameter>
+                           <inParameter>
+                                <inParameter-name>theAngle</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
                         </inParameter-list>
                         <outParameter-list>
                             <outParameter>
index 3c365438f6f9717b0bad7d76d4ecf2415b37ba94..632b2a3289abaaed4a0b125b8c2abc35f6280676 100755 (executable)
@@ -75,6 +75,7 @@ SET(_uic_files
   DlgRef_2Sel2Spin2Push_QTD.ui
   DlgRef_2Sel2Spin3Check_QTD.ui
   DlgRef_2Sel2Spin_QTD.ui
+  DlgRef_2Sel3Spin1Check_QTD.ui
   DlgRef_2Sel3Spin2Rb_QTD.ui
   DlgRef_2Sel3Spin_QTD.ui
   DlgRef_2SelExt_QTD.ui
@@ -92,6 +93,7 @@ SET(_uic_files
   DlgRef_3Sel4Spin2Check_QTD.ui
   DlgRef_3Sel_QTD.ui
   DlgRef_3Spin1Check_QTD.ui
+  DlgRef_3Spin1CheckCyl_QTD.ui
   DlgRef_3Spin_QTD.ui
   DlgRef_4Sel1List1Check_QTD.ui
   DlgRef_4Sel1List_QTD.ui
index 9a6efd71826305ca8810eae61630c69f67151f7e..efeefa4c21b5a1bb66c65f71a6f48e855429e9bd 100644 (file)
@@ -470,6 +470,20 @@ DlgRef_2Sel2Spin2Push::~DlgRef_2Sel2Spin2Push()
 {
 }
 
+//////////////////////////////////////////
+// DlgRef_2Sel3Spin1Check
+//////////////////////////////////////////
+
+DlgRef_2Sel3Spin1Check::DlgRef_2Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+DlgRef_2Sel3Spin1Check::~DlgRef_2Sel3Spin1Check()
+{
+}
+
 //////////////////////////////////////////
 // DlgRef_2Sel3Spin2Rb
 //////////////////////////////////////////
@@ -756,6 +770,20 @@ DlgRef_3Spin1Check::~DlgRef_3Spin1Check()
 {
 }
 
+//////////////////////////////////////////
+// DlgRef_3Spin1CheckCyl
+//////////////////////////////////////////
+
+DlgRef_3Spin1CheckCyl::DlgRef_3Spin1CheckCyl( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+DlgRef_3Spin1CheckCyl::~DlgRef_3Spin1CheckCyl()
+{
+}
+
 //////////////////////////////////////////
 // DlgRef_3Spin
 //////////////////////////////////////////
index c68358d1115cbcb49195ca9d83b727fed0766b11..fb3c8e0471f98e7ddc320f4f3ca211b690ab620d 100644 (file)
@@ -548,6 +548,22 @@ public:
   ~DlgRef_2Sel2Spin2Push();
 };
 
+//////////////////////////////////////////
+// DlgRef_2Sel3Spin1Check
+//////////////////////////////////////////
+
+#include "ui_DlgRef_2Sel3Spin1Check_QTD.h"
+
+class DLGREF_EXPORT DlgRef_2Sel3Spin1Check : public QWidget, 
+                                       public Ui::DlgRef_2Sel3Spin1Check_QTD
+{
+  Q_OBJECT
+
+public:
+  DlgRef_2Sel3Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~DlgRef_2Sel3Spin1Check();
+};
+
 //////////////////////////////////////////
 // DlgRef_2Sel3Spin2Rb
 //////////////////////////////////////////
@@ -826,6 +842,22 @@ public:
   ~DlgRef_3Spin1Check();
 };
 
+//////////////////////////////////////////
+// DlgRef_3Spin1CheckCyl
+//////////////////////////////////////////
+
+#include "ui_DlgRef_3Spin1CheckCyl_QTD.h"
+
+class DLGREF_EXPORT DlgRef_3Spin1CheckCyl : public QWidget, 
+                                         public Ui::DlgRef_3Spin1CheckCyl_QTD
+{
+  Q_OBJECT
+
+public:
+  DlgRef_3Spin1CheckCyl( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~DlgRef_3Spin1CheckCyl();
+};
+
 //////////////////////////////////////////
 // DlgRef_3Spin
 //////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef_3Spin1CheckCyl_QTD.ui b/src/DlgRef/DlgRef_3Spin1CheckCyl_QTD.ui
new file mode 100644 (file)
index 0000000..1747f8d
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_3Spin1CheckCyl_QTD</class>
+ <widget class="QWidget" name="DlgRef_3Spin1CheckCyl_QTD">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>611</width>
+    <height>154</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string/>
+  </property>
+  <layout class="QGridLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QGroupBox" name="GroupBox1">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="title">
+      <string/>
+     </property>
+     <layout class="QGridLayout" columnstretch="0,0,0,0" columnminimumwidth="0,0,0,280">
+      <property name="margin">
+       <number>9</number>
+      </property>
+      <property name="spacing">
+       <number>6</number>
+      </property>
+      <item row="2" column="1">
+       <widget class="QLabel" name="TextLabel3">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>TL3</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLabel" name="TextLabel2">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>TL2</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLabel" name="TextLabel1">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>TL1</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="3">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
+      </item>
+      <item row="1" column="3">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY"/>
+      </item>
+      <item row="2" column="3">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ"/>
+      </item>
+      <item row="2" column="0">
+       <widget class="QCheckBox" name="checkBox">
+        <property name="text">
+         <string>CB</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>SalomeApp_DoubleSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header location="global">SalomeApp_DoubleSpinBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>SpinBox_DX</tabstop>
+  <tabstop>SpinBox_DY</tabstop>
+  <tabstop>SpinBox_DZ</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
index 9f2d816ab533661ff8a216cc9747c9a22de16e0f..521d036781fad957f10c66a3f705e4b91fbdf9ab 100644 (file)
@@ -75,6 +75,8 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
 
   gp_Pnt aP;
   gp_Vec aV;
+  
+  TopoDS_Shape aShape;
 
   if (aType == CYLINDER_R_H) {
     aP = gp::Origin();
@@ -109,14 +111,15 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
 
   if (aCI.GetH() < 0.0) aV.Reverse();
   gp_Ax2 anAxes (aP, aV);
-
-  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");
-  }
-
-  TopoDS_Shape aShape = MC.Shape();
+  aShape = BRepPrimAPI_MakeCylinder(anAxes, aCI.GetR(), Abs(aCI.GetH())).Shape();
+  if(aCI.GetA() < 360. && aCI.GetA()> 0.){
+    BRepPrimAPI_MakeCylinder MC(anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA()*M_PI/180.);
+    MC.Build();
+    if (!MC.IsDone()) {
+      StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+    }
+    aShape = MC.Shape();       
+  }    
   if (aShape.IsNull()) return 0;
 
   aFunction->SetValue(aShape);
index 1e345fa045197301fda94060d78d55937192fd77..f4139be062cb7586fd18a61042a68a30ab94a6d3 100644 (file)
@@ -488,7 +488,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theO
  *  MakeCylinderRH
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH)
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH, double theA)
 {
   SetErrorCode(KO);
 
@@ -506,6 +506,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
 
   aCI.SetR(theR);
   aCI.SetH(theH);
+  aCI.SetA(theA);
 
   //Compute the Cylinder value
   try {
@@ -525,7 +526,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
 
   //Make a Python command
   GEOM::TPythonDump(aFunction) << aCylinder
-    << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")";
+    << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ", " << theA << ")";
 
   SetErrorCode(OK);
   return aCylinder;
@@ -539,7 +540,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
                                                                       Handle(GEOM_Object) theVec,
-                                                                      double theR, double theH)
+                                                                      double theR, double theH, double theA)
 {
   SetErrorCode(KO);
 
@@ -567,6 +568,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
   aCI.SetVector(aRefVec);
   aCI.SetR(theR);
   aCI.SetH(theH);
+  aCI.SetA(theA);
 
   //Compute the Cylinder value
   try {
@@ -586,7 +588,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
 
   //Make a Python command
   GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
-    << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
+    << thePnt << ", " << theVec << ", " << theR << ", " << theH << ", " << theA << ")";
 
   SetErrorCode(OK);
   return aCylinder;
index 36d0ac6b21121b969fd5d2f3cfab00aa7f644317..d0ae755888c477a04b5422c2c4c8da07604e8d00 100644 (file)
@@ -48,10 +48,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
                                                        Handle(GEOM_Object) theVec,
                                                        double theR);
   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) MakeCylinderRH       (double theR, double theH, double theA);
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
                                             Handle(GEOM_Object) theVec,
-                                            double theR, double theH);
+                                            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,
index f13ac776075c8d7de17eacc8cec8a941b5dcb7d5..0955df29c4297699fb39f72cc43a9e455bc1a6cc 100644 (file)
 //
 #include "GEOM_Function.hxx"
 
-#define CYL_ARG_R   1
-#define CYL_ARG_H   2
-#define CYL_ARG_PNT 3
-#define CYL_ARG_VEC 4
+#define CYL_ARG_PNT 1
+#define CYL_ARG_VEC 2
+#define CYL_ARG_R   3
+#define CYL_ARG_H   4
+#define CYL_ARG_A   5
+
+
 
 class GEOMImpl_ICylinder
 {
@@ -42,6 +45,10 @@ class GEOMImpl_ICylinder
   void SetH(double theH) { _func->SetReal(CYL_ARG_H, theH); }
 
   double GetH() { return _func->GetReal(CYL_ARG_H); }
+  
+  void SetA(double theA) { _func->SetReal(CYL_ARG_A, theA); }
+
+  double GetA() { return _func->GetReal(CYL_ARG_A); }
 
   void SetPoint(Handle(GEOM_Function) theRefPoint) { _func->SetReference(CYL_ARG_PNT, theRefPoint); }
 
index 4f4792448326a6f9410d396c2aede5ff41b419d0..57093b4e635632cb2d47314cad7347d952f160cb 100755 (executable)
 #define DISK_THREE_PNT    2
 #define DISK_R            3
 
-#define CYLINDER_R_H         1
-#define CYLINDER_PNT_VEC_R_H 2
+#define CYLINDER_R_H           1
+#define CYLINDER_PNT_VEC_R_H   2 
 
 #define CONE_R1_R2_H         1
 #define CONE_PNT_VEC_R1_R2_H 2
index 2d1960361771dfc7e1e73452eb563bbcb212e107..68dc7927993416b461da603cdb0913b06f999938 100644 (file)
@@ -246,7 +246,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
-                                                                CORBA::Double theH)
+                                                                CORBA::Double theH,
+                                                               CORBA::Double theA)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -254,7 +255,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
   GetOperations()->SetNotDone();
 
   //Create the Cylinder
-  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH, theA);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -268,7 +269,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                       CORBA::Double theR, CORBA::Double theH)
+                       CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -282,7 +283,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
   //Create the Cylinder
-  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH, theA);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index a475188211fc0c9e1a2a98fd079abab87a13107c..63d5fa4be31546b2cf6dd27b6a39eee06ca82595 100644 (file)
@@ -69,13 +69,15 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
                                   CORBA::Short  theOrientation);
 
   GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
-                                       CORBA::Double theH);
-
+                                       CORBA::Double theH,
+                                       CORBA::Double theA);
+  
   GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
                                              GEOM::GEOM_Object_ptr theVec,
                                              CORBA::Double theR,
-                                             CORBA::Double theH);
-
+                                             CORBA::Double theH,
+                                             CORBA::Double theA);
+  
   GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1,
                                       CORBA::Double theR2,
                                       CORBA::Double theH);
index 792cbe5ae2efbf0af16cd4296b45b7cd0359f332..d706563787da36134f318b19681683147d7d9007 100644 (file)
@@ -1049,12 +1049,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskR (CORBA::Double theR,
 GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
                                                            GEOM::GEOM_Object_ptr theAxis,
                                                            CORBA::Double theRadius,
-                                                           CORBA::Double theHeight)
+                                                           CORBA::Double theHeight,
+                                                          CORBA::Double theAngle)
 {
   beginService( " GEOM_Superv_i::MakeCylinderPntVecRH" );
   MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRH");
   get3DPrimOp();
-  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRH(thePnt, theAxis, theRadius, theHeight);
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRH(thePnt, theAxis, theRadius, theHeight, theAngle);
   endService( " GEOM_Superv_i::MakeCylinderPntVecRH" );
   return anObj;
 }
@@ -1063,12 +1064,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr
 //  MakeCylinderRH:
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR,
-                                                     CORBA::Double theH)
+                                                     CORBA::Double theH,
+                                                    CORBA::Double theA)
 {
   beginService( " GEOM_Superv_i::MakeCylinderRH" );
   MESSAGE("GEOM_Superv_i::MakeCylinderRH");
   get3DPrimOp();
-  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRH(theR, theH);
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRH(theR, theH, theA);
   endService( " GEOM_Superv_i::MakeCylinderRH" );
   return anObj;
 }
index 8058cc132897ff35c06bdb77fd306d2d63a8663d..627be479754bca4ec83bc3cb34e1937c9782779f 100644 (file)
@@ -243,9 +243,11 @@ public:
   GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
                                               GEOM::GEOM_Object_ptr theAxis,
                                               CORBA::Double theRadius,
-                                              CORBA::Double theHeight);
+                                              CORBA::Double theHeight,
+                                             CORBA::Double theAngle);
   GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
-                                        CORBA::Double theH);
+                                        CORBA::Double theH,
+                                       CORBA::Double theA);
   GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
                                     CORBA::Double theY,
                                     CORBA::Double theZ,
index 925e2d72eb223e8e777b746b69427ae75a40e589..3f6c012d87e71105c8f487ccd3e058b596dc698a 100644 (file)
@@ -2969,11 +2969,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "disk")
             return anObj
 
-        ## Create a cylinder with given base point, axis, radius and height.
+        ## Create a cylinder with given base point, axis, radius, height and angle (for a portion of cylinder).
         #  @param thePnt Central point of cylinder base.
         #  @param theAxis Cylinder axis.
         #  @param theR Cylinder radius.
         #  @param theH Cylinder height.
+        #  @param theA Cylinder angle in radian.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -2982,15 +2983,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_creation_cylinder "Example"
         @ManageTransactions("PrimOp")
-        def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
+        def MakeCylinder(self, thePnt, theAxis, theR, theH, theA=2*math.pi, theName=None):
             """
-            Create a cylinder with given base point, axis, radius and height.
+            Create a cylinder with given base point, axis, radius, height and angle (for a portion of cylinder).
 
             Parameters:
                 thePnt Central point of cylinder base.
                 theAxis Cylinder axis.
                 theR Cylinder radius.
                 theH Cylinder height.
+                theA Cylinder angle in radian.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -2999,18 +3001,20 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created cylinder.
             """
             # Example: see GEOM_TestAll.py
-            theR,theH,Parameters = ParseParameters(theR, theH)
-            anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
+            theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)  
+           anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH, theA)
+            
             RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "cylinder")
             return anObj
 
-        ## Create a cylinder with given radius and height at
+        ## Create a cylinder with given radius, height and angle (for a portion of cylinder) at
         #  the origin of coordinate system. Axis of the cylinder
         #  will be collinear to the OZ axis of the coordinate system.
         #  @param theR Cylinder radius.
         #  @param theH Cylinder height.
+        #  @param theA Cylinder angle in radian.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -3019,15 +3023,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_creation_cylinder "Example"
         @ManageTransactions("PrimOp")
-        def MakeCylinderRH(self, theR, theH, theName=None):
+        def MakeCylinderRH(self, theR, theH, theA=2*math.pi, theName=None):
             """
-            Create a cylinder with given radius and height at
+            Create a cylinder with given radius, height and angle (for a portion of cylinder)at
             the origin of coordinate system. Axis of the cylinder
             will be collinear to the OZ axis of the coordinate system.
 
             Parameters:
                 theR Cylinder radius.
                 theH Cylinder height.
+                theA Cylinder angle in radian.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -3036,8 +3041,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created cylinder.
             """
             # Example: see GEOM_TestAll.py
-            theR,theH,Parameters = ParseParameters(theR, theH)
-            anObj = self.PrimOp.MakeCylinderRH(theR, theH)
+            theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
+           anObj = self.PrimOp.MakeCylinderRH(theR, theH, theA)
+               
             RaiseIfFailed("MakeCylinderRH", self.PrimOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "cylinder")
index e27701c60b6598f9211bf500168b548c85b1935b..e12b35a356b3b0601f396c6e463aa19806f931c6 100644 (file)
@@ -70,20 +70,26 @@ PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg (GeometryGUI* theGeometryGUI,
   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
   mainFrame()->RadioButton3->close();
 
-  GroupPoints = new DlgRef_2Sel2Spin(centralWidget());
+  GroupPoints = new DlgRef_2Sel3Spin1Check(centralWidget());
   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
   GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
   GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS"));
   GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT"));
+  GroupPoints->TextLabel5->setText(tr("GEOM_ANGLE"));
+  GroupPoints->checkBox->setText(tr(""));
   GroupPoints->PushButton1->setIcon(image2);
   GroupPoints->PushButton2->setIcon(image2);
+  GroupPoints->SpinBox_DZ->setDisabled(true);
 
-  GroupDimensions = new DlgRef_2Spin(centralWidget());
+  GroupDimensions = new DlgRef_3Spin1CheckCyl(centralWidget());
   GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
   GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));
   GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT"));
-
+  GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
+  GroupDimensions->checkBox->setText(tr(""));
+  GroupDimensions->SpinBox_DZ->setDisabled(true);
+  
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
   layout->addWidget(GroupPoints);
@@ -117,8 +123,11 @@ void PrimitiveGUI_CylinderDlg::Init()
   // min, max, step and decimals for spin boxes & initial values
   initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
   initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
+  initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, 360., step, "length_precision" );
   initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
   initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
+  initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, 360., step, "length_precision" );
+  
 
   // init variables
   myEditCurrentArgument = GroupPoints->LineEdit1;
@@ -130,11 +139,13 @@ void PrimitiveGUI_CylinderDlg::Init()
   myPoint.nullify();
   myDir.nullify();
 
-  double aRadius(100.0), aHeight(300.0);
+  double aRadius(100.0), aHeight(300.0), aAngle(360.);
   GroupPoints->SpinBox_DX->setValue(aRadius);
   GroupPoints->SpinBox_DY->setValue(aHeight);
+  GroupPoints->SpinBox_DZ->setValue(aAngle);
   GroupDimensions->SpinBox_DX->setValue(aRadius);
   GroupDimensions->SpinBox_DY->setValue(aHeight);
+  GroupDimensions->SpinBox_DZ->setValue(aAngle);
 
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@@ -147,10 +158,15 @@ void PrimitiveGUI_CylinderDlg::Init()
 
   connect(GroupPoints->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupPoints->SpinBox_DZ,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
 
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
+  
+  connect(GroupPoints->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
+  connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
 
   initName(tr("GEOM_CYLINDER"));
 
@@ -166,8 +182,10 @@ void PrimitiveGUI_CylinderDlg::SetDoubleSpinBoxStep (double step)
 {
   GroupPoints->SpinBox_DX->setSingleStep(step);
   GroupPoints->SpinBox_DY->setSingleStep(step);
+  GroupPoints->SpinBox_DZ->setSingleStep(step);
   GroupDimensions->SpinBox_DX->setSingleStep(step);
   GroupDimensions->SpinBox_DY->setSingleStep(step);
+  GroupDimensions->SpinBox_DZ->setSingleStep(step);
 }
 
 //=================================================================================
@@ -378,14 +396,17 @@ 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() ) &&
          myPoint && myDir;
   }
   else if( getConstructorId() == 1 )
   {
     ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
-         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() );
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
   }
   ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
+  ok = qAbs( getRadius() ) > Precision::Confusion() && ok;
   return ok;
 }
 
@@ -396,32 +417,38 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
 bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
 {
   bool res = false;
-
+  bool BAngle = false;
   GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
 
   switch (getConstructorId()) {
   case 0:
+    BAngle = GroupPoints->checkBox->isChecked();
     if ( myPoint && myDir ) {
-      anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
+      if(!BAngle) anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight(), 360.);
+      else anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle());
       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;
     }
     break;
   case 1:
-    anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
+    BAngle = GroupDimensions->checkBox->isChecked();
+    if(!BAngle)anObj = anOper->MakeCylinderRH(getRadius(), getHeight(), 360.);
+    else anObj = anOper->MakeCylinderRH(getRadius(), getHeight(), getAngle());
     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;
@@ -462,6 +489,20 @@ double PrimitiveGUI_CylinderDlg::getHeight() const
   return 0;
 }
 
+//=================================================================================
+// function : getAngle()
+// purpose  :
+//=================================================================================
+double PrimitiveGUI_CylinderDlg::getAngle() const
+{
+  int aConstructorId = getConstructorId();
+  if (aConstructorId == 0)
+    return GroupPoints->SpinBox_DZ->value();
+  else if (aConstructorId == 1)
+    return GroupDimensions->SpinBox_DZ->value();
+  return 0;
+}
+
 //=================================================================================
 // function : addSubshapeToStudy
 // purpose  : virtual method to add new SubObjects if local selection
@@ -473,3 +514,20 @@ void PrimitiveGUI_CylinderDlg::addSubshapesToStudy()
     GEOMBase::PublishSubObject( myDir.get() );
   }
 }
+
+//=================================================================================
+// function :  ActivateAngle()
+// purpose  : enable the 
+//=================================================================================
+void PrimitiveGUI_CylinderDlg::ActivateAngle()
+{
+  int aConstructorId = getConstructorId();
+  if (aConstructorId == 0){
+    GroupPoints->SpinBox_DZ->setEnabled( GroupPoints->checkBox->isChecked() );
+    processPreview();
+  }
+  else if (aConstructorId == 1){
+    GroupDimensions->SpinBox_DZ->setEnabled( GroupDimensions->checkBox->isChecked() );
+    processPreview();
+  }
+}
\ No newline at end of file
index 6514d87a82316b2c0d649048e8b2ba6812e09feb..b79316ba9293f87286239d6c7e0bee5959d709b1 100644 (file)
@@ -30,8 +30,8 @@
 #include "GEOMBase_Skeleton.h"
 #include "GEOM_GenericObjPtr.h"
 
-class DlgRef_2Sel2Spin;
-class DlgRef_2Spin;
+class DlgRef_2Sel3Spin1Check;
+class DlgRef_3Spin1CheckCyl;
 
 //=================================================================================
 // class    : PrimitiveGUI_CylinderDlg
@@ -57,6 +57,7 @@ private:
   void                               enterEvent( QEvent* );
   double                             getRadius() const;
   double                             getHeight() const;
+  double                             getAngle() const;
   
 private:
   GEOM::GeomObjPtr                   myPoint, myDir;
@@ -64,8 +65,8 @@ private:
   // to initialize the first selection field with a selected object on the dialog creation
   bool                               myInitial;
   
-  DlgRef_2Sel2Spin*                  GroupPoints;
-  DlgRef_2Spin*                      GroupDimensions;
+  DlgRef_2Sel3Spin1Check*            GroupPoints;
+  DlgRef_3Spin1CheckCyl*             GroupDimensions;
 
 private slots:
   void                               ClickOnOk();
@@ -76,6 +77,7 @@ private slots:
   void                               ConstructorsClicked( int );
   void                               ValueChangedInSpinBox();
   void                               SetDoubleSpinBoxStep( double );
+  void                                      ActivateAngle();
 };
 
 #endif // PRIMITIVEGUI_CYLINDERDLG_H