]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
EDF 2278 : Thickening option in the extrusion operation
authorrnc <rnc@opencascade.com>
Wed, 20 Feb 2013 15:03:30 +0000 (15:03 +0000)
committerrnc <rnc@opencascade.com>
Wed, 20 Feb 2013 15:03:30 +0000 (15:03 +0000)
14 files changed:
idl/GEOM_Gen.idl
src/DlgRef/DlgRef.cxx
src/DlgRef/DlgRef.h
src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui [new file with mode: 0644]
src/DlgRef/Makefile.am
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_OffsetDriver.cxx
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_I3DPrimOperations_i.hh
src/GEOM_SWIG/geompyDC.py
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.h

index b7bcf45e20c1234da2a8a9ffadda47540e92c1a9..d16392a9f20d7c7bebdab9278de02e2691e80415 100644 (file)
@@ -1541,6 +1541,19 @@ module GEOM
                                              in GEOM_Object thePath,
                                              in GEOM_Object theVec);
 
+
+     /*!
+     *  \brief Make a thick solid from a surface shape (face or shell)
+     *  \param theObject Surface from which the thick solid is made
+     *  \param theThickness Value of the thickness
+     *  \return New GEOM_Object, containing the created pipe if isCopy = true
+     *          or the modified object if isCopy = false
+     */
+    GEOM_Object MakeThickening (in GEOM_Object theObject,
+                                in double theThickness,
+                                in boolean isCopy);
+
+    
     /*!
      *  \brief Build a middle path of a pipe-like shape.
      *
index a7a551f602bb42750e1b5d7d06ecf46d8b9f64ae..80e6c0c5a57d95e4053a531e5f8dcc067c83baca 100644 (file)
 
 #include "DlgRef.h"
 
+//////////////////////////////////////////
+// DlgRef_1Check1Spin1Check
+//////////////////////////////////////////
+
+DlgRef_1Check1Spin1Check::DlgRef_1Check1Spin1Check( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+DlgRef_1Check1Spin1Check::~DlgRef_1Check1Spin1Check()
+{
+}
+
 //////////////////////////////////////////
 // DlgRef_1List1Spin1Btn
 //////////////////////////////////////////
index b727e96ec7df28617ed3485ef74146f3629b9ceb..6bda154344f53150720971414316aa4bd22f2c03 100644 (file)
 #  define DLGREF_EXPORT
 #endif
 
+//////////////////////////////////////////
+// DlgRef_1Check1Spin1Check
+//////////////////////////////////////////
+
+#include "ui_DlgRef_1Check1Spin1Check_QTD.h"
+
+class DLGREF_EXPORT DlgRef_1Check1Spin1Check : public QWidget, 
+                                            public Ui::DlgRef_1Check1Spin1Check_QTD
+{
+  Q_OBJECT
+
+public:
+  DlgRef_1Check1Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~DlgRef_1Check1Spin1Check();
+};
+
+
 //////////////////////////////////////////
 // DlgRef_1List1Spin1Btn
 //////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui
new file mode 100644 (file)
index 0000000..d4dc954
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_1Check1Spin1Check_QTD</class>
+ <widget class="QWidget" name="DlgRef_1Check1Spin1Check_QTD">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>165</width>
+    <height>94</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="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title">
+      <string/>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <property name="spacing">
+       <number>6</number>
+      </property>
+      <item row="0" column="0" colspan="2">
+       <widget class="QCheckBox" name="checkButton1">
+        <property name="text">
+         <string>CheckBox</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" colspan="2">
+       <widget class="QCheckBox" name="checkButton2">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <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="1">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
+      </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>checkButton2</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
index 6816361661a5041f3b4c2306e885d10a380af3b8..774ba9b8d25f21e849a6b06491f8b44c45a40ddc 100644 (file)
@@ -34,6 +34,7 @@ MOC_FILES =                   \
        DlgRef_moc.cxx
 
 UIC_FILES =                                    \
+       ui_DlgRef_1Check1Spin1Check_QTD.h       \
        ui_DlgRef_1List1Spin1Btn_QTD.h          \
        ui_DlgRef_1Sel1Check1List_QTD.h         \
        ui_DlgRef_1Sel1Check1Sel_QTD.h          \
index ffe04f377e03d8c04d02229c746222a4215bc4c3..2698619b1eb410d30de462255c7c66438c08c1f2 100644 (file)
@@ -53,6 +53,7 @@
 #include <GEOMImpl_ShapeDriver.hxx>
 #include <GEOMImpl_FillingDriver.hxx>
 #include <GEOMImpl_ThruSectionsDriver.hxx>
+#include <GEOMImpl_OffsetDriver.hxx>
 
 #include <GEOMImpl_IBox.hxx>
 #include <GEOMImpl_IFace.hxx>
@@ -69,6 +70,7 @@
 #include <GEOMImpl_IPipeDiffSect.hxx>
 #include <GEOMImpl_IPipeShellSect.hxx>
 #include <GEOMImpl_IPipeBiNormal.hxx>
+#include <GEOMImpl_IOffset.hxx>
 #include <GEOMImpl_IPipePath.hxx>
 
 #include <Precision.hxx>
@@ -1489,7 +1491,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(
   //Make a Python command
   GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
     << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
-
+  
   SetErrorCode(OK);
   return aRevolution;
 }
@@ -2237,6 +2239,76 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Han
   return aPipe;
 }
 
+//=============================================================================
+/*!
+ *  MakeThickening
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening(Handle(GEOM_Object) theObject,
+                                                              double theOffset,
+                                                              bool copy = true)
+{
+  SetErrorCode(KO);
+
+  if (theObject.IsNull()) return NULL;
+
+  Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
+  if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
+
+  //Add a new Offset function
+  Handle(GEOM_Function) aFunction;
+  Handle(GEOM_Object) aCopy; 
+  if (copy)
+  { 
+    //Add a new Copy object
+    aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+    aFunction = aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING_COPY);
+  }
+  else
+    aFunction = theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING);
+  
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
+
+  GEOMImpl_IOffset aTI (aFunction);
+  aTI.SetShape(anOriginal);
+  aTI.SetValue(theOffset);
+
+  //Compute the offset
+  try {
+#if OCC_VERSION_LARGE > 0x06010000
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Offset driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  if(copy)
+  {
+    GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeThickSolid("
+                               << theObject << ", " << theOffset << ")";
+    SetErrorCode(OK);
+    return aCopy;
+  }
+  else
+  {
+    GEOM::TPythonDump(aFunction) << "geompy.Thicken("
+                               << theObject << ", " << theOffset << ")";
+    SetErrorCode(OK);
+    return theObject;
+  }
+}
+
 //=============================================================================
 /*!
  *  RestorePath
index 6cd2dd25db152fc1a0da69e8b9928b8b43536c06..3ce36cd271094787ef0bd2877523a45899f6fad3 100644 (file)
@@ -68,7 +68,8 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
 
   Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
                                                      Handle(GEOM_Object) theVec,
-                                                     double theH, double theScaleFactor = -1.0);
+                                                     double theH, 
+                                                     double theScaleFactor = -1.0);
 
   Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
                                                           Handle(GEOM_Object) theVec, double theH);
@@ -137,6 +138,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
                                                                    Handle(GEOM_Object) thePath,
                                                                    Handle(GEOM_Object) theVec);
+  
+  Standard_EXPORT Handle(GEOM_Object) MakeThickening (Handle(GEOM_Object) theObject, 
+                                                      double theOffset,
+                                                      bool isCopy);
 
   Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
                                                    Handle(GEOM_Object) theBase1,
index 7bcf8af96c2cae7fa85e731196b796066d21b802..63d94554952a27ab92c8f12a501d892e47509664 100644 (file)
@@ -77,20 +77,20 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const
   Standard_Integer aType = aFunction->GetType();
 
   TopoDS_Shape aShape;
-
-  if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) {
-    Handle(GEOM_Function) aRefShape = aCI.GetShape();
-    TopoDS_Shape aShapeBase = aRefShape->GetValue();
-    Standard_Real anOffset = aCI.GetValue();
-    Standard_Real aTol = Precision::Confusion();
-
-    if (Abs(anOffset) < aTol) {
+  
+  Handle(GEOM_Function) aRefShape = aCI.GetShape();
+  TopoDS_Shape aShapeBase = aRefShape->GetValue();
+  Standard_Real anOffset = aCI.GetValue();
+  Standard_Real aTol = Precision::Confusion();
+  
+  if (Abs(anOffset) < aTol) {
       TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value (");
       aMsg += TCollection_AsciiString(aTol);
       aMsg += ")";
       StdFail_NotDone::Raise(aMsg.ToCString());
-    }
+  }
 
+  if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) {  
     BRepOffsetAPI_MakeOffsetShape MO (aShapeBase,
                                       aCI.GetValue(),
                                       aTol);
@@ -114,7 +114,17 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const
     else {
       StdFail_NotDone::Raise("Offset construction failed");
     }
-  } else {
+  } 
+  else if (aType == OFFSET_THICKENING || aType == OFFSET_THICKENING_COPY)
+  {
+    BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin,
+                                        Standard_False, Standard_False, GeomAbs_Intersection, Standard_True);
+  
+    if (!myOffsetShape.IsDone())
+    {
+      StdFail_NotDone::Raise("Thickening construction failed");
+    }
+    aShape = myOffsetShape.Shape();
   }
 
   if (aShape.IsNull()) return 0;
index 0419dd16927b92d130efb41ebb15ceef64e9edc1..a1155892082e7ba95c995fa58af2fd0208a01220 100755 (executable)
 
 #define GEOM_PIPE_PATH 48
 
+#define GEOM_THICKENING 49
+
 //GEOM_Function types
 
 #define COPY_WITH_REF    1
 
 #define OFFSET_SHAPE      1
 #define OFFSET_SHAPE_COPY 2
+#define OFFSET_THICKENING 3
+#define OFFSET_THICKENING_COPY 4
 
 #define PROJECTION_COPY 1
 
index 95948ed249580031a06345d6162eaf0140f509f2..ee9ee2e4bb2dbe0096b3f11bccd13fd7bb6955a5 100644 (file)
@@ -30,6 +30,8 @@
 #include "GEOM_Engine.hxx"
 #include "GEOM_Object.hxx"
 
+#define SUBSHAPE_ERROR "Sub shape cannot be transformed"
+
 //=============================================================================
 /*!
  *   constructor:
@@ -1126,6 +1128,56 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeThickening
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
+                 (GEOM::GEOM_Object_ptr theObject,
+                  CORBA::Double theOffset,
+                  CORBA::Boolean doCopy)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
+
+  //check if the object is a sub-shape
+  if (!theObject->IsMainShape() && !doCopy) {
+    GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
+    return aGEOMObject._retn();
+  }
+  
+  if (!doCopy)
+    aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
+
+  //Get the basic object
+  Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+  if (aBasicObject.IsNull()) return aGEOMObject._retn();
+  
+  //Create the thickened shape
+  if (doCopy)
+  {
+    Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
+      aBasicObject, theOffset, doCopy);
+    if (!GetOperations()->IsDone() || anObject.IsNull())
+      return aGEOMObject._retn();
+    
+    return GetObject(anObject);
+  }
+  else
+  {
+    GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy);
+    
+    // Update GUI.
+    UpdateGUIForObject(theObject);
+    
+    return aGEOMObject._retn();
+  }
+}
+
 //=============================================================================
 /*!
  *  RestorePath
index 5b274671bd9e96682afb41aee8c7499fc2a936c9..6a03d8d4226be26c89f0dbd321cdb2d399af1ff6 100644 (file)
@@ -186,6 +186,10 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
   GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase,
                                                     GEOM::GEOM_Object_ptr thePath,
                                                     GEOM::GEOM_Object_ptr theVec);
+  
+  GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
+                                        CORBA::Double theOffset,
+                                        CORBA::Boolean isCopy);
 
   GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape,
                                      GEOM::GEOM_Object_ptr theBase1,
index bf66f2e21b511326a13ca36aeb60bfca61753e58..a5959bf6e1e33458cb1dcda0ee6d16db1a40d7ff 100644 (file)
@@ -3714,6 +3714,61 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
             self._autoPublish(anObj, theName, "pipe")
             return anObj
+              
+        ## Makes a thick solid from a face or a shell
+        #  @param theShape Face or Shell to be thicken
+        #  @param theThickness Thickness of the resulting solid
+        #  @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 solid
+        #
+        def MakeThickSolid(self, theShape, theThickness, theName=None):
+            """
+            Make a thick solid from a face or a shell
+
+            Parameters:
+                 theShape Face or Shell to be thicken
+                 theThickness Thickness of the resulting solid
+                 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 solid
+            """
+            # Example: see GEOM_TestAll.py
+            anObj = self.PrimOp.MakeThickening(theShape, theThickness, True)
+            RaiseIfFailed("MakeThickening", self.PrimOp)
+            self._autoPublish(anObj, theName, "pipe")
+            return anObj
+            
+
+        ## Modifies a face or a shell to make it a thick solid
+        #  @param theShape Face or Shell to be thicken
+        #  @param theThickness Thickness of the resulting solid
+        #
+        #  @return The modified shape
+        #
+        def Thicken(self, theShape, theThickness):
+            """
+            Modifies a face or a shell to make it a thick solid
+
+            Parameters:
+                theBase Base shape to be extruded.
+                thePath Path shape to extrude the base shape along it.
+                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:
+                The modified shape
+            """
+            # Example: see GEOM_TestAll.py
+            anObj = self.PrimOp.MakeThickening(theShape, theThickness, False)
+            RaiseIfFailed("MakeThickening", self.PrimOp)
+            return anObj
 
         ## Build a middle path of a pipe-like shape.
         #  The path shape can be a wire or an edge.
index b5cc5e31a97392d73263e0b2ed30f29a8b31ecc5..c14903c946535caad7fcac80379896464caf0c6e 100644 (file)
@@ -109,12 +109,19 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi
   GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR"));
   GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY"));
   GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
+  
+  GroupThickening = new DlgRef_1Check1Spin1Check(centralWidget());
+  GroupThickening->GroupBox1->setTitle("Thickening");
+  GroupThickening->checkButton1->setText("Add thickness (edges or wires only)");
+  GroupThickening->checkButton2->setText("Thicken towards outside");
+  GroupThickening->TextLabel1->setText("Thickness");
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
   layout->addWidget(GroupVecH);
   layout->addWidget(Group2Points);
   layout->addWidget(GroupDXDYDZ);
+  layout->addWidget(GroupThickening);
   /***************************************************************/
 
   setHelpFileName("create_extrusion_page.html");
