]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Merge branch 'fbt/addAngleInCylPrimitive'
authorvsr <vsr@opencascade.com>
Wed, 13 Aug 2014 05:07:24 +0000 (09:07 +0400)
committervsr <vsr@opencascade.com>
Wed, 13 Aug 2014 05:07:24 +0000 (09:07 +0400)
28 files changed:
doc/salome/examples/primitives_ex02.py
doc/salome/gui/GEOM/images/cylinder1.png
doc/salome/gui/GEOM/images/cylinder2.png
doc/salome/gui/GEOM/images/cylinders.png
doc/salome/gui/GEOM/input/creating_cylinder.doc
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_2Sel3Spin1Check_QTD.ui [new file with mode: 0644]
src/DlgRef/DlgRef_3Spin1CheckCyl_QTD.ui [new file with mode: 0644]
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
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/GEOM_TestAll.py
src/GEOM_SWIG/geomBuilder.py
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h

index d55d6510fdeb7b50fee463ab4ca1bd1775b0cc9a..a0e73ff5fbd3c96af4155ae73d64c228d1a983e9 100644 (file)
@@ -6,6 +6,7 @@ import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
+import math
 gg = salome.ImportComponentGUI("GEOM")
 
 # create a vertex and a vector
@@ -18,16 +19,28 @@ height = 40
 
 radius1 = 15
 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.)
 
 # 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")
 
 # 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)
index 089dac2824f1261ff7d6fb63291984d564f11ee1..6dc21ce5146d7948c6ba3e7218ecc26b37d0d699 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/cylinder1.png and b/doc/salome/gui/GEOM/images/cylinder1.png differ
index ad6af2947a922418cdeb744e616fc81066dbf83f..b9ed9cd82066f3c7a9aaf011042e65ab7802b86c 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/cylinder2.png and b/doc/salome/gui/GEOM/images/cylinder2.png differ
index fc0d43276724ce5471d27a56249ac7bae4f22478..b9a2608a703853087a65e631c83271b8b18c0557 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/cylinders.png and b/doc/salome/gui/GEOM/images/cylinders.png differ
index 1e1cbc16d289a88770d0ca89d19e1243ce93eaed..49f19bf644418b119736f80b361c3d6308ca0dba 100644 (file)
@@ -15,6 +15,11 @@ and its dimensions: the Radius and the Height.
 \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
@@ -24,6 +29,11 @@ will be collinear to the OZ axis of the coordinate system.
 \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).
+
 \image html cylinder2.png
 
 <b>Example:</b>
