chamferall.png \
chamferedge.png \
chamferface.png \
+chamferedgefromface.png \
change_orientation.png \
check.png \
circle.png \
circlepointvector.png \
circle3points.png \
+circlecenter2pnts.png \
common.png \
cone.png \
conedxyz.png \
GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1,
in GEOM_Object thePnt2,
in GEOM_Object thePnt3);
-
+ /*!
+ * Create a circle with given center, with a radius equals the distance from center to Point1
+ * and on a plane defined by all of three points.
+ * \param thePnt1,thePnt2,thePnt3 Points, defining the circle.
+ * \return New GEOM_Object, containing the created circle.
+ */
+ GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1,
+ in GEOM_Object thePnt2,
+ in GEOM_Object thePnt3);
/*!
* Create an ellipse with given center, normal vector and radiuses.
* \param thePnt Ellipse center.
GEOM_Object MakeFilletEdges (in GEOM_Object theShape,
in double theR,
in ListOfLong theEdges);
+ GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape,
+ in double theR1,
+ in double theR2,
+ in ListOfLong theEdges);
/*!
* Perform a fillet on all edges of the specified faces of the given shape.
GEOM_Object MakeFilletFaces (in GEOM_Object theShape,
in double theR,
in ListOfLong theFaces);
+ GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape,
+ in double theR1,
+ in double theR2,
+ in ListOfLong theFaces);
/*!
* Perform a symmetric chamfer on all edges of the given shape.
GEOM_Object MakeChamferEdge (in GEOM_Object theShape,
in double theD1, in double theD2,
in long theFace1, in long theFace2);
+ /*!
+ * The Same but with params theD = Chamfer Lenght
+ * and theAngle = Chamfer Angle (Angle in radians)
+ */
+ GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in long theFace1, in long theFace2);
/*!
* Perform a chamfer on all edges of the specified faces.
GEOM_Object MakeChamferFaces (in GEOM_Object theShape,
in double theD1, in double theD2,
in ListOfLong theFaces);
+ /*!
+ * The Same but with params theD = Chamfer Lenght
+ * and theAngle = Chamfer Angle (Angle in radians)
+ */
+ GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in ListOfLong theFaces);
+
+ /*!
+ * Perform a chamfer on edges,
+ * with distance D1 on the first specified face (if several for one edge)
+ * \param theShape Shape, to perform chamfer on.
+ * \param theD1 theD2 Chamfer size
+ * \param theEdges Sequence of edges of \a theShape.
+ * \return New GEOM_Object, containing the result shape.
+ */
+ GEOM_Object MakeChamferEdges (in GEOM_Object theShape,
+ in double theD1, in double theD2,
+ in ListOfLong theEdges);
+ /*!
+ * The Same but with params theD = Chamfer Lenght
+ * and theAngle = Chamfer Angle (Angle in radians)
+ */
+ GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in ListOfLong theEdges);
/*!
* Perform an Archimde operation on the given shape with given parameters.
GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1,
in GEOM_Object thePnt2,
in GEOM_Object thePnt3) ;
+ GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1,
+ in GEOM_Object thePnt2,
+ in GEOM_Object thePnt3) ;
GEOM_Object MakeEllipse (in GEOM_Object thePnt,
in GEOM_Object theVec,
in double theRMajor,
GEOM_Object MakeFilletEdges (in GEOM_Object theShape,
in double theR,
in GEOM_List theEdges) ;
+ GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape,
+ in double theR1,
+ in double theR2,
+ in GEOM_List theEdges) ;
GEOM_Object MakeFilletFaces (in GEOM_Object theShape,
in double theR,
in GEOM_List theFaces) ;
+ GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape,
+ in double theR1,
+ in double theR2,
+ in GEOM_List theFaces) ;
GEOM_Object MakeChamferAll (in GEOM_Object theShape,
in double theD) ;
GEOM_Object MakeChamferEdge (in GEOM_Object theShape,
in double theD1, in double theD2,
in long theFace1, in long theFace2) ;
+ GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in long theFace1, in long theFace2) ;
GEOM_Object MakeChamferFaces (in GEOM_Object theShape,
in double theD1, in double theD2,
in GEOM_List theFaces) ;
+ GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in GEOM_List theFaces) ;
+ GEOM_Object MakeChamferEdges (in GEOM_Object theShape,
+ in double theD1, in double theD2,
+ in GEOM_List theEdges) ;
+ GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape,
+ in double theD, in double theAngle,
+ in GEOM_List theEdges) ;
GEOM_Object MakeArchimede (in GEOM_Object theShape,
in double theWeight,
in double theWaterDensity,
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
+#include "GEOM_Object.hxx"
+#include "GEOM_Engine.hxx"
#include "utilities.h"
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PV")));
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PNTS")));
+ QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_C2P")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_CIRCLE_TITLE"));
GroupConstructors->setTitle(tr("GEOM_CIRCLE"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image2);
- RadioButton3->close(TRUE);
+ RadioButton3->setPixmap(image3);
GroupPntVecR = new DlgRef_2Sel1Spin(this, "GroupPntVecR");
GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
Group3Pnts->LineEdit2->setReadOnly( true );
Group3Pnts->LineEdit3->setReadOnly( true );
+ GroupCenter2Pnts = new DlgRef_3Sel_QTD(this, "GroupCenter2Pnts");
+ GroupCenter2Pnts->GroupBox1->setTitle(tr("GEOM_CENTER_2POINTS"));
+ GroupCenter2Pnts->TextLabel1->setText(tr("GEOM_CENTER_POINT"));
+ GroupCenter2Pnts->TextLabel2->setText(tr("GEOM_POINT1"));
+ GroupCenter2Pnts->TextLabel3->setText(tr("GEOM_POINT2"));
+ GroupCenter2Pnts->PushButton1->setPixmap(image1);
+ GroupCenter2Pnts->PushButton2->setPixmap(image1);
+ GroupCenter2Pnts->PushButton3->setPixmap(image1);
+
+ GroupCenter2Pnts->LineEdit1->setReadOnly( true );
+ GroupCenter2Pnts->LineEdit2->setReadOnly( true );
+ GroupCenter2Pnts->LineEdit3->setReadOnly( true );
+
Layout1->addWidget( GroupPntVecR, 2, 0 );
Layout1->addWidget( Group3Pnts, 2, 0 );
+ Layout1->addWidget( GroupCenter2Pnts, 2, 0 );
/***************************************************************/
setHelpFileName("circle.htm");
connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupCenter2Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupCenter2Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupCenter2Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
initName( tr( "GEOM_CIRCLE" ) );
Group3Pnts->hide();
+ GroupCenter2Pnts->hide();
ConstructorsClicked( 0 );
}
case 0:
{
Group3Pnts->hide();
+ GroupCenter2Pnts->hide();
resize(0, 0);
GroupPntVecR->show();
case 1:
{
GroupPntVecR->hide();
+ GroupCenter2Pnts->hide();
resize( 0, 0 );
Group3Pnts->show();
Group3Pnts->LineEdit3->setText("");
break;
}
+ case 2:
+ {
+ GroupPntVecR->hide();
+ Group3Pnts->hide();
+ resize( 0, 0 );
+ GroupCenter2Pnts->show();
+
+ myEditCurrentArgument = GroupCenter2Pnts->LineEdit1;
+ GroupCenter2Pnts->LineEdit1->setText("");
+ GroupCenter2Pnts->LineEdit2->setText("");
+ GroupCenter2Pnts->LineEdit3->setText("");
+ break;
+ }
}
myEditCurrentArgument->setFocus();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = GEOM::GEOM_Object::_nil();
return;
}
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes )
- {
+ {
+
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = aSelectedObject;
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = aSelectedObject;
+ else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = aSelectedObject;
}
-
displayPreview();
}
else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1;
else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2;
else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3;
+ else if ( send == GroupCenter2Pnts->PushButton1 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit1;
+ else if ( send == GroupCenter2Pnts->PushButton2 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit2;
+ else if ( send == GroupCenter2Pnts->PushButton3 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit3;
myEditCurrentArgument->setFocus();
send == GroupPntVecR->LineEdit2 ||
send == Group3Pnts->LineEdit1 ||
send == Group3Pnts->LineEdit2 ||
- send == Group3Pnts->LineEdit3 )
+ send == Group3Pnts->LineEdit3 ||
+ send == GroupCenter2Pnts->LineEdit1 ||
+ send == GroupCenter2Pnts->LineEdit2 ||
+ send == GroupCenter2Pnts->LineEdit3 )
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
//=================================================================================
double BasicGUI_CircleDlg::getRadius() const
{
- return GroupPntVecR->SpinBox_DX->GetValue();
+ switch ( getConstructorId() )
+ {
+ case 0 :
+ return GroupPntVecR->SpinBox_DX->GetValue();
+ }
}
//=================================================================================
else if ( id == 1 )
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
+ else if ( id == 2 )
+ return !myPoint4->_is_nil() && !myPoint5->_is_nil() && !myPoint6->_is_nil() &&
+ !isEqual( myPoint4, myPoint5 ) && !isEqual( myPoint5, myPoint6 ) && !isEqual( myPoint4, myPoint6 );
return false;
}
switch ( getConstructorId() )
{
+ cout << "constructior ID = " << getConstructorId() << endl;
case 0 :
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
res = true;
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 );
res = true;
break;
+ case 2 :
+ anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleCenter2Pnt( myPoint4, myPoint5, myPoint6 );
+ res = true;
+ break;
}
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
+ else cout << "Execute Object is NULL!" << endl;
return res;
}
void enterEvent(QEvent* e);
double getRadius() const;
- GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3;
+ GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6;
+ CORBA::Double myRadius;
DlgRef_2Sel1Spin* GroupPntVecR;
DlgRef_3Sel_QTD* Group3Pnts;
+ DlgRef_3Sel_QTD* GroupCenter2Pnts;
private slots:
void ClickOnOk();
--- /dev/null
+// File : DlgRef_2Sel2Spin.cxx\r
+// Author : Dmitry MATVEITCHEV\r
+// Module : GEOM\r
+// $Header: \r
+\r
+#include "DlgRef_2Sel3Spin2Rb.h"\r
+#include <iostream.h>\r
+\r
+#include <qlayout.h>\r
+#include <qspinbox.h>\r
+#include <qgroupbox.h>\r
+#include <qradiobutton.h>\r
+\r
+/* \r
+ * Constructs a DlgRef_2Sel3Spin2Rb which is a child of 'parent', with the \r
+ * name 'name' and widget flags set to 'f' \r
+ */\r
+DlgRef_2Sel3Spin2Rb::DlgRef_2Sel3Spin2Rb(QWidget* parent, const char* name, WFlags fl)\r
+ :DlgRef_2Sel3Spin2Rb_QTD(parent, name, fl)\r
+{\r
+ SpinBox1->close(TRUE);\r
+ SpinBox2->close(TRUE);\r
+ SpinBox3->close(TRUE);\r
+ RadioButton1->setChecked(true);\r
+ SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX");\r
+ Layout2->addMultiCellWidget(SpinBox_DX, 0, 0, 2, 4);\r
+ SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY");\r
+ Layout2->addWidget(SpinBox_DY, 1, 2);\r
+ SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ");\r
+ Layout2->addWidget(SpinBox_DZ, 1, 4);\r
+ SpinBox_DY->setEnabled(false);\r
+ SpinBox_DZ->setEnabled(false);\r
+}\r
+\r
+/* \r
+ * Destroys the object and frees any allocated resources\r
+ */\r
+DlgRef_2Sel3Spin2Rb::~DlgRef_2Sel3Spin2Rb()\r
+{\r
+ // no need to delete child widgets, Qt does it all for us\r
+}\r
--- /dev/null
+// File : DlgRef_2Sel3Spin2Rb.h\r
+// Author : Dmitry MATVEITCHEV\r
+// Module : GEOM\r
+// $Header: \r
+\r
+#ifndef DLGREF_2SEL3SPIN2RB_H\r
+#define DLGREF_2SEL3SPIN2RB_H\r
+\r
+#include "DlgRef_2Sel3Spin2Rb_QTD.h"\r
+#include "DlgRef_SpinBox.h"\r
+//#if defined WNT \r
+//#include <SALOME_WNT.hxx>\r
+//#else\r
+//#define SALOME_WNT_EXPORT\r
+//#endif\r
+#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS\r
+#define DLGREF_WNT_EXPORT __declspec( dllexport )\r
+#else\r
+#define DLGREF_WNT_EXPORT\r
+#endif\r
+class DLGREF_WNT_EXPORT DlgRef_2Sel3Spin2Rb : public DlgRef_2Sel3Spin2Rb_QTD\r
+{ \r
+ Q_OBJECT\r
+\r
+public:\r
+ DlgRef_2Sel3Spin2Rb(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);\r
+ ~DlgRef_2Sel3Spin2Rb();\r
+\r
+ DlgRef_SpinBox* SpinBox_DX;\r
+ DlgRef_SpinBox* SpinBox_DY;\r
+ DlgRef_SpinBox* SpinBox_DZ;\r
+};\r
+\r
+#endif // DLGREF_2SEL3SPIN2RB_H\r
--- /dev/null
+/****************************************************************************
+** Form implementation generated from reading ui file 'DlgRef_2Sel3Spin2Rb_QTD.ui'
+**
+** Created: Tue Oct 9 15:16:54 2007
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "DlgRef_2Sel3Spin2Rb_QTD.h"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a DlgRef_2Sel3Spin2Rb_QTD as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+DlgRef_2Sel3Spin2Rb_QTD::DlgRef_2Sel3Spin2Rb_QTD( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "DlgRef_2Sel3Spin2Rb_QTD" );
+ DlgRef_2Sel3Spin2Rb_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel3Spin2Rb_QTDLayout");
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setColumnLayout(0, Qt::Vertical );
+ GroupBox1->layout()->setSpacing( 6 );
+ GroupBox1->layout()->setMargin( 11 );
+ GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
+ GroupBox1Layout->setAlignment( Qt::AlignTop );
+
+ Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
+
+ PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
+ PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( PushButton1, 0, 1 );
+
+ LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
+
+ Layout1->addWidget( LineEdit1, 0, 2 );
+
+ TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
+ TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( TextLabel2, 1, 0 );
+
+ Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
+
+ TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
+ TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( TextLabel5, 1, 3 );
+
+ RadioButton2 = new QRadioButton( GroupBox1, "RadioButton2" );
+
+ Layout2->addWidget( RadioButton2, 1, 0 );
+
+ TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
+ TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( TextLabel3, 0, 1 );
+
+ SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+ SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addMultiCellWidget( SpinBox1, 0, 0, 2, 4 );
+
+ RadioButton1 = new QRadioButton( GroupBox1, "RadioButton1" );
+
+ Layout2->addWidget( RadioButton1, 0, 0 );
+
+ SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
+ SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox3, 1, 4 );
+
+ SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
+ SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox2, 1, 2 );
+
+ TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
+ TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( TextLabel4, 1, 1 );
+
+ Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
+
+ PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
+ PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( PushButton2, 1, 1 );
+ Spacer5 = new QSpacerItem( 0, 207, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout1->addItem( Spacer5, 3, 2 );
+
+ LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
+
+ Layout1->addWidget( LineEdit2, 1, 2 );
+
+ TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
+ TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( TextLabel1, 0, 0 );
+
+ GroupBox1Layout->addLayout( Layout1, 0, 0 );
+
+ DlgRef_2Sel3Spin2Rb_QTDLayout->addWidget( GroupBox1, 0, 0 );
+ resize( QSize(439, 340).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DlgRef_2Sel3Spin2Rb_QTD::~DlgRef_2Sel3Spin2Rb_QTD()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
--- /dev/null
+/****************************************************************************
+** Form interface generated from reading ui file 'DlgRef_2Sel3Spin2Rb_QTD.ui'
+**
+** Created: Tue Oct 9 15:16:54 2007
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef DLGREF_2SEL3SPIN2RB_QTD_H
+#define DLGREF_2SEL3SPIN2RB_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QSpacerItem;
+class QGroupBox;
+class QPushButton;
+class QLineEdit;
+class QLabel;
+class QRadioButton;
+class QSpinBox;
+
+class DlgRef_2Sel3Spin2Rb_QTD : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DlgRef_2Sel3Spin2Rb_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~DlgRef_2Sel3Spin2Rb_QTD();
+
+ QGroupBox* GroupBox1;
+ QPushButton* PushButton1;
+ QLineEdit* LineEdit1;
+ QLabel* TextLabel2;
+ QLabel* TextLabel5;
+ QRadioButton* RadioButton2;
+ QLabel* TextLabel3;
+ QSpinBox* SpinBox1;
+ QRadioButton* RadioButton1;
+ QSpinBox* SpinBox3;
+ QSpinBox* SpinBox2;
+ QLabel* TextLabel4;
+ QPushButton* PushButton2;
+ QLineEdit* LineEdit2;
+ QLabel* TextLabel1;
+
+protected:
+ QGridLayout* DlgRef_2Sel3Spin2Rb_QTDLayout;
+ QGridLayout* GroupBox1Layout;
+ QGridLayout* Layout1;
+ QSpacerItem* Spacer5;
+ QGridLayout* Layout2;
+
+};
+
+#endif // DLGREF_2SEL3SPIN2RB_QTD_H
DlgRef_2Sel1Spin.cxx \
DlgRef_2Sel2Spin.cxx \
DlgRef_2Sel3Spin.cxx \
+ DlgRef_2Sel3Spin2Rb_QTD.cxx \
+ DlgRef_2Sel3Spin2Rb.cxx \
DlgRef_1Sel1Spin1Check.cxx \
DlgRef_2Sel1Spin2Check.cxx \
DlgRef_2Sel2Spin1Check.cxx \
DlgRef_1Sel5Spin_QTD.h \
DlgRef_2Sel1Spin_QTD.h \
DlgRef_2Sel2Spin_QTD.h \
+ DlgRef_2Sel3Spin2Rb_QTD.h \
+ DlgRef_2Sel3Spin2Rb.h \
DlgRef_2Sel3Spin_QTD.h \
DlgRef_1Sel1Spin1Check_QTD.h \
DlgRef_2Sel1Spin2Check_QTD.h \
--- /dev/null
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DlgRef_2Sel3Spin2Rb_QTD</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>DlgRef_2Sel3Spin2Rb_QTD</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>439</width>
+ <height>340</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>DlgRef_2Sel3Spin2Rb_QTD</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>PushButton1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="2">
+ <property name="name">
+ <cstring>LineEdit1</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL2</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL5</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>RadioButton2</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL3</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="2" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>SpinBox1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>RadioButton1</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="4">
+ <property name="name">
+ <cstring>SpinBox3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="2">
+ <property name="name">
+ <cstring>SpinBox2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL4</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>PushButton2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer row="3" column="2">
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>207</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit" row="1" column="2">
+ <property name="name">
+ <cstring>LineEdit2</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL1</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<slots>
+ <slot>RadioButton_Clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
#uic -o DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui
#uic -o DlgRef_3Check_QTD.cxx -impl DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui
-uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
-uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+
+uic -o DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui
+uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui
\ No newline at end of file
return result ;
}
+//================================================================================
+// function : MakeFilletR1R2()
+// purpose : Create a cylinder topology
+//================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilletR1R2( GEOM::GEOM_Shape_ptr shape,
+ CORBA::Double radius1,
+ CORBA::Double radius2,
+ CORBA::Short ShapeType,
+ const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID )
+ throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds ;
+
+ const TopoDS_Shape aShape = GetTopoShape(shape) ;
+ if( aShape.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM);
+ }
+
+ BRepFilletAPI_MakeFillet fill(aShape);
+
+ try {
+ /* case all */
+ if(ListOfID.length() == 0) {
+ TopExp_Explorer Exp ( aShape, TopAbs_EDGE );
+ for (Exp; Exp.More(); Exp.Next()) {
+ TopoDS_Edge E =TopoDS::Edge(Exp.Current());
+ fill.Add(E);
+ }
+ for (int i = 1;i<=fill.NbContours();i++) {
+#if OCC_VERSION_MAJOR >= 5
+ fill.SetRadius(radius1,radius2,i,i);
+#else
+ fill.SetRadius(radius1,radius2,i);
+#endif
+ }
+ tds = fill.Shape();
+
+ } else {
+
+ /* case selection */
+ for ( unsigned int ind = 0; ind < ListOfID.length(); ind++ ) {
+ TopoDS_Shape ss ;
+ if( GetShapeFromIndex( aShape, (TopAbs_ShapeEnum)ShapeType, ListOfID[ind], ss ) ) {
+ TopoDS_Edge E = TopoDS::Edge(ss) ;
+ fill.Add( E );
+ }
+ }
+ for (int i = 1;i<=fill.NbContours();i++) {
+#if OCC_VERSION_MAJOR >= 5
+ fill.SetRadius(radius1,radius2,i,i);
+#else
+ fill.SetRadius(radius1,radius2,i);
+#endif
+ }
+ tds = fill.Shape();
+ }
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeFilletR1R2", SALOME::BAD_PARAM);
+ }
+
+ if (tds.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("Make Fillet aborted", SALOME::BAD_PARAM);
+ }
+ result = CreateObject(tds);
+ InsertInLabelOneArgument(aShape, shape, tds, result, myCurrentOCAFDoc) ;
+
+ return result ;
+}
//================================================================================
// function : MakeChamfer
return result ;
}
+//================================================================================
+// function : MakeChamferAD
+// purpose : Create a Chamfer topology by Lenght & Angle
+//================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamferAD( GEOM::GEOM_Shape_ptr shape,
+ CORBA::Double d,
+ CORBA::Double angle,
+ CORBA::Short ShapeType,
+ const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID )
+ throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds ;
+
+ const TopoDS_Shape aShape = GetTopoShape(shape) ;
+ if( aShape.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM);
+ }
+
+ BRepFilletAPI_MakeChamfer MC(aShape);
+
+ try {
+ /* case all */
+ TopTools_IndexedDataMapOfShapeListOfShape M;
+ TopExp::MapShapesAndAncestors(aShape,TopAbs_EDGE,TopAbs_FACE,M);
+ if(ListOfID.length() == 0) {
+ for (int i = 1;i<=M.Extent();i++) {
+ TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
+ TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
+ if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
+ MC.AddDA(d,angle,E,F);
+ }
+ tds = MC.Shape();
+
+ } else {
+
+ /* case selection */
+ for ( unsigned int ind = 0; ind < ListOfID.length(); ind++ ) {
+ TopoDS_Shape ss ;
+ if( GetShapeFromIndex( aShape, (TopAbs_ShapeEnum)ShapeType, ListOfID[ind], ss ) ) {
+ TopoDS_Edge E = TopoDS::Edge( ss ) ;
+ TopoDS_Face F = TopoDS::Face(M.FindFromKey(E).First());
+ if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
+ MC.AddDA(d,angle,E,F);
+ }
+ }
+ tds = MC.Shape();
+ }
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeChamferAD", SALOME::BAD_PARAM);
+ }
+
+ if (tds.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("Make ChamferAD aborted", SALOME::BAD_PARAM);
+ }
+ result = CreateObject(tds);
+ InsertInLabelOneArgument(aShape, shape, tds, result, myCurrentOCAFDoc) ;
+ return result ;
+}
+
//=================================================================================
// function : CheckShape()
// purpose :
msgid "ICON_DLG_CIRCLE_PV"
msgstr "circlepointvector.png"
+#CircleDlg
+msgid "ICON_DLG_CIRCLE_C2P"
+msgstr "circlecenter2pnts.png"
+
+
#VectorDlg
msgid "ICON_DLG_VECTOR_2P"
msgstr "vector2points.png"
msgid "GEOM_RADIUS"
msgstr "Radius :"
+#Radius
+msgid "GEOM_CONSTANT_RADIUS"
+msgstr "Radius :"
+
+#Radius
+msgid "GEOM_R1"
+msgstr "R1 :"
+
+#Radius
+msgid "GEOM_R2"
+msgstr "R2 :"
+
#Radius i
msgid "GEOM_RADIUS_I"
msgstr "Radius %1 :"
msgid "ICON_DLG_CIRCLE_PV"
msgstr "circlepointvector.png"
+#CircleDlg
+msgid "ICON_DLG_CIRCLE_C2P"
+msgstr "circlecenter2pnts.png"
+
#VectorDlg
msgid "ICON_DLG_VECTOR_2P"
msgstr "vector2points.png"
msgid "ICON_DLG_CHAMFER_EDGE"
msgstr "chamferedge.png"
+#ChamferDlg
+msgid "ICON_DLG_CHAMFER_EDGE_FROM_FACE"
+msgstr "chamferedgefromface.png"
+
+
#FilletDlg
msgid "ICON_DLG_FILLET_FACE"
msgstr "filletface.png"
msgid "GEOM_RADIUS"
msgstr "Radius :"
+#Radius
+msgid "GEOM_CONSTANT_RADIUS"
+msgstr "Radius :"
+
+#Radius
+msgid "GEOM_R1"
+msgstr "R1 :"
+
+#Radius
+msgid "GEOM_R2"
+msgstr "R2 :"
+
#Radius i
msgid "GEOM_RADIUS_I"
msgstr "Radius %1 :"
msgid "GEOM_D2"
msgstr "D2 :"
+#D
+msgid "GEOM_D"
+msgstr "D :"
+
#
#==============================================================================
#
msgid "GEOM_CHAMFER_EDGES"
msgstr "Chamfer On Edges From Shape"
+#: GeometryGUI_ChamferDlg.cxx:58
+msgid "GEOM_CHAMFER_EDGE"
+msgstr "Chamfer On Selected Edges"
+
+#: GeometryGUI_ChamferDlg.cxx:58
+msgid "SELECTED_EDGE"
+msgstr "Selected Edges"
+
#: GeometryGUI_ChamferDlg.cxx:58
msgid "GEOM_CHAMFER_FACES"
msgstr "Chamfer On Faces From Shape"
msgid "GEOM_3_POINTS"
msgstr "3 points"
+msgid "GEOM_CENTER_2POINTS"
+msgstr "Center and two points"
+
msgid "GEOM_POINT1"
msgstr "Point 1"
msgstr "Erase all"
msgid "TOP_DISPLAY"
-msgstr "Display"
+msgstr "Show"
msgid "MEN_DISPLAY"
-msgstr "Display"
+msgstr "Show"
msgid "STB_DISPLAY"
-msgstr "Display"
+msgstr "Show object(s)"
msgid "TOP_DISPLAY_ONLY"
msgstr "Display only"
msgstr "Display only"
msgid "TOP_ERASE"
-msgstr "Erase"
+msgstr "Hide"
msgid "MEN_ERASE"
-msgstr "Erase"
+msgstr "Hide"
msgid "STB_ERASE"
-msgstr "Erase"
+msgstr "Hide object(s)"
msgid "TOP_POP_RENAME"
msgstr "Rename"
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
- } else if (aType == CHAMFER_SHAPE_EDGE) {
+ }else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
// chamfer on edges, common to two faces, with D1 on the first face
- double aD1 = aCI.GetD1();
- double aD2 = aCI.GetD2();
+
TopoDS_Shape aFace1, aFace2;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) &&
- GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2)) {
- TopoDS_Face F = TopoDS::Face(aFace1);
-
- // fill map of edges of the second face
- TopTools_MapOfShape aMap;
- TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE);
- for (; Exp2.More(); Exp2.Next()) {
- aMap.Add(Exp2.Current());
+ GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2))
+ {
+ TopoDS_Face F = TopoDS::Face(aFace1);
+
+ // fill map of edges of the second face
+ TopTools_MapOfShape aMap;
+ TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE);
+ for (; Exp2.More(); Exp2.Next()) {
+ aMap.Add(Exp2.Current());
+ }
+
+ // find edges of the first face, common with the second face
+ TopExp_Explorer Exp (aFace1, TopAbs_EDGE);
+ for (; Exp.More(); Exp.Next()) {
+ if (aMap.Contains(Exp.Current())) {
+ TopoDS_Edge E = TopoDS::Edge(Exp.Current());
+ if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
+ {
+ if ( aType == CHAMFER_SHAPE_EDGE )
+ {
+ double aD1 = aCI.GetD1();
+ double aD2 = aCI.GetD2();
+ fill.Add(aD1, aD2, E, F);
+ }
+ else
+ {
+ double aD = aCI.GetD();
+ double anAngle = aCI.GetAngle();
+ fill.AddDA(aD, anAngle, E, F);
+ }
+ }
+ }
+ }
}
-
- // find edges of the first face, common with the second face
- TopExp_Explorer Exp (aFace1, TopAbs_EDGE);
- for (; Exp.More(); Exp.Next()) {
- if (aMap.Contains(Exp.Current())) {
- TopoDS_Edge E = TopoDS::Edge(Exp.Current());
- if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
- fill.Add(aD1, aD2, E, F);
- }
- }
- }
- } else if (aType == CHAMFER_SHAPE_FACES) {
+ }
+ else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) {
// chamfer on all edges of the selected faces, with D1 on the selected face
// (on first selected face, if the edge belongs to two selected faces)
- double aD1 = aCI.GetD1();
- double aD2 = aCI.GetD2();
+
int aLen = aCI.GetLength();
int ind = 1;
TopTools_MapOfShape aMap;
for (; ind <= aLen; ind++)
{
TopoDS_Shape aShapeFace;
- if (GEOMImpl_ILocalOperations::GetSubShape
- (aShapeBase, aCI.GetFace(ind), aShapeFace)) {
- TopoDS_Face F = TopoDS::Face(aShapeFace);
- TopExp_Explorer Exp (F, TopAbs_EDGE);
- for (; Exp.More(); Exp.Next()) {
- if (!aMap.Contains(Exp.Current())) {
- TopoDS_Edge E = TopoDS::Edge(Exp.Current());
- if (!BRepTools::IsReallyClosed(E, F) &&
- !BRep_Tool::Degenerated(E) &&
- M.FindFromKey(E).Extent() == 2)
- fill.Add(aD1, aD2, E, F);
- }
- }
- }
+ if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace))
+ {
+ TopoDS_Face F = TopoDS::Face(aShapeFace);
+ TopExp_Explorer Exp (F, TopAbs_EDGE);
+ for (; Exp.More(); Exp.Next()) {
+ if (!aMap.Contains(Exp.Current()))
+ {
+ TopoDS_Edge E = TopoDS::Edge(Exp.Current());
+ if (!BRepTools::IsReallyClosed(E, F) &&
+ !BRep_Tool::Degenerated(E) &&
+ M.FindFromKey(E).Extent() == 2)
+ if (aType == CHAMFER_SHAPE_FACES)
+ {
+ double aD1 = aCI.GetD1();
+ double aD2 = aCI.GetD2();
+ fill.Add(aD1, aD2, E, F);
+ }
+ else
+ {
+ double aD = aCI.GetD();
+ double anAngle = aCI.GetAngle();
+ fill.AddDA(aD, anAngle, E, F);
+ }
+ }
+ }
+ }
}
- } else {
+ }
+else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD)
+ {
+ // chamfer on selected edges with lenght param D1 & D2.
+
+ int aLen = aCI.GetLength();
+ int ind = 1;
+ TopTools_MapOfShape aMap;
+ TopTools_IndexedDataMapOfShapeListOfShape M;
+ GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
+ for (; ind <= aLen; ind++)
+ {
+ TopoDS_Shape aShapeEdge;
+ if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetEdge(ind), aShapeEdge))
+ {
+ TopoDS_Edge E = TopoDS::Edge(aShapeEdge);
+ const TopTools_ListOfShape& aFacesList = M.FindFromKey(E);
+ TopoDS_Face F = TopoDS::Face( aFacesList.First() );
+ if (aType == CHAMFER_SHAPE_EDGES)
+ {
+ double aD1 = aCI.GetD1();
+ double aD2 = aCI.GetD2();
+ fill.Add(aD1, aD2, E, F);
+ }
+ else
+ {
+ double aD = aCI.GetD();
+ double anAngle = aCI.GetAngle();
+ fill.AddDA(aD, anAngle, E, F);
+ }
+ }
+ }
+ }
+ else {
}
fill.Build();
}
}
}
+ else if (aType == CIRCLE_CENTER_TWO_PNT) {
+ Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
+ Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
+ Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3();
+ TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue();
+ TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue();
+ TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue();
+ if (aShapePnt1.ShapeType() == TopAbs_VERTEX && aShapePnt2.ShapeType() == TopAbs_VERTEX &&
+ aShapePnt3.ShapeType() == TopAbs_VERTEX)
+ {
+ gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1));
+ gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2));
+ gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3));
+
+ if (aP1.Distance(aP2) < gp::Resolution() ||
+ aP1.Distance(aP3) < gp::Resolution() ||
+ aP2.Distance(aP3) < gp::Resolution())
+ Standard_ConstructionError::Raise("Circle creation aborted: coincident points given");
+ if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
+ Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
+ double x, y, z, x1, y1, z1, x2, y2, z2, dx, dy, dz, dx2, dy2, dz2, dx3, dy3, dz3, aRadius;
+ //Calculations for Radius
+ x = aP1.X(); y = aP1.Y(); z = aP1.Z();
+ x1 = aP2.X(); y1 = aP2.Y(); z1 = aP2.Z();
+ dx = x1 - x;
+ dy = y1 - y;
+ dz = z1 - z;
+ aRadius = sqrt(dx*dx + dy*dy + dz*dz);
+ //Calculations for Plane Vector
+ x2 = aP3.X(); y2 = aP3.Y(); z2 = aP3.Z();
+ dx2 = x2 - x; dy2 = y2 - y; dz2 = z2 - z;
+ dx3 = ((dy*dz2) - (dy2*dz))/100;
+ dy3 = ((dx2*dz) - (dx*dz2))/100;
+ dz3 = ((dx*dy2) - (dx2*dy))/100;
+ //Make Plane Vector
+ gp_Dir aDir ( dx3, dy3, dz3 );
+ //Make Circle
+ gp_Ax2 anAxes (aP1, aDir);
+ gp_Circ aCirc (anAxes, aRadius);
+ aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
+ }
+ }
else if (aType == CIRCLE_THREE_PNT) {
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value();
aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
- }
+ }
}
- else {
+ else {
}
if (aShape.IsNull()) return 0;
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
fill.Add(E);
}
- } else if (aType == FILLET_SHAPE_EDGES) {
+ } else if (aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_EDGES_2R) {
int aLen = aCI.GetLength();
int ind = 1;
for (; ind <= aLen; ind++) {
TopoDS_Shape aShapeEdge;
if (GEOMImpl_ILocalOperations::GetSubShape
(aShapeBase, aCI.GetEdge(ind), aShapeEdge)) {
- fill.Add(TopoDS::Edge(aShapeEdge));
+ fill.Add(TopoDS::Edge(aShapeEdge));
}
}
- } else if (aType == FILLET_SHAPE_FACES) {
+ } else if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_FACES_2R) {
int aLen = aCI.GetLength();
int ind = 1;
for (; ind <= aLen; ind++) {
}
} else {
}
+ if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_ALL)
+ for (int i = 1; i <= fill.NbContours(); i++)
+ fill.SetRadius(aCI.GetR(), i, 1);
+ else if (aType == FILLET_SHAPE_FACES_2R || aType == FILLET_SHAPE_EDGES_2R)
+ for (int i = 1; i <= fill.NbContours(); i++)
+ {
+ fill.SetRadius(aCI.GetR1(), aCI.GetR2(), i, 1);
+ }
- for (int i = 1; i <= fill.NbContours(); i++) {
- fill.SetRadius(aCI.GetR(), i, 1);
- }
fill.Build();
if (!fill.IsDone()) {
StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
#include "GEOM_Function.hxx"
-#define CHAM_ARG_SH 1
-#define CHAM_ARG_D1 2
-#define CHAM_ARG_D2 3
-#define CHAM_ARG_LENG 4
-#define CHAM_ARG_LAST 4
+#define CHAM_ARG_SH 1
+#define CHAM_ARG_D1 2
+#define CHAM_ARG_D2 3
+#define CHAM_ARG_ANGLE 3
+#define CHAM_ARG_LENG 4
+#define CHAM_ARG_LAST 4
class GEOMImpl_IChamfer
{
void SetD (double theD) { _func->SetReal(CHAM_ARG_D1, theD); }
void SetD1(double theD) { _func->SetReal(CHAM_ARG_D1, theD); }
void SetD2(double theD) { _func->SetReal(CHAM_ARG_D2, theD); }
+ void SetAngle(double theAngle) { _func->SetReal(CHAM_ARG_ANGLE, theAngle); }
double GetD () { return _func->GetReal(CHAM_ARG_D1); }
double GetD1() { return _func->GetReal(CHAM_ARG_D1); }
double GetD2() { return _func->GetReal(CHAM_ARG_D2); }
+ double GetAngle() { return _func->GetReal(CHAM_ARG_ANGLE); }
void SetLength(int theLen) { _func->SetInteger(CHAM_ARG_LENG, theLen); }
{ _func->SetInteger(CHAM_ARG_LAST + 1, theFace); }
void SetFace2(int theFace)
{ _func->SetInteger(CHAM_ARG_LAST + 2, theFace); }
+ void SetEdge(int theInd, int theEdge)
+ { _func->SetInteger(CHAM_ARG_LAST + theInd, theEdge); }
int GetFace(int theInd) { return _func->GetInteger(CHAM_ARG_LAST + theInd); }
int GetFace1() { return _func->GetInteger(CHAM_ARG_LAST + 1); }
int GetFace2() { return _func->GetInteger(CHAM_ARG_LAST + 2); }
+ int GetEdge(int theInd) { return _func->GetInteger(CHAM_ARG_LAST + theInd); }
private:
return aCircle;
}
+//=============================================================================
+/*!
+ * MakeCircleCenter2Pnt
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
+ Handle(GEOM_Object) thePnt2,
+ Handle(GEOM_Object) thePnt3)
+{
+ SetErrorCode(KO);
+
+ if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
+
+ //Add a new Circle object
+ Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
+
+ //Add a new Circle function for creation a circle relatively to center and 2 points
+ Handle(GEOM_Function) aFunction =
+ aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
+
+ GEOMImpl_ICircle aCI (aFunction);
+
+ Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
+ Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
+ Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
+
+ if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
+
+ aCI.SetPoint1(aRefPnt1);
+ aCI.SetPoint2(aRefPnt2);
+ aCI.SetPoint3(aRefPnt3);
+
+ //Compute the Circle value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Circle 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) << aCircle << " = geompy.MakeCircleCenter2Pnt("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
+
+ SetErrorCode(OK);
+ return aCircle;
+}
+
//=============================================================================
/*!
* MakeCirclePntVecR
Standard_EXPORT Handle(GEOM_Object) MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3);
+ Standard_EXPORT Handle(GEOM_Object) MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
+ Handle(GEOM_Object) thePnt2,
+ Handle(GEOM_Object) thePnt3);
Standard_EXPORT Handle(GEOM_Object) MakeCirclePntVecR (Handle(GEOM_Object) thePnt,
Handle(GEOM_Object) theVec, double theR);
#define FILLET_ARG_SH 1
#define FILLET_ARG_R 2
+#define FILLET_ARG_R1 4
+#define FILLET_ARG_R2 5
#define FILLET_ARG_LENG 3
#define FILLET_ARG_LAST 3
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET_ARG_SH); }
void SetR(double theR) { _func->SetReal(FILLET_ARG_R, theR); }
+ void SetR1(double theR1) { _func->SetReal(FILLET_ARG_R1, theR1); }
+ void SetR2(double theR2) { _func->SetReal(FILLET_ARG_R2, theR2); }
double GetR() { return _func->GetReal(FILLET_ARG_R); }
+ double GetR1() { return _func->GetReal(FILLET_ARG_R1); }
+ double GetR2() { return _func->GetReal(FILLET_ARG_R2); }
void SetLength(int theLen) { _func->SetInteger(FILLET_ARG_LENG, theLen); }
return aFillet;
}
+//=============================================================================
+/*!
+ * MakeFilletEdges R1 R2
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdgesR1R2
+ (Handle(GEOM_Object) theShape, double theR1, double theR2, list<int> theEdges)
+{
+ SetErrorCode(KO);
+
+ //Add a new Fillet object
+ Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET);
+
+ //Add a new Fillet function
+ Handle(GEOM_Function) aFunction =
+ aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_EDGES_2R);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL;
+
+ GEOMImpl_IFillet aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetShape(aRefShape);
+ aCI.SetR1(theR1);
+ aCI.SetR2(theR2);
+ int aLen = theEdges.size();
+ aCI.SetLength(aLen);
+
+ int ind = 1;
+ list<int>::iterator it = theEdges.begin();
+ for (; it != theEdges.end(); it++, ind++) {
+ aCI.SetEdge(ind, (*it));
+ }
+
+ //Compute the Fillet value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Fillet 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 pd (aFunction);
+ pd << aFillet << " = geompy.MakeFilletR1R2(" << theShape
+ << ", " << theR1 << ", " <<theR2 << ", geompy.ShapeType[\"EDGE\"], [";
+
+ it = theEdges.begin();
+ pd << (*it++);
+ while (it != theEdges.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return aFillet;
+}
+
+
//=============================================================================
/*!
* MakeFilletFaces
return aFillet;
}
+//=============================================================================
+/*!
+ * MakeFilletFaces R1 R2
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFacesR1R2
+ (Handle(GEOM_Object) theShape, double theR1, double theR2, list<int> theFaces)
+{
+ SetErrorCode(KO);
+
+ //Add a new Fillet object
+ Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET);
+
+ //Add a new Fillet function
+ Handle(GEOM_Function) aFunction =
+ aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_FACES_2R);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL;
+
+ GEOMImpl_IFillet aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetShape(aRefShape);
+ aCI.SetR1(theR1);
+ aCI.SetR2(theR2);
+ int aLen = theFaces.size();
+ aCI.SetLength(aLen);
+
+ int ind = 1;
+ list<int>::iterator it = theFaces.begin();
+ for (; it != theFaces.end(); it++, ind++) {
+ aCI.SetFace(ind, (*it));
+ }
+
+ //Compute the Fillet value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Fillet 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 pd (aFunction);
+ pd << aFillet << " = geompy.MakeFilletR1R2(" << theShape
+ << ", " << theR1 << ", " << theR2 << ", geompy.ShapeType[\"FACE\"], [";
+
+ it = theFaces.begin();
+ pd << (*it++);
+ while (it != theFaces.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return aFillet;
+}
+
//=============================================================================
/*!
* MakeChamferAll
return aChamfer;
}
+//=============================================================================
+/*!
+ * MakeChamferEdgeAD
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgeAD
+ (Handle(GEOM_Object) theShape, double theD, double theAngle,
+ int theFace1, int theFace2)
+{
+ SetErrorCode(KO);
+
+ //Add a new Chamfer object
+ Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER);
+
+ //Add a new Chamfer function
+ Handle(GEOM_Function) aFunction =
+ aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGE_AD);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL;
+
+ GEOMImpl_IChamfer aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetShape(aRefShape);
+ aCI.SetD(theD);
+ aCI.SetAngle(theAngle);
+ aCI.SetFace1(theFace1);
+ aCI.SetFace2(theFace2);
+
+ //Compute the Chamfer value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Chamfer 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) << aChamfer
+ << " = geompy.MakeChamferEdgeAD(" << theShape << ", " << theD
+ << ", " << theAngle << ", " << theFace1 << ", " << theFace2 << ")";
+ cout << "ANGLE = " << theAngle << endl;
+ SetErrorCode(OK);
+ return aChamfer;
+}
+
//=============================================================================
/*!
* MakeChamferFaces
return aChamfer;
}
+//=============================================================================
+/*!
+ * MakeChamferFacesAD
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFacesAD
+ (Handle(GEOM_Object) theShape, double theD, double theAngle,
+ list<int> theFaces)
+{
+ SetErrorCode(KO);
+
+ //Add a new Chamfer object
+ Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER);
+
+ //Add a new Chamfer function
+ Handle(GEOM_Function) aFunction =
+ aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_FACES_AD);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL;
+
+ GEOMImpl_IChamfer aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetShape(aRefShape);
+ aCI.SetD(theD);
+ aCI.SetAngle(theAngle);
+ int aLen = theFaces.size();
+ aCI.SetLength(aLen);
+
+ int ind = 1;
+ list<int>::iterator it = theFaces.begin();
+ for (; it != theFaces.end(); it++, ind++) {
+ aCI.SetFace(ind, (*it));
+ }
+
+ //Compute the Chamfer value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Chamfer 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 pd (aFunction);
+ pd << aChamfer << " = geompy.MakeChamferFacesAD(" << theShape
+ << ", " << theD << ", " << theAngle << ", [";
+
+ it = theFaces.begin();
+ pd << (*it++);
+ while (it != theFaces.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return aChamfer;
+}
+
+//=============================================================================
+/*!
+ * MakeChamferEdges
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges
+ (Handle(GEOM_Object) theShape, double theD1, double theD2,
+ list<int> theEdges)
+{
+ SetErrorCode(KO);
+
+ //Add a new Chamfer object
+ Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER);
+
+ //Add a new Chamfer function
+ Handle(GEOM_Function) aFunction =
+ aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGES);
+ if (aFunction.IsNull()) { return NULL; cout << "Edges Function is NULL!!!" << endl; }
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID())
+ { return NULL; cout << "Chamfer Driver is NULL!!!" << endl; }
+
+ GEOMImpl_IChamfer aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) { return NULL; cout << "Shape is NULL!!!" << endl; }
+
+ aCI.SetShape(aRefShape);
+ aCI.SetD1(theD1);
+ aCI.SetD2(theD2);
+ int aLen = theEdges.size();
+ aCI.SetLength(aLen);
+
+ int ind = 1;
+ list<int>::iterator it = theEdges.begin();
+ for (; it != theEdges.end(); it++, ind++) {
+ aCI.SetEdge(ind, (*it));
+ }
+
+ //Compute the Chamfer value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Chamfer 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 pd (aFunction);
+ pd << aChamfer << " = geompy.MakeChamferEdges(" << theShape
+ << ", " << theD1 << ", " << theD2 << ", [";
+
+ it = theEdges.begin();
+ pd << (*it++);
+ while (it != theEdges.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return aChamfer;
+}
+
+//=============================================================================
+/*!
+ * MakeChamferEdgesAD
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgesAD
+ (Handle(GEOM_Object) theShape, double theD, double theAngle,
+ list<int> theEdges)
+{
+ SetErrorCode(KO);
+
+ //Add a new Chamfer object
+ Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER);
+
+ //Add a new Chamfer function
+ Handle(GEOM_Function) aFunction =
+ aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGES_AD);
+ if (aFunction.IsNull()) { return NULL; cout << "Edges Function is NULL!!!" << endl; }
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID())
+ { return NULL; cout << "Chamfer Driver is NULL!!!" << endl; }
+
+ GEOMImpl_IChamfer aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) { return NULL; cout << "Shape is NULL!!!" << endl; }
+
+ aCI.SetShape(aRefShape);
+ aCI.SetD(theD);
+ aCI.SetAngle(theAngle);
+ int aLen = theEdges.size();
+ aCI.SetLength(aLen);
+
+ int ind = 1;
+ list<int>::iterator it = theEdges.begin();
+ for (; it != theEdges.end(); it++, ind++) {
+ aCI.SetEdge(ind, (*it));
+ }
+
+ //Compute the Chamfer value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Chamfer 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 pd (aFunction);
+ pd << aChamfer << " = geompy.MakeChamferEdgesAD(" << theShape
+ << ", " << theD << ", " << theAngle << ", [";
+
+ it = theEdges.begin();
+ pd << (*it++);
+ while (it != theEdges.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return aChamfer;
+}
+
//=============================================================================
/*!
* Archimede
Standard_EXPORT Handle(GEOM_Object) MakeFilletAll (Handle(GEOM_Object) theShape, double theR);
Standard_EXPORT Handle(GEOM_Object) MakeFilletEdges (Handle(GEOM_Object) theShape, double theR,
list<int> theEdges);
+ Standard_EXPORT Handle(GEOM_Object) MakeFilletEdgesR1R2 (Handle(GEOM_Object) theShape,
+ double theR1, double theR2,
+ list<int> theEdges);
Standard_EXPORT Handle(GEOM_Object) MakeFilletFaces (Handle(GEOM_Object) theShape, double theR,
list<int> theFaces);
+ Standard_EXPORT Handle(GEOM_Object) MakeFilletFacesR1R2 (Handle(GEOM_Object) theShape,
+ double theR1, double theR2,
+ list<int> theFaces);
Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD);
Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape,
double theD1, double theD2,
int theFace1, int theFace2);
+ Standard_EXPORT Handle(GEOM_Object) MakeChamferEdgeAD (Handle(GEOM_Object) theShape,
+ double theD, double theAngle,
+ int theFace1, int theFace2);
Standard_EXPORT Handle(GEOM_Object) MakeChamferFaces (Handle(GEOM_Object) theShape,
double theD1, double theD2,
list<int> theFaces);
-
+ Standard_EXPORT Handle(GEOM_Object) MakeChamferFacesAD (Handle(GEOM_Object) theShape,
+ double theD, double theAngle,
+ list<int> theFaces);
+ Standard_EXPORT Handle(GEOM_Object) MakeChamferEdges (Handle(GEOM_Object) theShape,
+ double theD1, double theD2,
+ list<int> theEdges);
+ Standard_EXPORT Handle(GEOM_Object) MakeChamferEdgesAD (Handle(GEOM_Object) theShape,
+ double theD, double theAngle,
+ list<int> theEdges);
Standard_EXPORT Handle(GEOM_Object) MakeArchimede (Handle(GEOM_Object) theShape,
double theWeight, double theWaterDensity,
double theMeshingDeflection);
#define CIRCLE_THREE_PNT 1
#define CIRCLE_PNT_VEC_R 2
+#define CIRCLE_CENTER_TWO_PNT 3
#define SPLINE_BEZIER 1
#define SPLINE_INTERPOLATION 2
#define CIRC_ARC_THREE_PNT 1
#define CIRC_ARC_CENTER 2
-#define FILLET_SHAPE_ALL 1
-#define FILLET_SHAPE_EDGES 2
-#define FILLET_SHAPE_FACES 3
-
-#define CHAMFER_SHAPE_ALL 1
-#define CHAMFER_SHAPE_EDGE 2
-#define CHAMFER_SHAPE_FACES 3
+#define FILLET_SHAPE_ALL 1
+#define FILLET_SHAPE_EDGES 2
+#define FILLET_SHAPE_FACES 3
+#define FILLET_SHAPE_EDGES_2R 4
+#define FILLET_SHAPE_FACES_2R 5
+
+#define CHAMFER_SHAPE_ALL 1
+#define CHAMFER_SHAPE_EDGE 2
+#define CHAMFER_SHAPE_FACES 3
+#define CHAMFER_SHAPE_EDGES 4
+#define CHAMFER_SHAPE_EDGE_AD 5
+#define CHAMFER_SHAPE_FACES_AD 6
+#define CHAMFER_SHAPE_EDGES_AD 7
#define WIRE_EDGES 1
#define FACE_WIRE 2
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeCircleCenter2Pnt
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleCenter2Pnt
+ (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
+ GEOM::GEOM_Object_ptr thePnt3)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
+
+ //Get the reference points
+ Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
+ (thePnt1->GetStudyID(), thePnt1->GetEntry());
+ Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
+ (thePnt2->GetStudyID(), thePnt2->GetEntry());
+ Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
+ (thePnt3->GetStudyID(), thePnt3->GetEntry());
+
+ if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
+
+ // Make Circle
+ Handle(GEOM_Object) anObject = GetOperations()->MakeCircleCenter2Pnt(aPnt1, aPnt2, aPnt3);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeEllipse
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
+ GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
+ GEOM::GEOM_Object_ptr thePnt2,
+ GEOM::GEOM_Object_ptr thePnt3);
+
GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
GEOM::GEOM_Object_ptr theVector,
double theRMajor, double theRMinor);
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeFilletEdges R1 R2
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2
+ (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
+ CORBA::Double theR2, const GEOM::ListOfLong& theEdges)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference edges
+ int ind = 0;
+ int aLen = theEdges.length();
+ list<int> anEdges;
+ for (; ind < aLen; ind++) {
+ anEdges.push_back(theEdges[ind]);
+ }
+
+ //Create the Fillet
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeFilletEdgesR1R2(aShapeRef, theR1, theR2, anEdges);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeFilletFaces
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeFilletFaces R1 R2
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
+ (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
+ CORBA::Double theR2, const GEOM::ListOfLong& theFaces)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference faces
+ int ind = 0;
+ int aLen = theFaces.length();
+ list<int> aFaces;
+ for (; ind < aLen; ind++) {
+ aFaces.push_back(theFaces[ind]);
+ }
+
+ //Create the Fillet
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeFilletFacesR1R2(aShapeRef, theR1, theR2, aFaces);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeChamferAll
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeChamferEdgeAD
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ CORBA::Long theFace1, CORBA::Long theFace2)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Create the Chamfer
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeChamferEdgeAD(aShapeRef, theD, theAngle, theFace1, theFace2);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeChamferFacesAD
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ const GEOM::ListOfLong& theFaces)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference faces
+ int ind = 0;
+ int aLen = theFaces.length();
+ list<int> aFaces;
+ for (; ind < aLen; ind++) {
+ aFaces.push_back(theFaces[ind]);
+ }
+
+ //Create the Chamfer
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeChamferFacesAD(aShapeRef, theD, theAngle, aFaces);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MakeChamferEdges
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD1, CORBA::Double theD2,
+ const GEOM::ListOfLong& theEdges)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference edges
+ int ind = 0;
+ int aLen = theEdges.length();
+ list<int> aEdges;
+ for (; ind < aLen; ind++) {
+ aEdges.push_back(theEdges[ind]);
+ }
+
+ //Create the Chamfer
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeChamferEdges(aShapeRef, theD1, theD2, aEdges);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MakeChamferEdgesAD
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ const GEOM::ListOfLong& theEdges)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+ if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference edges
+ int ind = 0;
+ int aLen = theEdges.length();
+ list<int> aEdges;
+ for (; ind < aLen; ind++) {
+ aEdges.push_back(theEdges[ind]);
+ }
+
+ //Create the Chamfer
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeChamferEdgesAD(aShapeRef, theD, theAngle, aEdges);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
GEOM::GEOM_Object_ptr MakeFilletAll (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theR);
+
GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theEdges);
+
+ GEOM::GEOM_Object_ptr MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theR1,
+ CORBA::Double theR2,
+ const GEOM::ListOfLong& theEdges);
+
GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theFaces);
+ GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theR1,
+ CORBA::Double theR2,
+ const GEOM::ListOfLong& theFaces);
+
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);
+
GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2,
CORBA::Long theFace1, CORBA::Long theFace2);
+
+ GEOM::GEOM_Object_ptr MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ CORBA::Long theFace1, CORBA::Long theFace2);
+
GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2,
const GEOM::ListOfLong& theFaces);
+ GEOM::GEOM_Object_ptr MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ const GEOM::ListOfLong& theFaces);
+
+ GEOM::GEOM_Object_ptr MakeChamferEdges (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD1, CORBA::Double theD2,
+ const GEOM::ListOfLong& theEdges);
+
+ GEOM::GEOM_Object_ptr MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ const GEOM::ListOfLong& theEdges);
+
GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theWeight,
CORBA::Double theWaterDensity,
endService( " GEOM_Superv_i::MakeCircleThreePnt" );
return anObj;
}
+//=============================================================================
+// MakeCircleCenter2Pnt:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
+ GEOM::GEOM_Object_ptr thePnt2,
+ GEOM::GEOM_Object_ptr thePnt3)
+{
+ beginService( " GEOM_Superv_i::MakeCircleCenter2Pnt" );
+ MESSAGE("GEOM_Superv_i::MakeCircleCenter2Pnt");
+ getCurvesOp();
+ GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3);
+ endService( " GEOM_Superv_i::MakeCircleCenter2Pnt" );
+ return anObj;
+}
//=============================================================================
// MakeEllipse:
return NULL;
}
+//=============================================================================
+// MakeFilletEdges R1 R2:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theR1,
+ CORBA::Double theR2,
+ GEOM::GEOM_List_ptr theEdges)
+{
+ beginService( " GEOM_Superv_i::MakeFilletEdgesR1R2" );
+ MESSAGE("GEOM_Superv_i::MakeFilletEdgesR1R2");
+ if (GEOM_List_i<GEOM::ListOfLong>* aListImplE =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theEdges, myPOA).in())) {
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletEdgesR1R2(theShape, theR1,
+ theR2, aListImplE->GetList());
+ endService( " GEOM_Superv_i::MakeFilletEdgesR1R2" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeFilletEdgesR1R2" );
+ return NULL;
+}
+
//=============================================================================
// MakeFilletFaces:
//=============================================================================
return NULL;
}
+//=============================================================================
+// MakeFilletFaces R1 R2:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theR1,
+ CORBA::Double theR2,
+ GEOM::GEOM_List_ptr theFaces)
+{
+ beginService( " GEOM_Superv_i::MakeFilletFacesR1R2" );
+ MESSAGE("GEOM_Superv_i::MakeFilletFacesR1R2");
+ if (GEOM_List_i<GEOM::ListOfLong>* aListImplF =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theFaces, myPOA).in())) {
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletFacesR1R2(theShape, theR1, theR2,
+ aListImplF->GetList());
+ endService( " GEOM_Superv_i::MakeFilletFacesR1R2" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeFilletFacesR1R2" );
+ return NULL;
+}
+
//=============================================================================
// MakeChamferAll:
//=============================================================================
return anObj;
}
+//=============================================================================
+// MakeChamferEdgeAD:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ CORBA::Long theFace1, CORBA::Long theFace2)
+{
+ beginService( " GEOM_Superv_i::MakeChamferEdgeAD" );
+ MESSAGE("GEOM_Superv_i::MakeChamferEdgeAD");
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2);
+ endService( " GEOM_Superv_i::MakeChamferEdgeAD" );
+ return anObj;
+}
+
//=============================================================================
// MakeChamferFaces:
//=============================================================================
return NULL;
}
+//=============================================================================
+// MakeChamferFacesAD:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ GEOM::GEOM_List_ptr theFaces)
+{
+ beginService( " GEOM_Superv_i::MakeChamferFacesAD" );
+ MESSAGE("GEOM_Superv_i::MakeChamferFacesAD");
+ if (GEOM_List_i<GEOM::ListOfLong>* aListImplF =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theFaces, myPOA).in())) {
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferFacesAD(theShape, theD, theAngle, aListImplF->GetList());
+ endService( " GEOM_Superv_i::MakeChamferFacesAD" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeChamferFacesAD" );
+ return NULL;
+}
+
+//=============================================================================
+// MakeChamferEdges:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdges (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD1, CORBA::Double theD2,
+ GEOM::GEOM_List_ptr theEdges)
+{
+ beginService( " GEOM_Superv_i::MakeChamferEdges" );
+ MESSAGE("GEOM_Superv_i::MakeChamferEdges");
+ if (GEOM_List_i<GEOM::ListOfLong>* aListImplF =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theEdges, myPOA).in())) {
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdges(theShape, theD1, theD2, aListImplF->GetList());
+ endService( " GEOM_Superv_i::MakeChamferEdges" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeChamferEdges" );
+ return NULL;
+}
+
+//=============================================================================
+// MakeChamferEdgesAD:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ GEOM::GEOM_List_ptr theEdges)
+{
+ beginService( " GEOM_Superv_i::MakeChamferEdgesAD" );
+ MESSAGE("GEOM_Superv_i::MakeChamferEdgesAD");
+ if (GEOM_List_i<GEOM::ListOfLong>* aListImplF =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theEdges, myPOA).in())) {
+ getLocalOp();
+ GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdgesAD(theShape, theD, theAngle, aListImplF->GetList());
+ endService( " GEOM_Superv_i::MakeChamferEdgesAD" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeChamferEdgesAD" );
+ return NULL;
+}
+
//=============================================================================
// MakeArchimede:
//=============================================================================
GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
+ GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
+ GEOM::GEOM_Object_ptr thePnt2,
+ GEOM::GEOM_Object_ptr thePnt3);
GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
GEOM::GEOM_Object_ptr theVector,
CORBA::Double theRMajor, CORBA::Double theRMinor);
CORBA::Double theR);
GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
GEOM::GEOM_List_ptr theEdges);
+ GEOM::GEOM_Object_ptr MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
+ CORBA::Double theR2, GEOM::GEOM_List_ptr theEdges);
GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
GEOM::GEOM_List_ptr theFaces);
+ GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
+ CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces);
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);
GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2,
CORBA::Long theFace1, CORBA::Long theFace2);
+ GEOM::GEOM_Object_ptr MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ CORBA::Long theFace1, CORBA::Long theFace2);
GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2,
GEOM::GEOM_List_ptr theFaces);
+ GEOM::GEOM_Object_ptr MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ GEOM::GEOM_List_ptr theFaces);
+ GEOM::GEOM_Object_ptr MakeChamferEdges (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD1, CORBA::Double theD2,
+ GEOM::GEOM_List_ptr theEdges);
+ GEOM::GEOM_Object_ptr MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theD, CORBA::Double theAngle,
+ GEOM::GEOM_List_ptr theEdges);
GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theWeight,
CORBA::Double theWaterDensity,
Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
+ Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
#Local operations
Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge,
IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr
+ Fillet2 = geompy.MakeFilletR1R2 (Prism, radius1, radius2, ShapeTypeEdge,
+ IDlist_e) #(GEOM_Object_ptr, Double, Double, Short, ListOfLong)->GEOM_Object_ptr
Chamfer = geompy.MakeChamferEdge(Prism, d1, d2,
f_ind_1, f_ind_2) #(GEOM_Object_ptr, 2 Doubles, 2 Long)->GEOM_Object_ptr
Chamfer2 = geompy.MakeChamferFaces(Prism, d1, d2,
IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
+ Chamfer3 = geompy.MakeChamferEdges(Prism, d1, d2,
+ IDlist_e) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
+ Chamfer4 = geompy.MakeChamferFacesAD(Prism, d, angle,
+ IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
#Create Patterns
MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1)
id_Arc = geompy.addToStudy(Arc, "Arc")
id_Circle = geompy.addToStudy(Circle, "Circle")
id_Circle1 = geompy.addToStudy(Circle1, "Circle by 3 points")
+ id_Circle2 = geompy.addToStudy(Circle2, "Circle by center and 2 points")
id_Ellipse = geompy.addToStudy(Ellipse, "Ellipse")
id_Polyline = geompy.addToStudy(Polyline, "Polyline")
id_Bezier = geompy.addToStudy(Bezier, "Bezier")
id_Orientation = geompy.addToStudy(Orientation, "Orientation")
id_Fillet = geompy.addToStudy(Fillet, "Fillet")
+ id_Fillet2 = geompy.addToStudy(Fillet2, "FilletR1R2")
id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge")
id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces")
+ id_Chamfer3 = geompy.addToStudy(Chamfer3, "Chamfer on Edges")
+ id_Chamfer4 = geompy.addToStudy(Chamfer4, "Chamfer on Faces with params D Angle")
id_MultiTrans1D = geompy.addToStudy(MultiTrans1D, "MultiTrans1D")
id_MultiTrans2D = geompy.addToStudy(MultiTrans2D, "MultiTrans2D")
--- /dev/null
+# GEOM GEOM_SWIG : binding of C++ omplementaion with Python\r
+#\r
+# Copyright (C) 2003 CEA\r
+#\r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+# Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+#\r
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+#\r
+#\r
+# File : GEOM_example6.py\r
+# Author : Dmitry MATVEITCHEV\r
+# Module : GEOM\r
+# $Header$\r
+\r
+\r
+import salome\r
+import geompy\r
+\r
+ind = 1\r
+circlelist = []\r
+while ind < 6:\r
+ x1 = 0. + (10. * ind)\r
+ y1 = 0.\r
+ z1 = 0.\r
+ x2 = 10. + (10. * ind)\r
+ y2 = 20. * (ind+1)\r
+ z2 = 30. * (ind+1)\r
+ x3 = 50. + (10. * ind)\r
+ y3 = 0. * (ind+1)\r
+ z3 = -10. * (ind+1)\r
+\r
+ print x1, y1, z1, x2, y2, z2, x3, y3, z3\r
+\r
+ point1 = geompy.MakeVertex(x1, y1, z1)\r
+ name1 = "point1_%d"%(ind)\r
+ id_pt1 = geompy.addToStudy(point1, name1)\r
+ point2 = geompy.MakeVertex(x2, y2, z2)\r
+ name2 = "point2_%d"%(ind)\r
+ id_pt2 = geompy.addToStudy(point2, name2)\r
+ point3 = geompy.MakeVertex(x3, y3, z3)\r
+ name3 = "point3_%d"%(ind)\r
+ id_pt3 = geompy.addToStudy(point3, name3)\r
+\r
+ name = "circle%d"%(ind)\r
+ circle = geompy.MakeCircleCenter2Pnt(point1, point2, point3)\r
+ id_circle = geompy.addToStudy(circle, name)\r
+ circlelist.append(circle)\r
+ ind = ind + 1\r
GEOM_example3.py \
GEOM_example4.py \
GEOM_example5.py \
+ GEOM_example6.py \
GEOM_moteur.py \
GEOM_TestAll.py \
GEOM_TestOthers.py \
print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
return anObj
+def MakeCircleCenter2Pnt(p1,p2,p3):
+ anObj = CurvesOp.MakeCircleCenter2Pnt(p1,p2,p3)
+ if CurvesOp.IsDone() == 0:
+ print "MakeCircleCenter2Pnt : ", CurvesOp.GetErrorCode()
+ return anObj
+
def MakeEllipse(p1,v1,radiusMaj,radiusMin):
anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin)
if CurvesOp.IsDone() == 0:
print "MakeFillet : ", LocalOp.GetErrorCode()
return anObj
+def MakeFilletR1R2(aShape,radius1,radius2,aShapeType,ListShape):
+ anObj = None
+ if aShapeType == ShapeType["EDGE"]:
+ anObj = LocalOp.MakeFilletEdgesR1R2(aShape,radius1,radius2,ListShape)
+ else:
+ anObj = LocalOp.MakeFilletFacesR1R2(aShape,radius1,radius2,ListShape)
+ if LocalOp.IsDone() == 0:
+ print "MakeFilletR1R2 : ", LocalOp.GetErrorCode()
+ return anObj
+
def MakeChamferAll(aShape,d):
anObj = LocalOp.MakeChamferAll(aShape,d)
if LocalOp.IsDone() == 0:
print "MakeChamferEdge : ", LocalOp.GetErrorCode()
return anObj
+def MakeChamferEdgeAD(aShape,d,angle,face1,face2):
+ anObj = LocalOp.MakeChamferEdgeAD(aShape,d,angle,face1,face2)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdgeAD : ", LocalOp.GetErrorCode()
+ return anObj
+
def MakeChamferFaces(aShape,d1,d2,ListShape):
anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape)
if LocalOp.IsDone() == 0:
print "MakeChamferFaces : ", LocalOp.GetErrorCode()
return anObj
+def MakeChamferFacesAD(aShape,d,angle,ListShape):
+ anObj = LocalOp.MakeChamferFacesAD(aShape,d,angle,ListShape)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferFacesAD : ", LocalOp.GetErrorCode()
+ return anObj
+
+def MakeChamferEdges(aShape,d1,d2,ListShape):
+ anObj = LocalOp.MakeChamferEdges(aShape,d1,d2,ListShape)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdges : ", LocalOp.GetErrorCode()
+ return anObj
+
+def MakeChamferEdgesAD(aShape,d,angle,ListShape):
+ anObj = LocalOp.MakeChamferEdgesAD(aShape,d,angle,ListShape)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdgesAD : ", LocalOp.GetErrorCode()
+ return anObj
+
def MakeChamfer(aShape,d1,d2,aShapeType,ListShape):
anObj = None
if aShapeType == ShapeType["EDGE"]:
print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
return anObj
+## Create a circle, with given point1 as center,
+# passing through the point2 as radius and laying in the plane,
+# defined by all three given points.
+# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
+# @return New GEOM_Object, containing the created circle.
+#
+# Example: see GEOM_example6.py
+def MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3):
+ anObj = CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
+ if CurvesOp.IsDone() == 0:
+ print "MakeCircleCenter2Pnt : ", CurvesOp.GetErrorCode()
+ return anObj
+
## Create an ellipse with given center, normal vector and radiuses.
# @param thePnt Ellipse center.
# @param theVec Vector, normal to the plane of the ellipse.
if LocalOp.IsDone() == 0:
print "MakeFillet : ", LocalOp.GetErrorCode()
return anObj
+## The same but with two Fillet Radius R1 and R2
+def MakeFilletR1R2(theShape, theR1, theR2, theShapeType, theListShapes):
+ anObj = None
+ if theShapeType == ShapeType["EDGE"]:
+ anObj = LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
+ else:
+ anObj = LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
+ if LocalOp.IsDone() == 0:
+ print "MakeFilletR1R2 : ", LocalOp.GetErrorCode()
+ return anObj
## Perform a symmetric chamfer on all edges of the given shape.
# @param theShape Shape, to perform chamfer on.
if LocalOp.IsDone() == 0:
print "MakeChamferEdge : ", LocalOp.GetErrorCode()
return anObj
+## The Same chamfer but with params theD is chamfer lenght and
+# theAngle is Angle of chamfer
+def MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2):
+ anObj = LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdgeAD : ", LocalOp.GetErrorCode()
+ return anObj
## Perform a chamfer on all edges of the specified faces,
# with distance D1 on the first specified face (if several for one edge)
if LocalOp.IsDone() == 0:
print "MakeChamferFaces : ", LocalOp.GetErrorCode()
return anObj
+## The Same chamfer but with params theD is chamfer lenght and
+# theAngle is Angle of chamfer
+def MakeChamferFacesAD(theShape, theD, theAngle, theFaces):
+ anObj = LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferFacesAD : ", LocalOp.GetErrorCode()
+ return anObj
+
+## Perform a chamfer on edges,
+# with distance D1 on the first specified face (if several for one edge)
+# @param theShape Shape, to perform chamfer on.
+# @param theD1 and theD2 Chamfer size
+# @param theEdges Sequence of edges of \a theShape.
+# @return New GEOM_Object, containing the result shape.
+#
+# Example:
+def MakeChamferEdges(theShape, theD1, theD2, theEdges):
+ anObj = LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdges : ", LocalOp.GetErrorCode()
+ return anObj
+## The Same chamfer but with params theD is chamfer lenght and
+# theAngle is Angle of chamfer
+def MakeChamferEdgesAD(theShape, theD, theAngle, theEdges):
+ anObj = LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
+ if LocalOp.IsDone() == 0:
+ print "MakeChamferEdgesAD : ", LocalOp.GetErrorCode()
+ return anObj
## Shortcut to MakeChamferEdge() and MakeChamferFaces()
#
-// GEOM GEOMGUI : GUI for Geometry component
-//
-// Copyright (C) 2003 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-//
-// File : OperationGUI_ChamferDlg.cxx
-// Author : Damien COQUERET
-// Module : GEOM
-// $Header$
-
-#include "OperationGUI_ChamferDlg.h"
-#include "DlgRef_SpinBox.h"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SalomeApp_Application.h"
-#include "LightApp_SelectionMgr.h"
-#include "OCCViewer_ViewModel.h"
-
-#include <TColStd_MapOfInteger.hxx>
-
-#include <qlabel.h>
-#include "qpixmap.h"
-#include <list>
-
-#include "GEOMImpl_Types.hxx"
-
-//=================================================================================
-// class : OperationGUI_ChamferDlg()
-// purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent)
- : GEOMBase_Skeleton(theGeometryGUI, parent, "ChamferDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
-{
- myConstructorId = -1;
-
- QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL")));
- QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE")));
- QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE")));
- QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
-
- setCaption( tr( "GEOM_CHAMFER_TITLE" ) );
-
- GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );
-
- RadioButton1->setPixmap( image1 );
- RadioButton2->setPixmap( image2 );
- RadioButton3->setPixmap( image3 );
-
- // Create first group
-
- myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this );
-
- QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 );
- aSelGrp1->setFrameStyle( QFrame::NoFrame );
- aSelGrp1->setInsideMargin( 0 );
-
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 );
-
- QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 );
- aSpinGrp->setFrameStyle( QFrame::NoFrame );
- aSpinGrp->setInsideMargin( 0 );
-
- new QLabel( tr( "D" ), aSpinGrp );
- mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp );
-
- ( new QFrame( myGrp1 ) )->setSizePolicy(
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-
- // Create second group
-
- myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this );
-
- QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 );
- aSelGrp2->setFrameStyle( QFrame::NoFrame );
- aSelGrp2->setInsideMargin( 0 );
-
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 );
- createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 );
- createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 );
-
- aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp2 );
- aSpinGrp->setFrameStyle( QFrame::NoFrame );
- aSpinGrp->setInsideMargin( 0 );
-
- new QLabel( tr( "GEOM_D1" ), aSpinGrp );
- mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp );
-
- new QLabel( tr( "GEOM_D2" ), aSpinGrp );
- mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp );
-
- // Create third group
-
- myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this );
-
- QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 );
- aSelGrp3->setFrameStyle( QFrame::NoFrame );
- aSelGrp3->setInsideMargin( 0 );
-
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 );
- createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces );
-
- aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp3 );
- aSpinGrp->setFrameStyle( QFrame::NoFrame );
- aSpinGrp->setInsideMargin( 0 );
-
- new QLabel( tr( "GEOM_D1" ), aSpinGrp );
- mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp );
-
- new QLabel( tr( "GEOM_D2" ), aSpinGrp );
- mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp );
-
- ( new QLabel( myGrp3 ) )->setSizePolicy(
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-
- // Add groups to layout
-
- Layout1->addWidget( myGrp1, 2, 0 );
- Layout1->addWidget( myGrp2, 2, 0 );
- Layout1->addWidget( myGrp3, 2, 0 );
-
- // Set range of spinboxes
-
- double SpecificStep = 10.0;
- QMap< int, DlgRef_SpinBox* >::iterator anIter;
- for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
- anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
-
- setHelpFileName("chamfer.htm");
-
- /* Initialisations */
- Init();
-}
-
-
-//=================================================================================
-// function : ~OperationGUI_ChamferDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
-{
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::Init()
-{
- myConstructorId = -1;
- reset();
- RadioButton1->setChecked( true );
- myEditCurrentArgument = mySelName[ MainObj1 ];
-
- /* signals and slots connections */
-
- // main buttons
- connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-
- // group box
- connect( GroupConstructors, SIGNAL( clicked( int ) ),
- this, SLOT( ConstructorsClicked( int ) ) );
-
- // push buttons
- QMap< int, QPushButton* >::iterator anIterBtn;
- for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
- connect( anIterBtn.data(), SIGNAL( clicked() ),
- this, SLOT( SetEditCurrentArgument() ) );
-
- // line edits
- QMap< int, QLineEdit* >::iterator anIterLE2;
- for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )
- connect( anIterLE2.data(), SIGNAL( returnPressed() ),
- this, SLOT( LineEditReturnPressed() ) );
-
- // spin boxes
- QMap< int, DlgRef_SpinBox* >::iterator anIterSpin;
- for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
- connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ),
- this, SLOT( ValueChangedInSpinBox( double ) ) );
-
- // selection
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- initName( tr( "GEOM_CHAMFER" ) );
-
- myGrp2->hide();
- myGrp3->hide();
- myGrp1->show();
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
-{
- // Activate next widget
- if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
- != OCCViewer_Viewer::Type())
- {
- RadioButton1->setChecked( true );
- return;
- }
-
- if (myConstructorId == constructorId)
- return;
-
- // Get values from previous widget
- double D1 = 5, D2 = 5;
- if ( myConstructorId == 0 )
- D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue();
- else if ( myConstructorId == 1 )
- {
- D1 = mySpinBox[ SpinBox21 ]->GetValue();
- D2 = mySpinBox[ SpinBox22 ]->GetValue();
- }
- else if ( myConstructorId == 2 )
- {
- D1 = mySpinBox[ SpinBox31 ]->GetValue();
- D2 = mySpinBox[ SpinBox32 ]->GetValue();
- }
-
- myConstructorId = constructorId;
-
- switch ( constructorId )
- {
- case 0:
- myGrp1->show();
- myGrp2->hide();
- myGrp3->hide();
- mySpinBox[ SpinBox1 ]->SetValue( D1 );
- break;
- case 1:
- myGrp1->hide();
- myGrp2->show();
- myGrp3->hide();
- mySpinBox[ SpinBox21 ]->SetValue( D1 );
- mySpinBox[ SpinBox22 ]->SetValue( D2 );
- break;
- case 2:
- myGrp1->hide();
- myGrp2->hide();
- myGrp3->show();
- mySpinBox[ SpinBox31 ]->SetValue( D1 );
- mySpinBox[ SpinBox32 ]->SetValue( D2 );
- break;
- default:
- break;
- }
-
- if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
- else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
- else myEditCurrentArgument = mySelName[ MainObj3 ];
-
- activateSelection();
- enableWidgets();
-
- if ( !myShape->_is_nil() )
- {
- myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );
- GEOMBase_Skeleton::LineEditReturnPressed();
- }
- else
- myEditCurrentArgument->setText( "" );
-
- displayPreview();
-}
-
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::ClickOnOk()
-{
- if ( ClickOnApply() )
- ClickOnCancel();
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-bool OperationGUI_ChamferDlg::ClickOnApply()
-{
- if ( !onAccept() )
- return false;
-
- initName();
- return true;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
-//=================================================================================
-void OperationGUI_ChamferDlg::SelectionIntoArgument()
-{
- erasePreview();
- myEditCurrentArgument->setText( "" );
-
- // Get index of current selection focus
- int aCurrFocus = -1;
- QMap< int, QLineEdit* >::iterator anIter;
- for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter )
- if ( myEditCurrentArgument == anIter.data() )
- {
- aCurrFocus = anIter.key();
- break;
- }
-
- // If selection of main object is activated
- if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 )
- {
- if ( IObjectCount() == 1 )
- {
- Standard_Boolean aResult = Standard_False;
- GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
-
- if ( aResult && !anObj->_is_nil() )
- {
- myShape = anObj;
- mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );
- displayPreview();
- enableWidgets();
- return;
- }
- }
-
- myShape = GEOM::GEOM_Object::_nil();
- enableWidgets();
- }
- // If face selection of second tab is activated
- else if ( aCurrFocus == Face1 || aCurrFocus == Face2 )
- {
- if ( IObjectCount() == 1 )
- {
- Standard_Boolean aResult = Standard_False;
- GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
-
- if ( aResult && !anObj->_is_nil() )
- {
- TColStd_IndexedMapOfInteger anIndexes;
- ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
-
- if ( anIndexes.Extent() == 1 )
- {
- int anIndex = anIndexes( 1 );
- QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";
- myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );
- myFace[ aCurrFocus ] = anIndex;
- displayPreview();
- return;
- }
- }
- }
-
- myFace[ aCurrFocus ] = -1;
- }
- // If face selection of third tab is activated
- else if ( aCurrFocus == Faces )
- {
- if ( IObjectCount() == 1 )
- {
- Standard_Boolean aResult = Standard_False;
- GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
-
- if ( aResult && !anObj->_is_nil() )
- {
- TColStd_IndexedMapOfInteger anIndexes;
- ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
-
- if ( anIndexes.Extent() > 0 )
- {
- QString aFaceName;
- if ( anIndexes.Extent() == 1 )
- {
- int anIndex = anIndexes( 1 );
-
- aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
- }
- else
- aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
-
- myEditCurrentArgument->setText( aFaceName );
- myFaces = anIndexes;
- displayPreview();
- return;
- }
- }
- }
- myFaces.Clear();
- }
-}
-
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::LineEditReturnPressed()
-{
- QLineEdit* aSender = ( QLineEdit* )sender();
-
- QMap< int, QLineEdit* >::iterator anIterLE;
- for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
- if ( anIterLE.data() == aSender )
- myEditCurrentArgument = anIterLE.data();
-
- GEOMBase_Skeleton::LineEditReturnPressed();
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::SetEditCurrentArgument()
-{
- QPushButton* aSender = ( QPushButton* )sender();
-
- QMap< int, QPushButton* >::iterator anIter;
- for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
- if ( anIter.data() == aSender )
- {
- mySelName[ anIter.key() ]->setFocus();
- myEditCurrentArgument = mySelName[ anIter.key() ];
- }
-
- activateSelection();
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::ActivateThisDialog()
-{
- GEOMBase_Skeleton::ActivateThisDialog();
-
- connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );
-
- activateSelection();
- displayPreview();
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::enterEvent(QEvent* e)
-{
- if ( !GroupConstructors->isEnabled() )
- this->ActivateThisDialog();
-}
-
-
-//=================================================================================
-// function : ValueChangedInSpinBox()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )
-{
- displayPreview();
-}
-
-
-//=================================================================================
-// function : createSelWg()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,
- QPixmap& thePix,
- QWidget* theParent,
- const int theId )
-{
- new QLabel( theLbl, theParent );
- mySelBtn[ theId ] = new QPushButton( theParent );
- mySelBtn[ theId ]->setPixmap( thePix );
- mySelName[ theId ] = new QLineEdit( theParent );
- mySelName[ theId ]->setReadOnly( true );
-}
-
-//=================================================================================
-// function : reset()
-// purpose :
-//=================================================================================
-void OperationGUI_ChamferDlg::reset()
-{
- // Set Initial values of spinboxes
- QMap< int, DlgRef_SpinBox* >::iterator anIter;
- for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
- anIter.data()->SetValue( 5 );
-
- // clear line edits
- QMap< int, QLineEdit* >::iterator anIterLE;
- for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
- anIterLE.data()->setText( "" );
-
- // constructor id
- int aConstructorId = getConstructorId();
-
- if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
- else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
- else myEditCurrentArgument = mySelName[ MainObj3 ];
-
- myShape = GEOM::GEOM_Object::_nil();
-
- myFaces.Clear();
- myFace[ Face1 ] = -1;
- myFace[ Face2 ] = -1;
-
- erasePreview( true );
-
- activateSelection();
-
- enableWidgets();
-}
-
-//=================================================================================
-// function : getConstructorId()
-// purpose :
-//=================================================================================
-int OperationGUI_ChamferDlg::getConstructorId() const
-{
- return GroupConstructors->id( GroupConstructors->selected() );
-}
-
-//=================================================================================
-// function : activateSelection
-// purpose : Activate selection in accordance with myEditCurrentArgument
-//=================================================================================
-void OperationGUI_ChamferDlg::activateSelection()
-{
- if ( !myShape->_is_nil() &&
- ( myEditCurrentArgument == mySelName[ Face1 ] ||
- myEditCurrentArgument == mySelName[ Face2 ] ||
- myEditCurrentArgument == mySelName[ Faces ] ) )
- localSelection( myShape, TopAbs_FACE );
- else
- {
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_SHELL );
- aMap.Add( GEOM_SOLID );
- aMap.Add( GEOM_COMPOUND );
- globalSelection( aMap );
- }
-
- SelectionIntoArgument();
-}
-
-//=================================================================================
-// function : enableWidgets
-// purpose : Enable widgets of faces in accordance with value of main object
-//=================================================================================
-void OperationGUI_ChamferDlg::enableWidgets()
-{
- int anId = getConstructorId();
-
- bool toEnable = !myShape->_is_nil();
-
- if ( anId == 1 )
- {
- mySelName[ Face1 ]->setEnabled( toEnable );
- mySelName[ Face2 ]->setEnabled( toEnable );
- mySelBtn[ Face1 ]->setEnabled( toEnable );
- mySelBtn[ Face2 ]->setEnabled( toEnable );
-
- if ( !toEnable )
- {
- mySelName[ Face1 ]->setText( "" );
- mySelName[ Face2 ]->setText( "" );
- myFace[ Face1 ] = -1;
- myFace[ Face2 ] = -1;
- }
- }
- else if ( anId == 2 )
- {
- mySelName[ Faces ]->setEnabled( toEnable );
-
- if ( !toEnable )
- myFaces.Clear();
- }
-}
-
-//=================================================================================
-// function : createOperation
-// purpose :
-//=================================================================================
-GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()
-{
- return getGeomEngine()->GetILocalOperations( getStudyId() );
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose : Verify validity of input data
-//=================================================================================
-bool OperationGUI_ChamferDlg::isValid( QString& )
-{
- switch ( getConstructorId() )
- {
- case 0: return !myShape->_is_nil();
- case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;
- case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
- default: return false;
- }
-}
-
-//=================================================================================
-// function : execute
-// purpose :
-//=================================================================================
-bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
-{
- GEOM::GEOM_Object_var anObj;
-
- int anId = getConstructorId();
- if ( anId == 0 )
- anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeChamferAll( myShape,
- mySpinBox[ SpinBox1 ]->GetValue() );
- else if ( anId == 1 )
- anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeChamferEdge( myShape,
- mySpinBox[ SpinBox21 ]->GetValue(),
- mySpinBox[ SpinBox22 ]->GetValue(),
- myFace[ Face1 ],
- myFace[ Face2 ] );
- else if ( anId == 2 )
- {
-
- int i = 0;
- GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
- anArray->length( myFaces.Extent() );
-
-
- for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
- anArray[ i - 1 ] = myFaces( i );
-
- anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeChamferFaces( myShape,
- mySpinBox[ SpinBox31 ]->GetValue(),
- mySpinBox[ SpinBox32 ]->GetValue(),
- anArray );
- }
-
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
-
- return true;
-}
-
-
-
-
-
-
-
-
-
+// GEOM GEOMGUI : GUI for Geometry component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+//\r
+//\r
+// File : OperationGUI_ChamferDlg.cxx\r
+// Author : Damien COQUERET\r
+// Module : GEOM\r
+// $Header$\r
+\r
+#include "OperationGUI_ChamferDlg.h"\r
+#include "DlgRef_SpinBox.h"\r
+\r
+#include "SUIT_Desktop.h"\r
+#include "SUIT_Session.h"\r
+#include "SalomeApp_Application.h"\r
+#include "LightApp_SelectionMgr.h"\r
+#include "OCCViewer_ViewModel.h"\r
+\r
+#include <TColStd_MapOfInteger.hxx>\r
+\r
+#include <qlabel.h>\r
+#include "qpixmap.h"\r
+#include <list>\r
+\r
+#include "GEOMImpl_Types.hxx"\r
+\r
+//=================================================================================\r
+// class : OperationGUI_ChamferDlg()\r
+// purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the\r
+// name 'name' and widget flags set to 'f'.\r
+// The dialog will by default be modeless, unless you set 'modal' to\r
+// TRUE to construct a modal dialog.\r
+//=================================================================================\r
+OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent)\r
+ : GEOMBase_Skeleton(theGeometryGUI, parent, "ChamferDlg", false,\r
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)\r
+{\r
+ myConstructorId = -1;\r
+\r
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL")));\r
+ QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE_FROM_FACE")));\r
+ QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE")));\r
+ QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE")));\r
+ QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));\r
+\r
+ setCaption( tr( "GEOM_CHAMFER_TITLE" ) );\r
+\r
+ GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );\r
+\r
+ RadioButton1->setPixmap( image1 );\r
+ RadioButton2->setPixmap( image2 );\r
+ RadioButton3->setPixmap( image3 );\r
+ RadioButton4->show();\r
+ RadioButton4->setPixmap( image4 );\r
+\r
+ // Create first group\r
+\r
+ myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this );\r
+\r
+ QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 );\r
+ aSelGrp1->setFrameStyle( QFrame::NoFrame );\r
+ aSelGrp1->setInsideMargin( 0 );\r
+\r
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 );\r
+\r
+ QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 );\r
+ aSpinGrp->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp->setInsideMargin( 0 );\r
+\r
+ new QLabel( tr( "D" ), aSpinGrp );\r
+ mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp );\r
+\r
+ ( new QFrame( myGrp1 ) )->setSizePolicy(\r
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+\r
+ // Create second group\r
+\r
+ myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this );\r
+\r
+ QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 );\r
+ aSelGrp2->setFrameStyle( QFrame::NoFrame );\r
+ aSelGrp2->setInsideMargin( 0 );\r
+\r
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 );\r
+ createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 );\r
+ createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 );\r
+\r
+ QGroupBox* aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp2 );\r
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp1->setInsideMargin( 0 );\r
+ \r
+ myRadioButton[ RadioButton21] = new QRadioButton( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ QGroupBox* aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp2 );\r
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp2->setInsideMargin( 0 );\r
+\r
+ myRadioButton[ RadioButton22] = new QRadioButton( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox23 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox24 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ ( new QLabel( myGrp2 ) )->setSizePolicy(\r
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+\r
+ // Create third group\r
+\r
+ myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this );\r
+\r
+ QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 );\r
+ aSelGrp3->setFrameStyle( QFrame::NoFrame );\r
+ aSelGrp3->setInsideMargin( 0 );\r
+\r
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 );\r
+ createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces );\r
+\r
+ aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp3 );\r
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp1->setInsideMargin( 0 );\r
+\r
+ myRadioButton[ RadioButton31] = new QRadioButton( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp3 );\r
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp2->setInsideMargin( 0 );\r
+\r
+ myRadioButton[ RadioButton32] = new QRadioButton( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox33 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox34 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ ( new QLabel( myGrp3 ) )->setSizePolicy(\r
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+\r
+ // Create fourth group\r
+\r
+ myGrp4 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGE" ), this );\r
+\r
+ QGroupBox* aSelGrp4 = new QGroupBox( 3, Qt::Horizontal, myGrp4 );\r
+ aSelGrp4->setFrameStyle( QFrame::NoFrame );\r
+ aSelGrp4->setInsideMargin( 0 );\r
+\r
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp4, MainObj4 );\r
+ createSelWg( tr( "SELECTED_EDGE" ), iconSelect, aSelGrp4, Edges );\r
+\r
+ aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp4 );\r
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp1->setInsideMargin( 0 );\r
+\r
+ myRadioButton[ RadioButton41] = new QRadioButton( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox41 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
+ mySpinBox[ SpinBox42 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
+\r
+ aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp4 );\r
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
+ aSpinGrp2->setInsideMargin( 0 );\r
+\r
+ myRadioButton[ RadioButton42] = new QRadioButton( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox43 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
+ mySpinBox[ SpinBox44 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
+\r
+ ( new QLabel( myGrp4 ) )->setSizePolicy(\r
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+\r
+ // Add groups to layout\r
+\r
+ Layout1->addWidget( myGrp1, 2, 0 );\r
+ Layout1->addWidget( myGrp2, 2, 0 );\r
+ Layout1->addWidget( myGrp3, 2, 0 );\r
+ Layout1->addWidget( myGrp4, 2, 0 );\r
+\r
+ // Set range of spinboxes\r
+\r
+ double SpecificStep = 10.0;\r
+ QMap< int, DlgRef_SpinBox* >::iterator anIter;\r
+ for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )\r
+ {\r
+ anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 );\r
+ if ( anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24 )\r
+ anIter.data()->RangeStepAndValidator( 0, 90, 5, 0 );\r
+ }\r
+\r
+ setHelpFileName("chamfer.htm");\r
+\r
+ /* Initialisations */\r
+ RadioButtonPressed();\r
+ Init();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : ~OperationGUI_ChamferDlg()\r
+// purpose : Destroys the object and frees any allocated resources\r
+//=================================================================================\r
+OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()\r
+{\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : Init()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::Init()\r
+{\r
+ myConstructorId = -1;\r
+ reset();\r
+ RadioButton1->setChecked( true );\r
+ myEditCurrentArgument = mySelName[ MainObj1 ];\r
+\r
+ /* signals and slots connections */\r
+\r
+ // main buttons\r
+ connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );\r
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );\r
+\r
+ // group box\r
+ connect( GroupConstructors, SIGNAL( clicked( int ) ),\r
+ this, SLOT( ConstructorsClicked( int ) ) );\r
+\r
+ // push buttons\r
+ QMap< int, QPushButton* >::iterator anIterBtn;\r
+ for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )\r
+ connect( anIterBtn.data(), SIGNAL( clicked() ),\r
+ this, SLOT( SetEditCurrentArgument() ) );\r
+\r
+ // line edits\r
+ QMap< int, QLineEdit* >::iterator anIterLE2;\r
+ for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )\r
+ connect( anIterLE2.data(), SIGNAL( returnPressed() ),\r
+ this, SLOT( LineEditReturnPressed() ) );\r
+\r
+ // spin boxes\r
+ QMap< int, DlgRef_SpinBox* >::iterator anIterSpin;\r
+ for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )\r
+ connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ),\r
+ this, SLOT( ValueChangedInSpinBox( double ) ) );\r
+\r
+ // radio buttons\r
+ QMap< int, QRadioButton* >::iterator anIterRadio;\r
+ for ( anIterRadio = myRadioButton.begin(); anIterRadio != myRadioButton.end(); ++anIterRadio )\r
+ connect( anIterRadio.data(), SIGNAL( clicked() ),\r
+ this, SLOT( RadioButtonPressed() ) );\r
+\r
+ // selection\r
+ connect(myGeomGUI->getApp()->selectionMgr(), \r
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));\r
+\r
+ initName( tr( "GEOM_CHAMFER" ) );\r
+\r
+ myGrp4->hide();\r
+ myGrp3->hide();\r
+ myGrp2->hide();\r
+ myGrp1->show();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : ConstructorsClicked()\r
+// purpose : Radio button management\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )\r
+{\r
+ // Activate next widget\r
+ if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() \r
+ != OCCViewer_Viewer::Type())\r
+ {\r
+ RadioButton1->setChecked( true );\r
+ return;\r
+ }\r
+\r
+ if (myConstructorId == constructorId)\r
+ return;\r
+\r
+ // Get values from previous widget\r
+ double D1 = 5, D2 = 5, D = 5, Angle = 5;\r
+ if ( myConstructorId == 0 )\r
+ D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue();\r
+ else if ( myConstructorId == 1 )\r
+ {\r
+ D1 = mySpinBox[ SpinBox21 ]->GetValue();\r
+ D2 = mySpinBox[ SpinBox22 ]->GetValue();\r
+ D = mySpinBox[ SpinBox23 ]->GetValue();\r
+ Angle = mySpinBox[ SpinBox24 ]->GetValue();\r
+ }\r
+ else if ( myConstructorId == 2 )\r
+ {\r
+ D1 = mySpinBox[ SpinBox31 ]->GetValue();\r
+ D2 = mySpinBox[ SpinBox32 ]->GetValue();\r
+ D = mySpinBox[ SpinBox33 ]->GetValue();\r
+ Angle = mySpinBox[ SpinBox34 ]->GetValue();\r
+ }\r
+ else if ( myConstructorId == 3 )\r
+ {\r
+ D1 = mySpinBox[ SpinBox41 ]->GetValue();\r
+ D2 = mySpinBox[ SpinBox42 ]->GetValue();\r
+ D = mySpinBox[ SpinBox43 ]->GetValue();\r
+ Angle = mySpinBox[ SpinBox44 ]->GetValue();\r
+ }\r
+\r
+ myConstructorId = constructorId;\r
+\r
+ switch ( constructorId )\r
+ {\r
+ case 0:\r
+ myGrp1->show();\r
+ myGrp2->hide();\r
+ myGrp3->hide();\r
+ myGrp4->hide();\r
+ mySpinBox[ SpinBox1 ]->SetValue( D1 );\r
+ break;\r
+ case 1:\r
+ myGrp1->hide();\r
+ myGrp2->show();\r
+ myGrp3->hide();\r
+ myGrp4->hide();\r
+ mySpinBox[ SpinBox21 ]->SetValue( D1 );\r
+ mySpinBox[ SpinBox22 ]->SetValue( D2 );\r
+ mySpinBox[ SpinBox23 ]->SetValue( D );\r
+ mySpinBox[ SpinBox24 ]->SetValue( Angle );\r
+ break;\r
+ case 2:\r
+ myGrp1->hide();\r
+ myGrp2->hide();\r
+ myGrp3->show();\r
+ myGrp4->hide();\r
+ mySpinBox[ SpinBox31 ]->SetValue( D1 );\r
+ mySpinBox[ SpinBox32 ]->SetValue( D2 ); \r
+ mySpinBox[ SpinBox33 ]->SetValue( D );\r
+ mySpinBox[ SpinBox34 ]->SetValue( Angle );\r
+ break;\r
+ case 3:\r
+ myGrp1->hide();\r
+ myGrp2->hide();\r
+ myGrp3->hide();\r
+ myGrp4->show();\r
+ mySpinBox[ SpinBox41 ]->SetValue( D1 );\r
+ mySpinBox[ SpinBox42 ]->SetValue( D2 ); \r
+ mySpinBox[ SpinBox43 ]->SetValue( D );\r
+ mySpinBox[ SpinBox44 ]->SetValue( Angle );\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+\r
+ if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];\r
+ else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];\r
+ else if ( constructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];\r
+ else myEditCurrentArgument = mySelName[ MainObj4 ];\r
+\r
+ activateSelection(); \r
+ enableWidgets();\r
+ \r
+ if ( !myShape->_is_nil() )\r
+ {\r
+ myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );\r
+ GEOMBase_Skeleton::LineEditReturnPressed();\r
+ }\r
+ else\r
+ myEditCurrentArgument->setText( "" );\r
+\r
+ displayPreview();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : ClickOnOk()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::ClickOnOk()\r
+{\r
+ if ( ClickOnApply() )\r
+ ClickOnCancel();\r
+}\r
+\r
+//=================================================================================\r
+// function : ClickOnApply()\r
+// purpose :\r
+//=================================================================================\r
+bool OperationGUI_ChamferDlg::ClickOnApply()\r
+{\r
+ if ( !onAccept() )\r
+ return false;\r
+\r
+ initName();\r
+ return true;\r
+}\r
+\r
+//=================================================================================\r
+// function : SelectionIntoArgument()\r
+// purpose : Called when selection has changed\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::SelectionIntoArgument()\r
+{\r
+ erasePreview();\r
+ myEditCurrentArgument->setText( "" );\r
+\r
+ // Get index of current selection focus\r
+ int aCurrFocus = -1;\r
+ QMap< int, QLineEdit* >::iterator anIter;\r
+ for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter )\r
+ if ( myEditCurrentArgument == anIter.data() )\r
+ {\r
+ aCurrFocus = anIter.key();\r
+ break;\r
+ }\r
+\r
+ // If selection of main object is activated\r
+ if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4)\r
+ {\r
+ if ( IObjectCount() == 1 )\r
+ {\r
+ Standard_Boolean aResult = Standard_False;\r
+ GEOM::GEOM_Object_var anObj =\r
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
+\r
+ if ( aResult && !anObj->_is_nil() )\r
+ {\r
+ myShape = anObj;\r
+ mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );\r
+ displayPreview();\r
+ enableWidgets();\r
+ return;\r
+ }\r
+ }\r
+\r
+ myShape = GEOM::GEOM_Object::_nil();\r
+ enableWidgets();\r
+ }\r
+ // If face selection of second tab is activated\r
+ else if ( aCurrFocus == Face1 || aCurrFocus == Face2 )\r
+ {\r
+ if ( IObjectCount() == 1 )\r
+ {\r
+ Standard_Boolean aResult = Standard_False;\r
+ GEOM::GEOM_Object_var anObj =\r
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
+\r
+ if ( aResult && !anObj->_is_nil() )\r
+ {\r
+ TColStd_IndexedMapOfInteger anIndexes;\r
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );\r
+\r
+ if ( anIndexes.Extent() == 1 )\r
+ {\r
+ int anIndex = anIndexes( 1 );\r
+ QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";\r
+ myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );\r
+ myFace[ aCurrFocus ] = anIndex;\r
+ displayPreview();\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ myFace[ aCurrFocus ] = -1;\r
+ }\r
+ // If face selection of third or fourth tab is activated\r
+ else if ( aCurrFocus == Faces || aCurrFocus == Edges )\r
+ {\r
+ if ( IObjectCount() == 1 )\r
+ {\r
+ Standard_Boolean aResult = Standard_False;\r
+ GEOM::GEOM_Object_var anObj =\r
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
+\r
+ if ( aResult && !anObj->_is_nil() )\r
+ {\r
+ TColStd_IndexedMapOfInteger anIndexes;\r
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );\r
+\r
+ if ( anIndexes.Extent() > 0 )\r
+ {\r
+ QString aName;\r
+ if ( anIndexes.Extent() == 1 )\r
+ {\r
+ int anIndex = anIndexes( 1 );\r
+\r
+ aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );\r
+ }\r
+ else\r
+ aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );\r
+\r
+ myEditCurrentArgument->setText( aName );\r
+ int aConstructorId = getConstructorId();\r
+ if ( aConstructorId == 2)\r
+ myFaces = anIndexes;\r
+ else if (aConstructorId == 3)\r
+ myEdges = anIndexes;\r
+ \r
+ displayPreview();\r
+ return;\r
+ }\r
+ }\r
+ }\r
+ myFaces.Clear();\r
+ myEdges.Clear();\r
+ }\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : LineEditReturnPressed()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::LineEditReturnPressed()\r
+{\r
+ QLineEdit* aSender = ( QLineEdit* )sender();\r
+\r
+ QMap< int, QLineEdit* >::iterator anIterLE;\r
+ for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )\r
+ if ( anIterLE.data() == aSender )\r
+ myEditCurrentArgument = anIterLE.data();\r
+\r
+ GEOMBase_Skeleton::LineEditReturnPressed();\r
+}\r
+\r
+//=================================================================================\r
+// function : RadioButtonPressed()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::RadioButtonPressed()\r
+{\r
+ bool flag;\r
+ flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&\r
+ myRadioButton[ RadioButton31 ]->isChecked() &&\r
+ myRadioButton[ RadioButton41 ]->isChecked() );\r
+ \r
+ myRadioButton[ RadioButton21 ]->setChecked(!flag);\r
+ myRadioButton[ RadioButton31 ]->setChecked(!flag);\r
+ myRadioButton[ RadioButton41 ]->setChecked(!flag);\r
+ myRadioButton[ RadioButton22 ]->setChecked(flag);\r
+ myRadioButton[ RadioButton32 ]->setChecked(flag);\r
+ myRadioButton[ RadioButton42 ]->setChecked(flag);\r
+ mySpinBox[ SpinBox21 ]->setDisabled(flag);\r
+ mySpinBox[ SpinBox22 ]->setDisabled(flag); \r
+ mySpinBox[ SpinBox31 ]->setDisabled(flag); \r
+ mySpinBox[ SpinBox32 ]->setDisabled(flag); \r
+ mySpinBox[ SpinBox41 ]->setDisabled(flag); \r
+ mySpinBox[ SpinBox42 ]->setDisabled(flag);\r
+ mySpinBox[ SpinBox23 ]->setDisabled(!flag);\r
+ mySpinBox[ SpinBox24 ]->setDisabled(!flag); \r
+ mySpinBox[ SpinBox33 ]->setDisabled(!flag); \r
+ mySpinBox[ SpinBox34 ]->setDisabled(!flag); \r
+ mySpinBox[ SpinBox43 ]->setDisabled(!flag); \r
+ mySpinBox[ SpinBox44 ]->setDisabled(!flag);\r
+ displayPreview();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : SetEditCurrentArgument()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::SetEditCurrentArgument()\r
+{\r
+ QPushButton* aSender = ( QPushButton* )sender();\r
+\r
+ QMap< int, QPushButton* >::iterator anIter;\r
+ for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )\r
+ if ( anIter.data() == aSender )\r
+ {\r
+ mySelName[ anIter.key() ]->setFocus();\r
+ myEditCurrentArgument = mySelName[ anIter.key() ];\r
+ }\r
+\r
+ activateSelection();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : ActivateThisDialog()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::ActivateThisDialog()\r
+{\r
+ GEOMBase_Skeleton::ActivateThisDialog();\r
+\r
+ connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), \r
+ SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );\r
+\r
+ activateSelection();\r
+ displayPreview();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : enterEvent()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::enterEvent(QEvent* e)\r
+{\r
+ if ( !GroupConstructors->isEnabled() )\r
+ this->ActivateThisDialog();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : ValueChangedInSpinBox()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )\r
+{\r
+ displayPreview();\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : createSelWg()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,\r
+ QPixmap& thePix,\r
+ QWidget* theParent,\r
+ const int theId )\r
+{\r
+ new QLabel( theLbl, theParent );\r
+ mySelBtn[ theId ] = new QPushButton( theParent );\r
+ mySelBtn[ theId ]->setPixmap( thePix );\r
+ mySelName[ theId ] = new QLineEdit( theParent );\r
+ mySelName[ theId ]->setReadOnly( true );\r
+}\r
+\r
+//=================================================================================\r
+// function : reset()\r
+// purpose :\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::reset()\r
+{\r
+ // Set Initial values of spinboxes\r
+ QMap< int, DlgRef_SpinBox* >::iterator anIter;\r
+ for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )\r
+ anIter.data()->SetValue( 5 );\r
+\r
+ // clear line edits\r
+ QMap< int, QLineEdit* >::iterator anIterLE;\r
+ for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )\r
+ anIterLE.data()->setText( "" );\r
+\r
+ // constructor id\r
+ int aConstructorId = getConstructorId();\r
+\r
+ if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];\r
+ else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];\r
+ else if ( aConstructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];\r
+ else myEditCurrentArgument = mySelName[ MainObj4 ];\r
+\r
+ myShape = GEOM::GEOM_Object::_nil();\r
+\r
+ myFaces.Clear();\r
+ myEdges.Clear();\r
+ myFace[ Face1 ] = -1;\r
+ myFace[ Face2 ] = -1;\r
+\r
+ erasePreview( true );\r
+\r
+ activateSelection();\r
+\r
+ enableWidgets();\r
+}\r
+\r
+//=================================================================================\r
+// function : getConstructorId()\r
+// purpose :\r
+//=================================================================================\r
+int OperationGUI_ChamferDlg::getConstructorId() const\r
+{\r
+ return GroupConstructors->id( GroupConstructors->selected() );\r
+}\r
+\r
+//=================================================================================\r
+// function : activateSelection\r
+// purpose : Activate selection in accordance with myEditCurrentArgument\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::activateSelection()\r
+{\r
+ if ( !myShape->_is_nil() &&\r
+ ( myEditCurrentArgument == mySelName[ Face1 ] ||\r
+ myEditCurrentArgument == mySelName[ Face2 ] ||\r
+ myEditCurrentArgument == mySelName[ Faces ] ) )\r
+ localSelection( myShape, TopAbs_FACE );\r
+ else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )\r
+ localSelection( myShape, TopAbs_EDGE );\r
+ else\r
+ {\r
+ TColStd_MapOfInteger aMap;\r
+ aMap.Add( GEOM_SHELL );\r
+ aMap.Add( GEOM_SOLID );\r
+ aMap.Add( GEOM_COMPOUND );\r
+ globalSelection( aMap );\r
+ }\r
+\r
+ SelectionIntoArgument();\r
+}\r
+\r
+//=================================================================================\r
+// function : enableWidgets\r
+// purpose : Enable widgets of faces in accordance with value of main object\r
+//=================================================================================\r
+void OperationGUI_ChamferDlg::enableWidgets()\r
+{\r
+ int anId = getConstructorId();\r
+\r
+ bool toEnable = !myShape->_is_nil();\r
+ \r
+ if ( anId == 1 )\r
+ {\r
+ mySelName[ Face1 ]->setEnabled( toEnable );\r
+ mySelName[ Face2 ]->setEnabled( toEnable );\r
+ mySelBtn[ Face1 ]->setEnabled( toEnable );\r
+ mySelBtn[ Face2 ]->setEnabled( toEnable );\r
+\r
+ if ( !toEnable )\r
+ {\r
+ mySelName[ Face1 ]->setText( "" );\r
+ mySelName[ Face2 ]->setText( "" );\r
+ myFace[ Face1 ] = -1;\r
+ myFace[ Face2 ] = -1;\r
+ }\r
+ }\r
+ else if ( anId == 2 )\r
+ {\r
+ mySelName[ Faces ]->setEnabled( toEnable );\r
+\r
+ if ( !toEnable )\r
+ {\r
+ mySelName[ Faces ]->setText( "" );\r
+ myFaces = -1;\r
+ }\r
+ }\r
+ else if ( anId == 3 )\r
+ {\r
+ mySelName[ Edges ]->setEnabled( toEnable );\r
+\r
+ if ( !toEnable )\r
+ {\r
+ mySelName[ Edges ]->setText( "" );\r
+ myEdges = -1;\r
+ }\r
+ }\r
+}\r
+\r
+//=================================================================================\r
+// function : createOperation\r
+// purpose :\r
+//=================================================================================\r
+GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()\r
+{\r
+ return getGeomEngine()->GetILocalOperations( getStudyId() );\r
+}\r
+\r
+//=================================================================================\r
+// function : ClickOnApply()\r
+// purpose : Verify validity of input data\r
+//=================================================================================\r
+bool OperationGUI_ChamferDlg::isValid( QString& )\r
+{\r
+ switch ( getConstructorId() )\r
+ {\r
+ case 0: return !myShape->_is_nil();\r
+ case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;\r
+ case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;\r
+ case 3: return !myShape->_is_nil() && myEdges.Extent() > 0;\r
+ default: return false;\r
+ }\r
+}\r
+\r
+//=================================================================================\r
+// function : execute\r
+// purpose :\r
+//=================================================================================\r
+bool OperationGUI_ChamferDlg::execute( ObjectList& objects )\r
+{\r
+ GEOM::GEOM_Object_var anObj;\r
+ bool flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&\r
+ myRadioButton[ RadioButton31 ]->isChecked() &&\r
+ myRadioButton[ RadioButton41 ]->isChecked() );\r
+\r
+ int anId = getConstructorId();\r
+ if ( anId == 0 )\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferAll( myShape,\r
+ mySpinBox[ SpinBox1 ]->GetValue() );\r
+ else if ( anId == 1 )\r
+ {\r
+ if ( flag )\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferEdge( myShape,\r
+ mySpinBox[ SpinBox21 ]->GetValue(),\r
+ mySpinBox[ SpinBox22 ]->GetValue(),\r
+ myFace[ Face1 ],\r
+ myFace[ Face2 ] );\r
+ else\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferEdgeAD( myShape,\r
+ mySpinBox[ SpinBox23 ]->GetValue(),\r
+ mySpinBox[ SpinBox24 ]->GetValue() * PI180,\r
+ myFace[ Face1 ],\r
+ myFace[ Face2 ] );\r
+ }\r
+ else if ( anId == 2 )\r
+ {\r
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;\r
+ anArray->length( myFaces.Extent() );\r
+\r
+ for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )\r
+ anArray[ i - 1 ] = myFaces( i ); \r
+ if ( flag )\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferFaces( myShape,\r
+ mySpinBox[ SpinBox31 ]->GetValue(),\r
+ mySpinBox[ SpinBox32 ]->GetValue(),\r
+ anArray );\r
+ else\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferFacesAD( myShape,\r
+ mySpinBox[ SpinBox33 ]->GetValue(),\r
+ mySpinBox[ SpinBox34 ]->GetValue() * PI180,\r
+ anArray );\r
+ }\r
+ else if ( anId == 3 )\r
+ {\r
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;\r
+ anArray->length( myEdges.Extent() );\r
+ for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )\r
+ anArray[ i - 1 ] = myEdges( i ); \r
+ if ( flag )\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferEdges( myShape, mySpinBox[ SpinBox41 ]->GetValue(),\r
+ mySpinBox[ SpinBox42 ]->GetValue(), anArray );\r
+ else\r
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
+ getOperation() )->MakeChamferEdgesAD( myShape, mySpinBox[ SpinBox43 ]->GetValue(),\r
+ mySpinBox[ SpinBox44 ]->GetValue() * PI180, anArray );\r
+ }\r
+\r
+ if ( !anObj->_is_nil() )\r
+ objects.push_back( anObj._retn() );\r
+\r
+ return true;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
-// GEOM GEOMGUI : GUI for Geometry component
-//
-// Copyright (C) 2003 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-//
-// File : OperationGUI_ChamferDlg.h
-// Author : Damien COQUERET
-// Module : GEOM
-
-#ifndef DIALOGBOX_CHAMFER_H
-#define DIALOGBOX_CHAMFER_H
-
-#include "GEOMBase_Skeleton.h"
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-class DlgRef_SpinBox;
-
-//=================================================================================
-// class : OperationGUI_ChamferDlg
-// purpose :
-//=================================================================================
-class OperationGUI_ChamferDlg : public GEOMBase_Skeleton
-{
- Q_OBJECT
-
- enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces };
- enum { SpinBox1, SpinBox21, SpinBox22, SpinBox31, SpinBox32 };
-
-public:
- OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent);
- virtual ~OperationGUI_ChamferDlg();
-
-protected:
- // redefined from GEOMBase_Helper
- virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& msg );
- virtual bool execute( ObjectList& objects );
-
-private slots:
- void ClickOnOk();
- bool ClickOnApply();
- void ActivateThisDialog();
- void LineEditReturnPressed();
- void SelectionIntoArgument();
- void SetEditCurrentArgument();
- void ValueChangedInSpinBox( double newValue );
- void ConstructorsClicked( int constructorId );
-
-private:
- void Init();
- void enterEvent( QEvent* e );
- void reset();
- void createSelWg( const QString&, QPixmap&, QWidget*, const int );
- int getConstructorId() const;
- void activateSelection();
- void enableWidgets();
-
-private:
- int myConstructorId;
-
- GEOM::GEOM_Object_var myShape;
- QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )
- TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
-
- QFrame* myGrp1;
- QFrame* myGrp2;
- QFrame* myGrp3;
-
- QMap< int, QPushButton* > mySelBtn;
- QMap< int, QLineEdit* > mySelName;
- QMap< int, DlgRef_SpinBox* > mySpinBox;
-};
-
-#endif // DIALOGBOX_CHAMFER_H
+// GEOM GEOMGUI : GUI for Geometry component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+//\r
+//\r
+// File : OperationGUI_ChamferDlg.h\r
+// Author : Damien COQUERET\r
+// Module : GEOM\r
+\r
+#ifndef DIALOGBOX_CHAMFER_H\r
+#define DIALOGBOX_CHAMFER_H\r
+\r
+#include "GEOMBase_Skeleton.h"\r
+#include <TColStd_IndexedMapOfInteger.hxx>\r
+\r
+class DlgRef_SpinBox;\r
+\r
+//=================================================================================\r
+// class : OperationGUI_ChamferDlg\r
+// purpose :\r
+//=================================================================================\r
+class OperationGUI_ChamferDlg : public GEOMBase_Skeleton\r
+{ \r
+ Q_OBJECT\r
+\r
+ enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces, MainObj4, Edges};\r
+ enum { SpinBox1,\r
+ SpinBox21, SpinBox22, SpinBox23, SpinBox24, \r
+ SpinBox31, SpinBox32, SpinBox33, SpinBox34,\r
+ SpinBox41, SpinBox42, SpinBox43, SpinBox44 };\r
+ enum { RadioButton21, RadioButton22,\r
+ RadioButton31, RadioButton32,\r
+ RadioButton41, RadioButton42 };\r
+public:\r
+ OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent);\r
+ virtual ~OperationGUI_ChamferDlg();\r
+\r
+protected:\r
+ // redefined from GEOMBase_Helper\r
+ virtual GEOM::GEOM_IOperations_ptr createOperation();\r
+ virtual bool isValid( QString& msg );\r
+ virtual bool execute( ObjectList& objects ); \r
+\r
+private slots:\r
+ void ClickOnOk();\r
+ bool ClickOnApply();\r
+ void ActivateThisDialog();\r
+ void LineEditReturnPressed();\r
+ void RadioButtonPressed();\r
+ void SelectionIntoArgument();\r
+ void SetEditCurrentArgument();\r
+ void ValueChangedInSpinBox( double newValue );\r
+ void ConstructorsClicked( int constructorId );\r
+\r
+private:\r
+ void Init();\r
+ void enterEvent( QEvent* e );\r
+ void reset();\r
+ void createSelWg( const QString&, QPixmap&, QWidget*, const int );\r
+ int getConstructorId() const;\r
+ void activateSelection();\r
+ void enableWidgets();\r
+\r
+private:\r
+ int myConstructorId;\r
+\r
+ GEOM::GEOM_Object_var myShape; \r
+ QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )\r
+ TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )\r
+ TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)\r
+ \r
+ QFrame* myGrp1;\r
+ QFrame* myGrp2;\r
+ QFrame* myGrp3;\r
+ QFrame* myGrp4;\r
+\r
+ QMap< int, QPushButton* > mySelBtn;\r
+ QMap< int, QLineEdit* > mySelName;\r
+ QMap< int, DlgRef_SpinBox* > mySpinBox;\r
+ QMap< int, QRadioButton* > myRadioButton;\r
+};\r
+\r
+#endif // DIALOGBOX_CHAMFER_H\r
#include "OperationGUI_FilletDlg.h"
#include "DlgRef_1Sel1Spin.h"
-#include "DlgRef_2Sel1Spin.h"
+#include "DlgRef_2Sel3Spin2Rb.h"
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
Group1->PushButton1->setPixmap( iconSelect );
Group1->LineEdit1->setReadOnly( true );
- Group2 = new DlgRef_2Sel1Spin( this, "Group2" );
+ Group2 = new DlgRef_2Sel3Spin2Rb( this, "Group2" );
Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) );
Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) );
Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
+ Group2->TextLabel4->setText( tr( "GEOM_R1" ) );
+ Group2->TextLabel5->setText( tr( "GEOM_R2" ) );
Group2->PushButton1->setPixmap( iconSelect );
Group2->PushButton2->setPixmap( iconSelect );
Group2->LineEdit1->setReadOnly( true );
Group2->LineEdit2->setReadOnly( true );
- Group3 = new DlgRef_2Sel1Spin( this, "Group3" );
+ Group3 = new DlgRef_2Sel3Spin2Rb( this, "Group3" );
Group3->GroupBox1->setTitle(tr( "GEOM_FILLET_FACES" ) );
Group3->TextLabel1->setText(tr( "GEOM_MAIN_OBJECT" ) );
Group3->TextLabel2->setText(tr( "SELECTED_FACES" ) );
Group3->TextLabel3->setText(tr( "GEOM_RADIUS" ) );
+ Group3->TextLabel4->setText(tr( "GEOM_R1" ) );
+ Group3->TextLabel5->setText(tr( "GEOM_R2" ) );
Group3->PushButton1->setPixmap( iconSelect );
Group3->PushButton2->setPixmap( iconSelect );
Group3->LineEdit1->setReadOnly( true );
double SpecificStep = 10.0;
Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
+ Group2->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
+ Group2->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
+ Group3->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
+ Group3->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
setHelpFileName("fillet.htm");
// spin boxes
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(Group2->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(Group3->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+ //RadioButtons
+ connect( Group2->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) );
+ connect( Group2->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) );
+ connect( Group3->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) );
+ connect( Group3->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) );
// selection
connect(myGeomGUI->getApp()->selectionMgr(),
return;
// Get radius from previous widget
- double R = 5;
+ double R = 5, R1 = 5, R2 = 5;
if ( myConstructorId == 0 ) R = Group1->SpinBox_DX->GetValue();
- else if ( myConstructorId == 1 ) R = Group2->SpinBox_DX->GetValue();
- else R = Group3->SpinBox_DX->GetValue();
+ else if ( myConstructorId == 1 ) {
+ R = Group2->SpinBox_DX->GetValue();
+ R1 = Group2->SpinBox_DY->GetValue();
+ R2 = Group2->SpinBox_DZ->GetValue();
+ }
+ else {
+ R = Group3->SpinBox_DX->GetValue();
+ R1 = Group3->SpinBox_DY->GetValue();
+ R2 = Group3->SpinBox_DZ->GetValue();
+ }
myConstructorId = constructorId;
Group2->show();
Group3->hide();
Group2->SpinBox_DX->SetValue( R );
+ Group2->SpinBox_DY->SetValue( R1 );
+ Group2->SpinBox_DZ->SetValue( R2 );
break;
case 2:
Group1->hide();
Group2->hide();
Group3->show();
Group3->SpinBox_DX->SetValue( R );
+ Group3->SpinBox_DY->SetValue( R1 );
+ Group3->SpinBox_DZ->SetValue( R2 );
break;
default:
break;
// Set Initial values of spinboxes
Group1->SpinBox_DX->SetValue( 5 );
Group2->SpinBox_DX->SetValue( 5 );
+ Group2->SpinBox_DY->SetValue( 5 );
+ Group2->SpinBox_DZ->SetValue( 5 );
Group3->SpinBox_DX->SetValue( 5 );
+ Group3->SpinBox_DY->SetValue( 5 );
+ Group3->SpinBox_DZ->SetValue( 5 );
Group1->LineEdit1->setText( "" );
Group2->LineEdit1->setText( "" );
int anId = getConstructorId();
if ( anId == 0 )
anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeFilletAll( myShape,
- getRadius() );
+ getOperation() )->MakeFilletAll( myShape, getRadius() );
else if ( anId == 1 )
{
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
aList[ i - 1 ] = myEdges( i );
-
- anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeFilletEdges( myShape, getRadius(), aList );
+ if ( Group2->RadioButton1->isChecked() )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeFilletEdges( myShape, getRadius(), aList );
+ else
+ anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->MakeFilletEdgesR1R2( myShape,
+ (Group2->SpinBox_DY->GetValue()),
+ (Group2->SpinBox_DZ->GetValue()),
+ aList );
}
else if ( anId == 2 )
{
for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
aList[ i - 1 ] = myFaces( i );
-
- anObj = GEOM::GEOM_ILocalOperations::_narrow(
- getOperation() )->MakeFilletFaces( myShape, getRadius(), aList );
+ if ( Group3->RadioButton1->isChecked() )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeFilletFaces( myShape, getRadius(), aList );
+ else
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeFilletFacesR1R2( myShape, (Group3->SpinBox_DY->GetValue()),
+ (Group3->SpinBox_DZ->GetValue()), aList );
}
if ( !anObj->_is_nil() )
else if ( anId == 1 ) return Group2->SpinBox_DX->GetValue();
else return Group3->SpinBox_DX->GetValue();
}
+
+//=================================================================================
+// function : RadiobuttonClicked
+// purpose :
+//=================================================================================
+
+void OperationGUI_FilletDlg::RadioButton_Clicked()
+{
+ bool flag = ( (Group2->RadioButton1->isChecked()) && (Group3->RadioButton1->isChecked()) );
+ flag = !flag;
+
+ Group2->SpinBox_DX->setEnabled(flag);
+ Group2->SpinBox_DY->setEnabled(!flag);
+ Group2->SpinBox_DZ->setEnabled(!flag);
+ Group2->RadioButton1->setChecked(flag);
+ Group2->RadioButton2->setChecked(!flag);
+ Group3->SpinBox_DX->setEnabled(flag);
+ Group3->SpinBox_DY->setEnabled(!flag);
+ Group3->SpinBox_DZ->setEnabled(!flag);
+ Group3->RadioButton1->setChecked(flag);
+ Group3->RadioButton2->setChecked(!flag);
+ displayPreview();
+}
#include <TColStd_IndexedMapOfInteger.hxx>
class DlgRef_1Sel1Spin;
-class DlgRef_2Sel1Spin;
+class DlgRef_2Sel3Spin2Rb;
//=================================================================================
// class : OperationGUI_FilletDlg
void SetEditCurrentArgument();
void ValueChangedInSpinBox( double newValue );
void ConstructorsClicked( int constructorId );
+ void RadioButton_Clicked();
private:
void Init();
TColStd_IndexedMapOfInteger myFaces;
DlgRef_1Sel1Spin* Group1;
- DlgRef_2Sel1Spin* Group2;
- DlgRef_2Sel1Spin* Group3;
+ DlgRef_2Sel3Spin2Rb* Group2;
+ DlgRef_2Sel3Spin2Rb* Group3;
};
#endif // DIALOGBOX_FILLET_H