@@ -145,6 +152,9 @@ void GenerationGUI_PrismDlg::Init()
   double aScaleFactor = 2.0;
   double aScaleStep = 0.5;
   double aScaleMin = Precision::Confusion() * 10.0;
+  
+  double aThickness = 10;
+  double aThicknessMin = Precision::Confusion() * 10.0;
 
   initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
   GroupVecH->SpinBox_DX->setValue(100.0);
@@ -163,6 +173,9 @@ void GenerationGUI_PrismDlg::Init()
   GroupVecH->SpinBox_DY->setValue(aScaleFactor);
   Group2Points->SpinBox1->setValue(aScaleFactor);
   GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor);
+  
+  initSpinBox(GroupThickening->SpinBox_DX, aThicknessMin, COORD_MAX, step, "length_precision" );
+  GroupThickening->SpinBox_DX->setValue(aThickness);
 
   // hide not used controls
   Group2Points->TextLabel5->hide();
@@ -190,6 +203,19 @@ void GenerationGUI_PrismDlg::Init()
   Group2Points->LineEdit3->setText("");
 
   GroupDXDYDZ->LineEdit1->setText("");
+  
+  GroupThickening->SpinBox_DX->hide();
+  GroupThickening->checkButton2->hide();
+  GroupThickening->TextLabel1->hide();
+  
+  GroupVecH->TextLabel4->hide();
+  GroupVecH->SpinBox_DY->hide();
+
+  Group2Points->TextLabel4->hide();
+  Group2Points->SpinBox1->hide();
+
+  GroupDXDYDZ->TextLabel5->hide();
+  GroupDXDYDZ->SpinBox_SC->hide();
 
   myBaseObjects.clear();
   myPoint1.nullify();