index bbaafca6b54fd00f8758ad997505abe4ccae0e1f..c1e4b2c5c63137261d8583a34da5a4b6e19edf2e 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
@@ -1482,7 +1482,19 @@ module GEOM
     GEOM_Object MakeCylinderRH (in double theR, in double theH);
 
     /*!
-     *  \brief Create a cylinder with given base point, axis, radius and height.
+     *  \brief Create a portion of cylinder with given radius, height and angle 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 MakeCylinderRHA (in double theR, in double theH, in double theA);
+
+    /*!
+     *  \brief Create a cylinder with given base point, axis, radius, height and angle.
      *  \param thePnt Central point of cylinder base.
      *  \param theAxis Cylinder axis.
      *  \param theR Cylinder radius.
@@ -1493,6 +1505,20 @@ module GEOM
                                       in GEOM_Object theAxis,
                                       in double      theR,
                                       in double      theH);
+    /*!
+     *  \brief Create a portion of cylinder with given base point, axis, radius, height and angle.
+     *  \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 MakeCylinderPntVecRHA (in GEOM_Object thePnt,
+                                      in GEOM_Object theAxis,
+                                      in double      theR,
+                                      in double      theH,
+                                     in double      theA);
 
     /*!
      *  \brief Create a cone with given height and radiuses at
index 07f7fe92fe7e74af9614f9fd5d46648644e3c182..3c5972437185d6349ed52431261bf2ec8ec4fe94 100644 (file)
@@ -161,6 +161,14 @@ module GEOM
                                       in double      theHeight) ;
     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) ;
+    GEOM_Object MakeCylinderRHA (in double theR,
+                                in double theH,
+                               in double theA) ;
     GEOM_Object MakeSphere (in double theX,
                             in double theY,
                             in double theZ,
index e9d665cd23c53d1ebe3cdcfac86fc4eff53f0677..db3ec4288ccc6c79ec61de4019962f0afe114c12 100644 (file)
                         </outParameter-list>
                         <DataStream-list></DataStream-list>
                     </component-service>
+                   <component-service>
+                        <service-name>MakeCylinderPntVecRHA</service-name>
+                        <service-author></service-author>
+                        <service-version></service-version>
+                        <service-comment>unknown</service-comment>
+                        <service-by-default>0</service-by-default>
+                        <inParameter-list>
+                            <inParameter>
+                                <inParameter-name>thePnt</inParameter-name>
+                                <inParameter-type>GEOM_Object</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                            <inParameter>
+                                <inParameter-name>theAxis</inParameter-name>
+                                <inParameter-type>GEOM_Object</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                            <inParameter>
+                                <inParameter-name>theRadius</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                            <inParameter>
+                                <inParameter-name>theHeight</inParameter-name>
+                                <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>
+                                <outParameter-name>return</outParameter-name>
+                                <outParameter-type>GEOM_Object</outParameter-type>
+                                <outParameter-comment>unknown</outParameter-comment>
+                            </outParameter>
+                        </outParameter-list>
+                        <DataStream-list></DataStream-list>
+                    </component-service>
+                    <component-service>
+                        <service-name>MakeCylinderRHA</service-name>
+                        <service-author></service-author>
+                        <service-version></service-version>
+                        <service-comment>unknown</service-comment>
+                        <service-by-default>0</service-by-default>
+                        <inParameter-list>
+                            <inParameter>
+                                <inParameter-name>theR</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                            <inParameter>
+                                <inParameter-name>theH</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                           <inParameter>
+                                <inParameter-name>theA</inParameter-name>
+                                <inParameter-type>double</inParameter-type>
+                                <inParameter-comment>unknown</inParameter-comment>
+                            </inParameter>
+                        </inParameter-list>
+                        <outParameter-list>
+                            <outParameter>
+                                <outParameter-name>return</outParameter-name>
+                                <outParameter-type>GEOM_Object</outParameter-type>
+                                <outParameter-comment>unknown</outParameter-comment>
+                            </outParameter>
+                        </outParameter-list>
+                        <DataStream-list></DataStream-list>
+                    </component-service>
                     <component-service>
                         <service-name>MakeSphere</service-name>
                         <service-author></service-author>
index 3c365438f6f9717b0bad7d76d4ecf2415b37ba94..61e6a2dfab105fe75f35abe88022a309d50fcdef 100755 (executable)
@@ -77,6 +77,7 @@ SET(_uic_files
   DlgRef_2Sel2Spin_QTD.ui
   DlgRef_2Sel3Spin2Rb_QTD.ui
   DlgRef_2Sel3Spin_QTD.ui
+  DlgRef_2Sel3Spin1Check_QTD.ui
   DlgRef_2SelExt_QTD.ui
   DlgRef_2Sel_QTD.ui
   DlgRef_2Spin_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_2Sel3Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel3Spin1Check_QTD.ui
new file mode 100644 (file)
index 0000000..d652b9a
--- /dev/null
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_2Sel3Spin1Check_QTD</class>
+ <widget class="QWidget" name="DlgRef_2Sel3Spin1Check_QTD">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>323</width>
+    <height>223</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string/>
+  </property>
+  <layout class="QGridLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>6</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QGroupBox" name="GroupBox1">
+     <property name="title">
+      <string/>
+     </property>
+     <layout class="QGridLayout">
+      <property name="margin">
+       <number>9</number>
+      </property>
+      <property name="spacing">
+       <number>6</number>
+      </property>
+      <item row="5" column="1">
+       <widget class="QLabel" name="TextLabel4">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>TL4</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="3" 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="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="1" column="3">
+       <widget class="QLineEdit" name="LineEdit1"/>
+      </item>
+      <item row="2" 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="1" column="2">
+       <widget class="QPushButton" name="PushButton1">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="3">
+       <widget class="QLineEdit" name="LineEdit2"/>
+      </item>
+      <item row="2" column="2">
+       <widget class="QPushButton" name="PushButton2">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="2" colspan="2">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
+      </item>
+      <item row="6" column="2" colspan="2">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ"/>
+      </item>
+      <item row="5" column="2" colspan="2">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY"/>
+      </item>
+      <item row="6" column="1">
+       <widget class="QLabel" name="TextLabel5">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>TL5</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="6" 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>PushButton1</tabstop>
+  <tabstop>LineEdit1</tabstop>
+  <tabstop>PushButton2</tabstop>
+  <tabstop>LineEdit2</tabstop>
+  <tabstop>SpinBox_DX</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
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 04e9f9d6b3d0f216b01330e36b8353dd3f745367..c8a36982d1b4b362981ab012fcf02a2343f8eba7 100644 (file)
@@ -535,6 +535,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_CYLINDER_TITLE</source>
         <translation>Cylinder Construction</translation>
     </message>
+    <message>
+        <source>GEOM_CYLINDER_ANGLE_ERR</source>
+        <translation>Angle values 0 and 360 are unsafe to build proper volumes. Please uncheck the "Angle" box to use the regular cylinder constructor.</translation>
+    </message>
     <message>
         <source>GEOM_D1</source>
         <translation>D1 :</translation>
index 20d5ebe4edf192e07e6e38197c2af9d8c924826e..af43089e2bbf70e935595e2ac4256e3967f1420d 100644 (file)
@@ -547,6 +547,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_CYLINDER_TITLE</source>
         <translation>Construction d&apos;un cylindre </translation>
     </message>
+    <message>
+        <source>GEOM_CYLINDER_ANGLE_ERR</source>
+        <translation>Les valeurs de l'angle 0 et 360 sont à éviter pour construire des volumes sains. Veuillez décocher la case "Angle" pour utiliser le constructeur de cylindre complet.</translation>
+    </message>
     <message>
         <source>GEOM_D1</source>
         <translation>D1 :</translation>
index 9f2d816ab533661ff8a216cc9747c9a22de16e0f..42dd86b7ce863b0b5acd69cf7b72a2c151529d8e 100644 (file)
@@ -76,11 +76,11 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
   gp_Pnt aP;
   gp_Vec aV;
 
-  if (aType == CYLINDER_R_H) {
+  if (aType == CYLINDER_R_H || aType == CYLINDER_R_H_A) {
     aP = gp::Origin();
     aV = gp::DZ();
   }
-  else if (aType == CYLINDER_PNT_VEC_R_H) {
+  else if (aType == CYLINDER_PNT_VEC_R_H || aType == CYLINDER_PNT_VEC_R_H_A) {
     Handle(GEOM_Function) aRefPoint  = aCI.GetPoint();
     Handle(GEOM_Function) aRefVector = aCI.GetVector();
     TopoDS_Shape aShapePnt = aRefPoint->GetValue();
@@ -109,20 +109,41 @@ 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");
+  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");
+    }
+    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;
+    }
+    aShape = MCA.Shape();
+    break;
+  }
+  default:
+    return 0;
   }
-
-  TopoDS_Shape aShape = MC.Shape();
   if (aShape.IsNull()) return 0;
-
   aFunction->SetValue(aShape);
 
   log.SetTouched(Label());
-
   return 1;
 }
 
index 1e345fa045197301fda94060d78d55937192fd77..f3f33f96973e2f67fb5d0c94cd02af3f442dc935 100644 (file)
@@ -531,6 +531,54 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
   return aCylinder;
 }
 
+//=============================================================================
+/*!
+ *  MakeCylinderRHA
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRHA (double theR, double theH, double theA)
+{
+  SetErrorCode(KO);
+
+  //Add a new Cylinder object
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+
+  //Add a new Cylinder function with R and H parameters
+  Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H_A);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
+
+  GEOMImpl_ICylinder aCI (aFunction);
+
+  aCI.SetR(theR);
+  aCI.SetH(theH);
+  aCI.SetA(theA);
+
+  //Compute the Cylinder value
+  try {
+#if OCC_VERSION_LARGE > 0x06010000
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Cylinder driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aCylinder
+    << " = geompy.MakeCylinderRHA(" << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
+
+  SetErrorCode(OK);
+  return aCylinder;
+}
 
 //=============================================================================
 /*!
@@ -592,6 +640,67 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
   return aCylinder;
 }
 
+//=============================================================================
+/*!
+ *  MakeCylinderPntVecRHA
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
+                                                                      Handle(GEOM_Object) theVec,
+                                                                      double theR, double theH, double theA)
+{
+  SetErrorCode(KO);
+
+  if (thePnt.IsNull() || theVec.IsNull()) return NULL;
+
+  //Add a new Cylinder object
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+
+  //Add a new Cylinder function for creation a cylinder relatively to point and vector
+  Handle(GEOM_Function) aFunction =
+    aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H_A);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
+
+  GEOMImpl_ICylinder aCI (aFunction);
+
+  Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
+  Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
+
+  if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
+
+  aCI.SetPoint(aRefPnt);
+  aCI.SetVector(aRefVec);
+  aCI.SetR(theR);
+  aCI.SetH(theH);
+  aCI.SetA(theA);
+
+  //Compute the Cylinder value
+  try {
+#if OCC_VERSION_LARGE > 0x06010000
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Cylinder driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinderA("
+    << thePnt << ", " << theVec << ", " << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
+
+  SetErrorCode(OK);
+  return aCylinder;
+}
+
 
 //=============================================================================
 /*!
index 36d0ac6b21121b969fd5d2f3cfab00aa7f644317..84a643afcfe23e3fdcddecce66ff06186f59d48f 100644 (file)
@@ -52,6 +52,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
                                             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);                                        
 
   Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H       (double theR1, double theR2, double theH);
   Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
index f13ac776075c8d7de17eacc8cec8a941b5dcb7d5..c092c950eea5f4c4c02642c0aff56ba14197603e 100644 (file)
@@ -28,6 +28,7 @@
 #define CYL_ARG_H   2
 #define CYL_ARG_PNT 3
 #define CYL_ARG_VEC 4
+#define CYL_ARG_A   5
 
 class GEOMImpl_ICylinder
 {
@@ -50,6 +51,10 @@ class GEOMImpl_ICylinder
   void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(CYL_ARG_VEC, theRefVector); }
 
   Handle(GEOM_Function) GetVector() { return _func->GetReference(CYL_ARG_VEC); }
+  
+  void SetA(double theA) { _func->SetReal(CYL_ARG_A, theA); }
+
+  double GetA() { return _func->GetReal(CYL_ARG_A); }
 
  private:
 
index 4f4792448326a6f9410d396c2aede5ff41b419d0..b57080a9ca11d09c8003f7eb354c2898e6b1a1ad 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 CYLINDER_R_H_A         3
+#define CYLINDER_PNT_VEC_R_H_A         4
 
 #define CONE_R1_R2_H         1
 #define CONE_PNT_VEC_R1_R2_H 2
index 2d1960361771dfc7e1e73452eb563bbcb212e107..5f01b7c91f3a83058865cd0d13dc1e208878998a 100644 (file)
@@ -261,6 +261,28 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeCylinderRHA
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
+                                                                CORBA::Double theH,
+                                                               CORBA::Double theA)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Create the Cylinder
+  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRHA(theR, theH, theA);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakeCylinderPntVecRH
@@ -289,6 +311,34 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeCylinderPntVecRHA
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRHA
+                      (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
+                       CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference points
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
+
+  if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+
+  //Create the Cylinder
+  Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRHA(aPnt, aVec, theR, theH, theA);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakeConeR1R2H
index a475188211fc0c9e1a2a98fd079abab87a13107c..f78e1c0890458fd1dba18f8cd6b05c05b3fd7e77 100644 (file)
@@ -75,6 +75,16 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
                                              GEOM::GEOM_Object_ptr theVec,
                                              CORBA::Double theR,
                                              CORBA::Double theH);
+                                             
+  GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
+                                       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 MakeConeR1R2H (CORBA::Double theR1,
                                       CORBA::Double theR2,
index 792cbe5ae2efbf0af16cd4296b45b7cd0359f332..801ea5e709a2136fb62fa54b781b666e369c24eb 100644 (file)
@@ -1073,6 +1073,38 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR,
   return anObj;
 }
 
+//=============================================================================
+//  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)
+{
+  beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
+  MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA");
+  get3DPrimOp();
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRHA(thePnt, theAxis, theRadius, theHeight, theAngle);
+  endService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
+  return anObj;
+}
+
+//=============================================================================
+//  MakeCylinderRHA:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR,
+                                                     CORBA::Double theH,
+                                                    CORBA::Double theA)
+{
+  beginService( " GEOM_Superv_i::MakeCylinderRHA" );
+  MESSAGE("GEOM_Superv_i::MakeCylinderRHA");
+  get3DPrimOp();
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRHA(theR, theH, theA);
+  endService( " GEOM_Superv_i::MakeCylinderRHA" );
+  return anObj;
+}
+
 //=============================================================================
 //  MakeSphere:
 //=============================================================================
index 8058cc132897ff35c06bdb77fd306d2d63a8663d..4d827589e4f2dcda60bc6e48474e858208a667a6 100644 (file)
@@ -246,6 +246,14 @@ public:
                                               CORBA::Double theHeight);
   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 MakeCylinderRHA (CORBA::Double theR,
+                                        CORBA::Double theH,
+                                       CORBA::Double theA);                                    
   GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
                                     CORBA::Double theY,
                                     CORBA::Double theZ,
index 28635865cf607d8936076093e1cb7d7644fd05e6..62eec35c830a86497dd19f0341bf1e8702a225d0 100644 (file)
@@ -147,18 +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
-  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, 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
 
   #Boolean (Common, Cut, Fuse, Section)
   Common  = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
@@ -372,6 +374,8 @@ def TestAll (geompy, math):
   id_Box2     = geompy.addToStudy(Box2,     "Box (10,20,30)-(15,25,35)")
   id_Cylinder = geompy.addToStudy(Cylinder, "Cylinder")
   id_Cyl1     = geompy.addToStudy(Cyl1,     "Cylinder RH")
+  id_Cylinder1= geompy.addToStudy(Cylinder1,"CylinderA")
+  id_Cyl2     = geompy.addToStudy(Cyl2,     "Cylinder RHA")
   id_Sphere   = geompy.addToStudy(Sphere,   "Sphere Pnt R")
   id_Sphere1  = geompy.addToStudy(Sphere1,  "Sphere R")
   id_Sphere2  = geompy.addToStudy(Sphere2,  "Sphere")
index 925e2d72eb223e8e777b746b69427ae75a40e589..c64bd6f406e08db5b48ef9d5cc45995bf3fafb08 100644 (file)
@@ -3005,6 +3005,50 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "cylinder")
             return anObj
+            
+        ## Create a portion of cylinder with given base point, axis, radius, height and angle.
+        #  @param thePnt Central point of cylinder base.
+        #  @param theAxis Cylinder axis.
+        #  @param theR Cylinder radius.
+        #  @param theH Cylinder height.
+        #  @param theA Cylinder angle in radians.
+        #  @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.
+        #
+        #  @return New GEOM.GEOM_Object, containing the created cylinder.
+        #
+        #  @ref tui_creation_cylinder "Example"
+        @ManageTransactions("PrimOp")
+        def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
+            """
+            Create a a portion of cylinder with given base point, axis, radius, height and angle.
+
+            Parameters:
+                thePnt Central point of cylinder base.
+                theAxis Cylinder axis.
+                theR Cylinder radius.
+                theH Cylinder height.
+                theA Cylinder angle in radians.
+                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.
+
+            Returns:
+                New GEOM.GEOM_Object, containing the created cylinder.
+            """
+            # Example: see GEOM_TestAll.py
+            flag = False
+            if isinstance(theA,str):
+                flag = True
+            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")
+            return anObj
 
         ## Create a cylinder with given radius and height at
         #  the origin of coordinate system. Axis of the cylinder
@@ -3042,6 +3086,50 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "cylinder")
             return anObj
+            
+        ## Create a portion of cylinder with given radius, height and angle 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 radians.
+        #  @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.
+        #
+        #  @return New GEOM.GEOM_Object, containing the created cylinder.
+        #
+        #  @ref tui_creation_cylinder "Example"
+        @ManageTransactions("PrimOp")
+        def MakeCylinderRHA(self, theR, theH, theA, theName=None):
+            """
+            Create a portion of cylinder with given radius, height and angle 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 radians.
+                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.
+
+            Returns:
+                New GEOM.GEOM_Object, containing the created cylinder.
+            """
+            # Example: see GEOM_TestAll.py
+            flag = False
+            if isinstance(theA,str):
+                flag = True
+            theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
+            if flag:
+                theA = theA*math.pi/180.
+            anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
+            RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
+            anObj.SetParameters(Parameters)
+            self._autoPublish(anObj, theName, "cylinder")
+            return anObj
 
         ## Create a sphere with given center and radius.
         #  @param thePnt Sphere center.
@@ -7825,7 +7913,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return anObj
 
         ## Rotate the given object around the given axis
-        #  on the given angle, creating its copy before the rotatation.
+        #  on the given angle, creating its copy before the rotation.
         #  @param theObject The object to be rotated.
         #  @param theAxis Rotation axis.
         #  @param theAngle Rotation angle in radians.
index e27701c60b6598f9211bf500168b548c85b1935b..73e7c03fa73ee7a3ac4f23257b43557e78b69e1a 100644 (file)
@@ -70,19 +70,25 @@ 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);
@@ -115,10 +121,14 @@ void PrimitiveGUI_CylinderDlg::Init()
   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
 
   // min, max, step and decimals for spin boxes & initial values
+  double SpecificStep = 5;
   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., 360., SpecificStep, "angle_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., 360., SpecificStep, "angle_precision" );
 
   // init variables
   myEditCurrentArgument = GroupPoints->LineEdit1;
@@ -130,11 +140,13 @@ void PrimitiveGUI_CylinderDlg::Init()
   myPoint.nullify();
   myDir.nullify();
 
-  double aRadius(100.0), aHeight(300.0);
+  double aRadius(100.0), aHeight(300.0), aAngle(270.);
   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,11 +159,16 @@ 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"));
 
   setConstructorId(1); // simplest constructor
@@ -201,7 +218,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked (int constructorId)
   updateGeometry();
   resize(minimumSizeHint());
   SelectionIntoArgument();
-
+  
   displayPreview(true);
 }
 
@@ -281,7 +298,6 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
               this, SLOT(SelectionIntoArgument()));
     }
   }
-
   displayPreview(true);
 }
 
@@ -355,6 +371,11 @@ void PrimitiveGUI_CylinderDlg::enterEvent (QEvent*)
 //=================================================================================
 void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox()
 {
+  QString msg;
+  if (!isValid(msg)) {
+    erasePreview();
+    return;
+  }
   displayPreview(true);
 }
 
@@ -378,14 +399,25 @@ 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;
+        if(GroupPoints->SpinBox_DZ->value()<=0. || GroupPoints->SpinBox_DZ->value()>=360.) {
+      msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
+      ok = false;
+    }
   }
   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() );
+        if(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;
+  ok = qAbs( getRadius() ) > Precision::Confusion() && ok;
   return ok;
 }
 
@@ -396,35 +428,66 @@ 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());
+       if (!anObj->_is_nil() && !IsPreview())
+       {
+         QStringList aParameters;
+         aParameters << GroupPoints->SpinBox_DX->text();
+         aParameters << GroupPoints->SpinBox_DY->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.);
+       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:
+    BAngle = GroupDimensions->checkBox->isChecked();
+    if(!BAngle){
+      anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
-        QStringList aParameters;
-        aParameters << GroupPoints->SpinBox_DX->text();
-        aParameters << GroupPoints->SpinBox_DY->text();
-        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+       QStringList aParameters;
+       aParameters << GroupDimensions->SpinBox_DX->text();
+       aParameters << GroupDimensions->SpinBox_DY->text();
+       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
     }
-    break;
-  case 1:
-    anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
-    if (!anObj->_is_nil() && !IsPreview())
-    {
-      QStringList aParameters;
-      aParameters << GroupDimensions->SpinBox_DX->text();
-      aParameters << GroupDimensions->SpinBox_DY->text();
-      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+    else if(BAngle){
+      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;
     }
-    res = true;
     break;
   }
 
@@ -462,6 +525,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 +550,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();
+  }
+}
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