-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 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
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
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(tr("GEOM_THICKENING"));
+ GroupThickening->checkButton1->setText(tr("GEOM_ADD_THICKNESS")); // "Add thickness (edges or wires only)"
+ GroupThickening->checkButton2->setText(tr("GEOM_TOWARDS_INSIDE")); // "Thicken towards the inside"
+ GroupThickening->TextLabel1->setText(tr("GEOM_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");
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);
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();
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();
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()));
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"));
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() ) {
myEditCurrentArgument = GroupVecH->LineEdit2;
GroupVecH->PushButton1->setDown(false);
GroupVecH->LineEdit1->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else if (send == Group2Points->PushButton1) {
myEditCurrentArgument = Group2Points->LineEdit1;
Group2Points->PushButton3->setDown(false);
Group2Points->LineEdit1->setEnabled(false);
Group2Points->LineEdit3->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == Group2Points->PushButton3) {
myEditCurrentArgument = Group2Points->LineEdit3;
Group2Points->PushButton2->setDown(false);
Group2Points->LineEdit1->setEnabled(false);
Group2Points->LineEdit2->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupDXDYDZ->PushButton1) {
myEditCurrentArgument = GroupDXDYDZ->LineEdit1;
//=================================================================================
GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
{
- return getGeomEngine()->GetI3DPrimOperations(getStudyId());
+ return getGeomEngine()->GetI3DPrimOperations();
}
//=================================================================================
// 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();
}
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()) {
if (!anObj->_is_nil() && !IsPreview()) {
aParameters << GroupVecH->SpinBox_DX->text();
- anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
break;
case 1:
aParameters << GroupDXDYDZ->SpinBox_DX->text();
aParameters << GroupDXDYDZ->SpinBox_DY->text();
aParameters << GroupDXDYDZ->SpinBox_DZ->text();
- anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
break;
}
+
+ if(GroupThickening->checkButton1->isChecked())
+ {
+ double aThickness = GroupThickening->SpinBox_DX->value();
+ bool isInside = GroupThickening->checkButton2->isChecked();
+
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+
+ anObj = anotherOper->MakeThickening
+ (anObj, anArray, aThickness, /*copy=*/false, isInside);
+ if (!anObj->_is_nil() && !IsPreview())
+ anObj->SetParameters(GroupThickening->SpinBox_DX->text().toUtf8().constData());
+ }
+
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
{
return myBaseObjects.count() > 1;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_PrismDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBaseObjects);
+ res << myVec << myPoint1 << myPoint2 ;
+ return res;
+}