@@ -212,14 +238,14 @@ void GenerationGUI_PrismDlg::Init()
 
   connect(GroupVecH->CheckBox1,  SIGNAL(toggled(bool)), this, SLOT(onBothway()));
   connect(GroupVecH->CheckBox2,  SIGNAL(toggled(bool)), this, SLOT(onReverse()));
-  connect(GroupVecH->CheckBox3,  SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
+  connect(GroupVecH->CheckBox3,  SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool)));
   connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
 
   connect(Group2Points->PushButton1, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
   connect(Group2Points->PushButton2, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
   connect(Group2Points->PushButton3, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
   connect(Group2Points->CheckBox1,   SIGNAL(toggled(bool)),   this, SLOT(onBothway()));
-  connect(Group2Points->CheckBox2,   SIGNAL(toggled(bool)),   this, SLOT(onScalePrism()));
+  connect(Group2Points->CheckBox2,   SIGNAL(toggled(bool)),   this, SLOT(onScalePrism(bool)));
   connect(Group2Points->SpinBox1,    SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
 
   connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()),            this, SLOT(SetEditCurrentArgument()));
@@ -228,7 +254,11 @@ void GenerationGUI_PrismDlg::Init()
   connect(GroupDXDYDZ->SpinBox_DZ,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDXDYDZ->SpinBox_SC,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDXDYDZ->CheckBox1,   SIGNAL(toggled(bool)),        this, SLOT(onBothway()));
-  connect(GroupDXDYDZ->CheckBox2,   SIGNAL(toggled(bool)),        this, SLOT(onScalePrism()));
+  connect(GroupDXDYDZ->CheckBox2,   SIGNAL(toggled(bool)),        this, SLOT(onScalePrism(bool)));
+  
+  connect(GroupThickening->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupThickening->checkButton1, SIGNAL(toggled(bool)),        this, SLOT(onAddThickening(bool)));
+  connect(GroupThickening->checkButton2, SIGNAL(toggled(bool)),        this, SLOT(onChangeDirection(bool)));
 
   initName(tr("GEOM_EXTRUSION"));
 
@@ -335,11 +365,19 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
        myEditCurrentArgument == Group2Points->LineEdit1 ||
        myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) {
     myBaseObjects.clear();
+    GroupThickening->checkButton1->setEnabled(true);
+  
     QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
     for ( int i = 0; i < objects.count(); i++ ) {
       GEOM::shape_type stype = objects[i]->GetMaxShapeType();
       if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
         continue;
+      if ( stype > GEOM::EDGE || stype < GEOM::WIRE )
+      {
+        GroupThickening->checkButton1->setChecked(false);
+        GroupThickening->checkButton1->setEnabled(false);
+      }
+        
       myBaseObjects << objects[i];
     }
     if ( !myBaseObjects.isEmpty() ) {
@@ -561,20 +599,53 @@ void GenerationGUI_PrismDlg::onBothway()
 // function : onScalePrism()
 // purpose  :
 //=================================================================================
-void GenerationGUI_PrismDlg::onScalePrism()
+void GenerationGUI_PrismDlg::onScalePrism(bool isChecked)
 {
-  GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked());
-  GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked());
+  GroupVecH->TextLabel4->setVisible(isChecked);
+  GroupVecH->SpinBox_DY->setVisible(isChecked);
+
+  Group2Points->TextLabel4->setVisible(isChecked);
+  Group2Points->SpinBox1->setVisible(isChecked);
 
-  Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked());
-  Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked());
+  GroupDXDYDZ->TextLabel5->setVisible(isChecked);
+  GroupDXDYDZ->SpinBox_SC->setVisible(isChecked);
+  
+  GroupVecH->TextLabel4->setEnabled(isChecked);
+  GroupVecH->SpinBox_DY->setEnabled(isChecked);
 
