EDF 2278 : Thickening option in the extrusion operation

This commit is contained in:
rnc 2013-02-20 15:03:30 +00:00
parent 5eb9ea61de
commit 08ec557f57
14 changed files with 450 additions and 24 deletions

View 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.
*

View File

@ -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
//////////////////////////////////////////

View File

@ -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
//////////////////////////////////////////

View File

@ -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>

View 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 \

View 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

View 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,

View 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;

View File

@ -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

View 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

View 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,

View 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.

View 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,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());
}

View 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