diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index b7bcf45e2..d16392a9f 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -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.
*
diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx
index a7a551f60..80e6c0c5a 100644
--- a/src/DlgRef/DlgRef.cxx
+++ b/src/DlgRef/DlgRef.cxx
@@ -21,6 +21,20 @@
#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
//////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h
index b727e96ec..6bda15434 100644
--- a/src/DlgRef/DlgRef.h
+++ b/src/DlgRef/DlgRef.h
@@ -32,6 +32,23 @@
# 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
index 000000000..d4dc9543f
--- /dev/null
+++ b/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui
@@ -0,0 +1,91 @@
+
+
+ DlgRef_1Check1Spin1Check_QTD
+
+
+
+ 0
+ 0
+ 165
+ 94
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+ 6
+
+
-
+
+
+ CheckBox
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TL1
+
+
+ false
+
+
+
+ -
+
+
+
+
+
+
+
+
+ qPixmapFromMimeSource
+
+
+ SalomeApp_DoubleSpinBox
+ QDoubleSpinBox
+ SalomeApp_DoubleSpinBox.h
+
+
+
+ SpinBox_DX
+ checkButton2
+
+
+
+
diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am
index 681636166..774ba9b8d 100644
--- a/src/DlgRef/Makefile.am
+++ b/src/DlgRef/Makefile.am
@@ -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 \
diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
index ffe04f377..2698619b1 100644
--- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
@@ -53,6 +53,7 @@
#include
#include
#include
+#include
#include
#include
@@ -69,6 +70,7 @@
#include
#include
#include
+#include
#include
#include
@@ -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
diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
index 6cd2dd25d..3ce36cd27 100644
--- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
@@ -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,
diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx
index 7bcf8af96..63d945549 100644
--- a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx
@@ -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;
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index 0419dd169..a11558920 100755
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -102,6 +102,8 @@
#define GEOM_PIPE_PATH 48
+#define GEOM_THICKENING 49
+
//GEOM_Function types
#define COPY_WITH_REF 1
@@ -164,6 +166,8 @@
#define OFFSET_SHAPE 1
#define OFFSET_SHAPE_COPY 2
+#define OFFSET_THICKENING 3
+#define OFFSET_THICKENING_COPY 4
#define PROJECTION_COPY 1
diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc
index 95948ed24..ee9ee2e4b 100644
--- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc
+++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc
@@ -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
diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh
index 5b274671b..6a03d8d42 100644
--- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh
+++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh
@@ -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,
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index bf66f2e21..a5959bf6e 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -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.
diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx
index b5cc5e31a..c14903c94 100644
--- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx
+++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx
@@ -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 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,17 +599,50 @@ 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->setEnabled(Group2Points->CheckBox2->isChecked());
- Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked());
+ Group2Points->TextLabel4->setVisible(isChecked);
+ Group2Points->SpinBox1->setVisible(isChecked);
- GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
- GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
+ GroupDXDYDZ->TextLabel5->setVisible(isChecked);
+ GroupDXDYDZ->SpinBox_SC->setVisible(isChecked);
+
+ GroupVecH->TextLabel4->setEnabled(isChecked);
+ GroupVecH->SpinBox_DY->setEnabled(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();
}
@@ -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());
}
diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h
index 5b1524517..01f3deff8 100644
--- a/src/GenerationGUI/GenerationGUI_PrismDlg.h
+++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h
@@ -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