-  GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
-  GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
+  Group2Points->TextLabel4->setEnabled(isChecked);
+  Group2Points->SpinBox1->setEnabled(isChecked);
+
+  GroupDXDYDZ->TextLabel5->setEnabled(isChecked);
+  GroupDXDYDZ->SpinBox_SC->setEnabled(isChecked);
 
   processPreview();
 }
 
+//=================================================================================
+// function : onAddThickening(bool)
+// purpose  :
+//=================================================================================
+void GenerationGUI_PrismDlg::onAddThickening(bool isChecked)
+{
+  GroupThickening->SpinBox_DX->setVisible(isChecked);
+  GroupThickening->checkButton2->setVisible(isChecked);
+  GroupThickening->TextLabel1->setVisible(isChecked);
+  updateGeometry();
+  resize(minimumSizeHint());
+  processPreview();
+}
+
+//=================================================================================
+// function : onChangeDirection(bool)
+// purpose  :
+//=================================================================================
+void GenerationGUI_PrismDlg::onChangeDirection(bool isChecked)
+{
+  processPreview();
+}
+
 //=================================================================================
 // function : execute
 // purpose  :
@@ -585,6 +656,7 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
   GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+  GEOM::GEOM_I3DPrimOperations_var anotherOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
 
   for (int i = 0; i < myBaseObjects.count(); i++) {
     switch (getConstructorId()) {
@@ -641,7 +713,19 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
       }
       break;
     }
-
+    
+    if(GroupThickening->checkButton1->isChecked())
+    { 
+      double aThickness = 0.0;
+      
+      if(GroupThickening->checkButton2->isChecked() ^ GroupVecH->CheckBox2->isChecked()) // if "towards outside" XOR "reversed" is checked
+        aThickness = -1.0*(GroupThickening->SpinBox_DX->value());                        // change the offset sign to negative
+      else
+        aThickness = GroupThickening->SpinBox_DX->value();                          
+      
+      anObj = anotherOper->MakeThickening(anObj, aThickness, /*copy=*/false);    
+    }
+    
     if (!anObj->_is_nil())
       objects.push_back(anObj._retn());
   }
index 5b1524517ec763b142bce27d60f51bd548db5863..01f3deff88aff4d5388d5b748a83c3696cdeda88 100644 (file)
@@ -33,6 +33,7 @@
 class DlgRef_2Sel1Spin3Check1Spin;
 class DlgRef_3Sel2Check3Spin;
 class DlgRef_1Sel3Spin2Check1Spin;
+class DlgRef_1Check1Spin1Check;
 
 //=================================================================================
 // class    : GenerationGUI_PrismDlg
@@ -66,6 +67,7 @@ private:
   DlgRef_2Sel1Spin3Check1Spin*       GroupVecH;
   DlgRef_3Sel2Check3Spin*            Group2Points;
   DlgRef_1Sel3Spin2Check1Spin*       GroupDXDYDZ;
+  DlgRef_1Check1Spin1Check*          GroupThickening;
   
 private slots:
   void                               ClickOnOk();
@@ -78,7 +80,9 @@ private slots:
   void                               SetDoubleSpinBoxStep( double );
   void                               onReverse();
   void                               onBothway();
-  void                               onScalePrism();
+  void                               onScalePrism(bool);
+  void                               onAddThickening( bool );
+  void                               onChangeDirection( bool );
 };
 
 #endif // GENERATIONGUI_PRISMDLG_H