- Extruded cut, allows to add material an existing shape by extrusion of a profile
- Extruded boss, allows to remove material from an existing shape by extrusion od a profile
Modified the sketcher dialog in order to use MakeSketcherOnPLane API instead of MakeSketcher. It is now possible to make a skecth directly on the face of a shape without creating a local coordinate system.
Code refactoring in the sketcher dialog
in double theDX, in double theDY, in double theDZ,
in double theScaleFactor);
+
+ /*!
+ * \brief Add / Remove material to / from a solid by extrusion of the base shape on the given distance.
+ * \param theInitShape Initial shape on which to perform the feature.It has to be a solid or
+ * a compound made of a single solid
+ * \param theBase Edge or wire defining the base shape to be extruded.
+ * \param theHeight Prism dimension along the normal of the face.
+ * \param theAngle Draft angel in degrees
+ * \param theFuse If true material is added else material is removed
+ * \return New GEOM_Object, containing the modified shape
+ */
+ GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape,
+ in GEOM_Object theBase,
+ in double theHeight,
+ in double theAngle,
+ in boolean theFuse);
+
/*!
* \brief Create a shape by extrusion of the base shape along
* the path shape. The path shape can be a wire or an edge.
display.png \
displayonly.png \
displayall.png \
+draft.png \
erase.png \
eraseall.png \
+extruded_boss.png \
+extruded_cut.png \
face_hw.png \
face_vechw.png \
feature_detect.png \
{
}
+//////////////////////////////////////////
+// DlgRef_2Sel2Spin1Push
+//////////////////////////////////////////
+
+DlgRef_2Sel2Spin1Push::DlgRef_2Sel2Spin1Push( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+ setupUi( this );
+}
+
+DlgRef_2Sel2Spin1Push::~DlgRef_2Sel2Spin1Push()
+{
+}
+
//////////////////////////////////////////
// DlgRef_2Sel3Spin2Rb
//////////////////////////////////////////
~DlgRef_2Sel2Spin();
};
+//////////////////////////////////////////
+// DlgRef_2Sel2Spin1Push
+//////////////////////////////////////////
+
+#include "ui_DlgRef_2Sel2Spin1Push_QTD.h"
+
+class DLGREF_EXPORT DlgRef_2Sel2Spin1Push : public QWidget,
+ public Ui::DlgRef_2Sel2Spin1Push_QTD
+{
+ Q_OBJECT
+
+public:
+ DlgRef_2Sel2Spin1Push( QWidget* = 0, Qt::WindowFlags = 0 );
+ ~DlgRef_2Sel2Spin1Push();
+};
+
//////////////////////////////////////////
// DlgRef_2Sel3Spin2Rb
//////////////////////////////////////////
HEADERS += DlgRef_1Sel4Spin2Check.h
HEADERS += DlgRef_2Sel1Spin2Check.h
HEADERS += DlgRef_2Sel2Spin1Check.h
+HEADERS += DlgRef_2Sel2Spin1Push.h
HEADERS += DlgRef_2Sel2Spin3Check.h
HEADERS += DlgRef_2Sel4Spin1Check.h
HEADERS += DlgRef_3Sel4Spin2Check.h
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_2Sel2Spin1Push_QTD</class>
+ <widget class="QWidget" name="DlgRef_2Sel2Spin1Push_QTD">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>281</width>
+ <height>150</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="GroupBox1">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="TextLabel1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL1</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="PushButton1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="LineEdit1"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="TextLabel2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL2</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="PushButton2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="LineEdit2"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="TextLabel3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TL3</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
+ </item>
+ <item row="3" column="2">
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY"/>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="PushButton3">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>SalomeApp_DoubleSpinBox</class>
+ <extends>QDoubleSpinBox</extends>
+ <header location="global">SalomeApp_DoubleSpinBox.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>PushButton1</tabstop>
+ <tabstop>LineEdit1</tabstop>
+ <tabstop>PushButton2</tabstop>
+ <tabstop>LineEdit2</tabstop>
+ <tabstop>SpinBox_DX</tabstop>
+ <tabstop>SpinBox_DY</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
ui_DlgRef_2Sel2Spin1Check_QTD.h \
ui_DlgRef_2Sel2Spin3Check_QTD.h \
ui_DlgRef_2Sel2Spin_QTD.h \
+ ui_DlgRef_2Sel2Spin1Push_QTD.h \
ui_DlgRef_2Sel3Spin2Rb_QTD.h \
ui_DlgRef_2Sel3Spin_QTD.h \
ui_DlgRef_2Sel4Spin1Check_QTD.h \
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) );
QPixmap image4( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
+ QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle( tr( "GEOM_SKETCHER_TITLE" ) );
/***************************************************************/
GroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
- QHBoxLayout* planeLayout = new QHBoxLayout(GroupBox1);
+ QGridLayout* planeLayout = new QGridLayout(GroupBox1);
planeLayout->setSpacing(6);
planeLayout->setMargin(11);
ComboBox1 = new QComboBox(GroupBox1);
- ComboBox1->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
- planeLayout->addWidget(ComboBox1);
+ //ComboBox1->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
+ planeLayout->addWidget(ComboBox1,0,0,1,2);
planeButton = new QPushButton (GroupBox1);
- planeButton->setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
+ //planeButton->setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) );
- planeLayout->addWidget(planeButton);
-
+ planeLayout->addWidget(planeButton,0,2);
+
+ selButton = new QPushButton (GroupBox1);
+ selButton->setIcon(image5);
+ planeLayout->addWidget(selButton,1,0);
+
+ WPlaneLineEdit = new QLineEdit (GroupBox1);
+ WPlaneLineEdit->setReadOnly(true);
+ planeLayout->addWidget(WPlaneLineEdit,1,1,1,2);
+
+ planeLayout->setColumnStretch(1,1);
+
topLayout->addWidget(GroupBox1);
topLayout->addWidget( MainWidget );
topLayout->setStretch( 1, 1);
connect( Group2Sel->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
connect( Group1Sel1Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
- connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) );
+ connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ActivateLocalCS() ) );
connect( planeButton, SIGNAL( clicked() ), this, SLOT( ActivateLocalCS() ) );
+ connect( selButton, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
{
/* init variables */
autoApply = false;
- myEditCurrentArgument = Group1Sel->LineEdit1;
+
+ myEditCurrentArgument = WPlaneLineEdit; // Initiate the parameters selection with the first WPlaneLineEdit
+
myCommand.append( "Sketcher" );
myUndoCommand.append( "Sketcher" );
mySketchState = FIRST_POINT;
- globalSelection( GEOM_POINT );
+ globalSelection( GEOM_FACE );
myCheckFlag = 0;
myLastY2 = 0.0;
myHelpFileName = "create_sketcher_page.html";
+
+ GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
+ myGlobalCS = aBasicOp->MakeMarker( 0,0,0,
+ 0,0,1,
+ 1,0,0 );
+ myWPlane = myGlobalCS;
+ myLCSList.push_back( WPlaneToLCS(myGlobalCS) );
/* Get setting of step value from file configuration */
double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
MainWidget->RadioButton1->setChecked( true );
- TypeClicked( 0 );
-
FindLocalCS();
+ TypeClicked( 0 );
+ // If a face has already been selected use it. Placed after FindLocalCS to avoid clearing the combobox
+ // that should be filled with the possibly selected face
+ SelectionIntoArgument();
+
resize(100,100);
+
+ setPrefix(tr("GEOM_SKETCH"));
ActivateLocalCS();
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
//=================================================================================
void EntityGUI_SketcherDlg::InitClick()
{
+ MESSAGE("EntityGUI_SketcherDlg::InitClick()")
disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
myCheckFlag = 0;
if ( sender() && sender()->inherits( "QPushButton" ) )
( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
+// addSubshapesToStudy();
+
QString aParameters;
myCommand.append( GetNewCommand( aParameters ) );
mySketchState = NEXT_POINT;
{
MESSAGE("EntityGUI_SketcherDlg::SelectionIntoArgument")
myEditCurrentArgument->setText( "" );
- double tmpX = myX;
- double tmpY = myY;
- myX = myLastX1;
- myY = myLastY1;
- // printf ("\nmyX = %f myY = %f", myX, myY);
- // printf ("\nmyLastX1 = %f myLastY1 = %f", myLastX1, myLastY1);
- // printf ("\nmyLastX2 = %f myLastY2 = %f", myLastX2, myLastY2);
-
- if ( sender() == ComboBox1 )
- ActivateLocalCS();
LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
-
- int nbSel = aSelList.Extent();
- MESSAGE("NbSel = "<<nbSel)
- if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- if ( !CORBA::is_nil(aSelectedObject) ) {
- TopoDS_Shape aShape;
- if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
- gp_Trsf aTrans;
- gp_Ax3 aWPlane = GetActiveLocalCS();
-
- aTrans.SetTransformation(aWPlane);
- BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
- aShape = aTransformation.Shape();
-
- gp_Pnt aPnt;
- if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
- myX = aPnt.X();
- myY = aPnt.Y();
- Group1Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
- if( Group2Spin->isVisible() && mySketchType == PT_ABS ) {
- disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- Group2Spin->SpinBox_DX->setValue(myX);
- Group2Spin->SpinBox_DY->setValue(myY);
- connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- } else if ( Group2Spin->isVisible() && mySketchType == PT_RELATIVE ) {
- if ( myLastX1 && myLastY1 ) {
- Group2Spin->SpinBox_DX->setValue(myX - myLastX1);
- Group2Spin->SpinBox_DY->setValue(myY - myLastY1);
- } else {
- if ( mySketchState != FIRST_POINT ) {
- Group2Spin->SpinBox_DX->setValue(myX - tmpX);
- Group2Spin->SpinBox_DY->setValue(myY - tmpY);
- } else {
- Group2Spin->SpinBox_DX->setValue(myX);
- Group2Spin->SpinBox_DY->setValue(myY);
- }
- }
- }
- }
- }
- }
+
+ this->activateWindow();
+
+ if (aSelList.Extent() == 0)
+ {
+ selButton->setDown(false);
+ WPlaneLineEdit->setEnabled(false);
+ WPlaneLineEdit->setText(tr("GEOM_SKETCHER_WPLANE"));
+ return;
}
-
- if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- if ( !CORBA::is_nil(aSelectedObject) ) {
- TopoDS_Shape aShape;
- if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
- gp_Trsf aTrans;
- gp_Ax3 aWPlane = GetActiveLocalCS();
-
- aTrans.SetTransformation(aWPlane);
- BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
- aShape = aTransformation.Shape();
-
- gp_Pnt aPnt;
- if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
- myX = aPnt.X();
- myY = aPnt.Y();
- Group1Sel1Spin->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
- if( Group3Spin->isVisible() && mySketchType == PT_ABS ) {
+ else if (aSelList.Extent() != 1)
+ return;
+
+ double tmpX = myX;
+ double tmpY = myY;
+ myX = myLastX1;
+ myY = myLastY1;
+
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == WPlaneLineEdit)
+ aNeedType = TopAbs_FACE;
+
+
+ GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+ TopoDS_Shape aShape;
+
+ if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape)
+ && !aShape.IsNull())
+ {
+ QString aName = GEOMBase::GetName( aSelectedObject.get() );
+ myEditCurrentArgument->setText(aName);
+ if (myEditCurrentArgument==WPlaneLineEdit)
+ {
+ AddLocalCS(aSelectedObject.get());
+ selButton->setDown(false);
+ WPlaneLineEdit->setEnabled(false);
+ TypeClicked( 0 );
+ }
+ else
+ {
+ gp_Trsf aTrans;
+ gp_Ax3 aWPlane = GetActiveLocalCS();
+
+ aTrans.SetTransformation(aWPlane);
+ BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
+ aShape = aTransformation.Shape();
+
+ gp_Pnt aPnt;
+ if ( GEOMBase::VertexToPoint( aShape, aPnt ) )
+ {
+ myX = aPnt.X();
+ myY = aPnt.Y();
+ double Xcoord = myX;
+ double Ycoord = myY;
+
+ switch (mySketchType)
+ {
+ case PT_ABS:
+ disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+
+ Group2Spin->SpinBox_DX->setValue(Xcoord);
+ Group2Spin->SpinBox_DY->setValue(Ycoord);
+
+ connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ break;
+
+ case PT_RELATIVE:
+ if (myLastX1 && myLastY1)
+ {
+ Xcoord = myX - myLastX1;
+ Ycoord = myY - myLastY1;
+ }
+ else if (mySketchState != FIRST_POINT)
+ {
+ Xcoord = myX - tmpX;
+ Ycoord = myY - tmpY;
+ }
+ Group2Spin->SpinBox_DX->setValue(Xcoord);
+ Group2Spin->SpinBox_DY->setValue(Ycoord);
+ break;
+
+ case PT_ABS_RADIUS:
disconnect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
disconnect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- Group3Spin->SpinBox_DX->setValue(myX);
- Group3Spin->SpinBox_DY->setValue(myY);
+
+ Group3Spin->SpinBox_DX->setValue(Xcoord);
+ Group3Spin->SpinBox_DY->setValue(Ycoord);
+
connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- } else if ( Group3Spin->isVisible() && mySketchType == PT_RELATIVE ) {
- if ( myLastX1 && myLastY1 ) {
- Group3Spin->SpinBox_DX->setValue(myX - myLastX1);
- Group3Spin->SpinBox_DY->setValue(myY - myLastY1);
- } else {
- if ( mySketchState != FIRST_POINT ) {
- Group3Spin->SpinBox_DX->setValue(myX - tmpX);
- Group3Spin->SpinBox_DY->setValue(myY - tmpY);
- } else {
- Group3Spin->SpinBox_DX->setValue(myX);
- Group3Spin->SpinBox_DY->setValue(myY);
- }
+ break;
+
+ case PT_REL_RADIUS:
+ if (myLastX1 && myLastY1)
+ {
+ Xcoord = myX - myLastX1;
+ Ycoord = myY - myLastY1;
}
- }
- }
- }
- }
- }
-
- if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- if ( !CORBA::is_nil(aSelectedObject) ) {
- TopoDS_Shape aShape;
- if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
- gp_Trsf aTrans;
- gp_Ax3 aWPlane = GetActiveLocalCS();
-
- aTrans.SetTransformation(aWPlane);
- BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
- aShape = aTransformation.Shape();
-
- gp_Pnt aPnt;
- if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
- myXc = aPnt.X();
- myYc = aPnt.Y();
- Group2Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
- if( Group4Spin->isVisible() && mySketchType == PT_ABS ) {
+ else if (mySketchState != FIRST_POINT)
+ {
+ Xcoord = myX - tmpX;
+ Ycoord = myY - tmpY;
+ }
+ Group3Spin->SpinBox_DX->setValue(Xcoord);
+ Group3Spin->SpinBox_DY->setValue(Ycoord);
+ break;
+
+ case PT_ABS_CENTER:
disconnect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
disconnect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- Group4Spin->SpinBox_DX->setValue(myXc);
- Group4Spin->SpinBox_DY->setValue(myYc);
+
+ Group4Spin->SpinBox_DX->setValue(Xcoord);
+ Group4Spin->SpinBox_DY->setValue(Ycoord);
+
connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- } else if ( Group4Spin->isVisible() && mySketchType == PT_RELATIVE ) {
- if ( myLastX1 && myLastY1 ) {
- Group4Spin->SpinBox_DX->setValue(myXc - myLastX1);
- Group4Spin->SpinBox_DY->setValue(myYc - myLastY1);
- } else {
- if ( mySketchState != FIRST_POINT ) {
- Group4Spin->SpinBox_DX->setValue(myXc - tmpX);
- Group4Spin->SpinBox_DY->setValue(myYc - tmpY);
- } else {
- Group4Spin->SpinBox_DX->setValue(myXc);
- Group4Spin->SpinBox_DY->setValue(myYc);
- }
+ connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ break;
+
+ case PT_REL_CENTER:
+ if (myLastX1 && myLastY1)
+ {
+ Xcoord = myXc - myLastX1;
+ Ycoord = myYc - myLastY1;
}
- }
- }
- }
- }
- }
-
- if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit2) {
- if (!Group2Sel->LineEdit1->text().isEmpty()){ //Check wether or not Linedit2 has been modified
- myX=tmpX; // If yes keep the old values of X and Y
- myY=tmpY;
- }
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- if ( !CORBA::is_nil(aSelectedObject) ) {
- TopoDS_Shape aShape;
- if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
- gp_Trsf aTrans;
- gp_Ax3 aWPlane = GetActiveLocalCS();
-
- aTrans.SetTransformation(aWPlane);
- BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
- aShape = aTransformation.Shape();
-
- gp_Pnt aPnt;
- if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
- myX = aPnt.X();
- myY = aPnt.Y();
- Group2Sel->LineEdit2->setText( GEOMBase::GetName( aSelectedObject ) );
- if( Group4Spin->isVisible() && mySketchType == PT_ABS ) {
- disconnect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- disconnect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- Group4Spin->SpinBox_DZ->setValue(myX);
- Group4Spin->SpinBox_DS->setValue(myY);
- connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- } else if ( Group4Spin->isVisible() && mySketchType == PT_RELATIVE ) {
- if ( myLastX1 && myLastY1 ) {
- Group4Spin->SpinBox_DZ->setValue(myX - myLastX1);
- Group4Spin->SpinBox_DS->setValue(myY - myLastY1);
- } else {
- if ( mySketchState != FIRST_POINT ) {
- Group4Spin->SpinBox_DZ->setValue(myX - tmpX);
- Group4Spin->SpinBox_DS->setValue(myY - tmpY);
- } else {
- Group4Spin->SpinBox_DZ->setValue(myX);
- Group4Spin->SpinBox_DS->setValue(myY);
- }
+ else if (mySketchState != FIRST_POINT)
+ {
+ Xcoord = myXc - tmpX;
+ Ycoord = myYc - tmpY;
+ }
+ else
+ {
+ Xcoord = myXc;
+ Ycoord = myYc;
}
- }
+
+ Group4Spin->SpinBox_DX->setValue(Xcoord);
+ Group4Spin->SpinBox_DY->setValue(Ycoord);
+ break;
+
}
}
}
}
- if (nbSel == 0){ // If no object selected
- myX=tmpX; // Don't change the point coordinates
- myY=tmpY; // and don't redisplay the preview
- }
- else if(!autoApply){
+
+ if(!autoApply){
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
- if ( autoApply ){
+ else {
ClickOnApply();
autoApply = false;
}
- this->activateWindow();
}
//=================================================================================
void EntityGUI_SketcherDlg::SetEditCurrentArgument()
{
+ TopAbs_ShapeEnum myNeedType = TopAbs_VERTEX;
if ( sender() == Group1Sel->PushButton1 ) {
myEditCurrentArgument = Group1Sel->LineEdit1;
myEditCurrentArgument->setFocus();
Group2Sel->LineEdit2->setEnabled(true);
// myEditCurrentArgument->setFocus();
}
- SelectionIntoArgument();
+ else if ( sender() == selButton ) {
+ myNeedType = TopAbs_FACE;
+ myEditCurrentArgument = WPlaneLineEdit;
+ WPlaneLineEdit->setEnabled(true);
+ selButton->setDown(true);
+ }
+ globalSelection(); // close local selection to clear it
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
//myGeometryGUI->SetState( 0 );
- globalSelection( GEOM_POINT );
+// globalSelection( GEOM_POINT );
- myEditCurrentArgument = Group1Sel->LineEdit1;
+ myEditCurrentArgument = WPlaneLineEdit;
myEditCurrentArgument->setFocus();
if ( sender() == Group1Sel->LineEdit1 ) {
}
}
- gp_Ax3 myWPlane = GetActiveLocalCS();
- GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble;
- WPlane->length( 9 );
- WPlane[0] = myWPlane.Location().X();
- WPlane[1] = myWPlane.Location().Y();
- WPlane[2] = myWPlane.Location().Z();
-
- WPlane[3] = myWPlane.Direction().X();
- WPlane[4] = myWPlane.Direction().Y();
- WPlane[5] = myWPlane.Direction().Z();
-
- WPlane[6] = myWPlane.XDirection().X();
- WPlane[7] = myWPlane.XDirection().Y();
- WPlane[8] = myWPlane.XDirection().Z();
-
GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
- GEOM::GEOM_Object_var anObj = anOper->MakeSketcher( cmd.toLatin1().constData(), WPlane );
-
+ GEOM::GEOM_Object_var anObj = NULL;
+
+ int index = ComboBox1->currentIndex();
+ if(index != -1 && !myWPlane->_is_nil()) // The combobox is not empty
+ {
+ anObj = anOper->MakeSketcherOnPlane( cmd.toLatin1().constData(), myWPlane );
+ }
if ( !anObj->_is_nil() )
{
if( !IsPreview() ) {
)
{
// Get globalCS and working plane
- gp_Ax3 globalCS = myLCSList.first(); //gp_Ax3(aOrigin, aDirZ, aDirX);
+ gp_Ax3 globalCS = WPlaneToLCS( myGlobalCS );
gp_Ax3 aWPlane = GetActiveLocalCS();
// Build point in localCS
return true;
}
+//=================================================================================
+// function : acceptMouseEvent()
+// purpose :
+//=================================================================================
+bool EntityGUI_SketcherDlg::acceptMouseEvent() const
+{
+ return ( (getPnt1ConstructorId() == 1 || getPnt1ConstructorId() == 0) //accept mouse event only on absolute and relative selection mode
+ && !WPlaneLineEdit->isEnabled()); // called by EntityGUI::OnMousePress()
+}
+
//=================================================================================
// function : keyPressEvent()
// purpose :
//Group4Spin->SpinBox_DS->setSingleStep(step);
}
+//=================================================================================
+// function : AddLocalCS()
+// purpose : Add All Coordinates systems in study
+//=================================================================================
+void EntityGUI_SketcherDlg::AddLocalCS(GEOM::GEOM_Object_var aSelectedObject)
+{
+ MESSAGE("EntityGUI_SketcherDlg::AddLocalCS")
+ QString aName = GEOMBase::GetName( aSelectedObject );
+
+ int index = ComboBox1->findText(aName, Qt::MatchExactly);
+
+ if (index==-1) // If the working plane hasn't been added yet
+ {
+ myWPlaneList.push_back(aSelectedObject);
+ myWPlane = aSelectedObject;
+ addSubshapesToStudy();
+ myLCSList.push_back(WPlaneToLCS(aSelectedObject));
+ ComboBox1->addItem(aName);
+ index = ComboBox1->count();
+ ComboBox1->setCurrentIndex(index-1);
+ }
+ else
+ {
+ ComboBox1->setCurrentIndex(index);
+ }
+ ActivateLocalCS();
+}
+
//=================================================================================
// function : FindLocalCS()
// purpose : Find All Coordinates systems in study
//=================================================================================
void EntityGUI_SketcherDlg::FindLocalCS()
{
+ MESSAGE("EntityGUI_SketcherDlg::FindLocalCS")
ComboBox1->clear();
- myLCSList.clear();
+ myWPlaneList.clear();
SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app )
//add Global CS
ComboBox1->addItem(tr("GEOM_GCS"));
- gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
- gp_Dir aDirZ = gp_Dir(0, 0, 1);
- gp_Dir aDirX = gp_Dir(1, 0, 0);
- gp_Ax3 globalCS = gp_Ax3(aOrigin, aDirZ, aDirX);
- myLCSList.push_back(globalCS);
+ myWPlaneList.push_back(myGlobalCS);
// get GEOM component
CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
// browse through all GEOM data tree
_PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
- for ( it->InitEx( true ); it->More(); it->Next() ) {
+ for ( it->InitEx( true ); it->More(); it->Next() )
+ {
_PTR(SObject) child( it->Value() );
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if( CORBA::is_nil( geomObj ) )
continue;
- if (geomObj->GetType() == GEOM_MARKER) {
+ if (geomObj->GetType() == GEOM_MARKER)
+ {
+ myWPlaneList.push_back(geomObj);
+ myLCSList.push_back(WPlaneToLCS(geomObj));
ComboBox1->addItem(geomObj->GetName());
- TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
-
- gp_Ax3 aLCS;
- aLCS.Transform(aShape.Location().Transformation());
- if (aShape.ShapeType() == TopAbs_FACE) {
- Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aShape));
- if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
- Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
- gp_Pln aPln = aGPlane->Pln();
- aLCS = aPln.Position();
- }
- }
- myLCSList.push_back(aLCS);
+ MESSAGE("ComboBox1->addItem() in EntityGUI_SketcherDlg::FindLocalCS()")
+ }
+ }
+}
+
+//=================================================================================
+// function : WPlaneToLCS ( aWPlane )
+// purpose :
+//=================================================================================
+gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj )
+{
+ TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
+
+ gp_Ax3 aLCS;
+ if (CORBA::is_nil( geomObj ) || aShape.IsNull())
+ {
+ MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()")
+ }
+ aLCS.Transform(aShape.Location().Transformation());
+ if (aShape.ShapeType() == TopAbs_FACE)
+ {
+ GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
+ myGeometryGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() );
+ double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz;
+ aMeasureOp->GetPosition( geomObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz);
+ if ( aMeasureOp->IsDone() )
+ {
+ gp_Pnt aPnt ( Ox, Oy, Oz );
+ gp_Dir aDirN ( Zx, Zy, Zz );
+ gp_Dir aDirX ( Xx, Xy, Xz );
+ aLCS = gp_Ax3( aPnt, aDirN, aDirX );
}
}
+ return aLCS;
}
+
//=================================================================================
// function : getPnt1ConstructorId()
// purpose :
//=================================================================================
gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
{
+ MESSAGE("EntityGUI_SketcherDlg::GetActiveLocalCS()")
int ind = ComboBox1->currentIndex();
if (ind == -1)
return myGeometryGUI->GetWorkingPlane();
-
+
gp_Ax3 aLCS = myLCSList.at(ind);
+ myWPlane = myWPlaneList.at(ind);
return aLCS;
}
//=================================================================================
void EntityGUI_SketcherDlg::ActivateLocalCS()
{
- myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() );
- myGeometryGUI->ActiveWorkingPlane();
+ MESSAGE("EntityGUI_SketcherDlg::ActivateLocalCS")
+ myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() );
+ myGeometryGUI->ActiveWorkingPlane();
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void EntityGUI_SketcherDlg::addSubshapesToStudy()
+{
+ MESSAGE("EntityGUI_SketcherDlg::addSubshapesToStudy()")
+ GEOMBase::PublishSubObject(myWPlane);
+}
\ No newline at end of file
bool eventFilter (QObject* object, QEvent* event);
- bool acceptMouseEvent() const { return ( getPnt1ConstructorId() == 1
- || getPnt1ConstructorId() == 0 ); } //accept mouse event only on absolute and relative selection mode
- void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt& ); // called by EntityGUI::OnMousePress()
+ bool acceptMouseEvent() const; // called by EntityGUI::OnMousePress()
+ void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt& );
protected:
void initSpinBox( SalomeApp_DoubleSpinBox*,
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
+ virtual void addSubshapesToStudy();
+
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
QGroupBox* GroupBox1;
QComboBox* ComboBox1;
QPushButton* planeButton;
+ QPushButton* selButton;
+
+ QLineEdit* WPlaneLineEdit;
GeometryGUI* myGeometryGUI;
double myLineWidth;
QList<gp_Ax3> myLCSList;
+ GEOM::GEOM_Object_var myGlobalCS;
+ GEOM::GEOM_Object_var myWPlane;
+ QList< GEOM::GEOM_Object_var > myWPlaneList;
int myCheckFlag;
void CheckBoxClicked( int );
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
+ void AddLocalCS( GEOM::GEOM_Object_var );
void FindLocalCS();
gp_Ax3 GetActiveLocalCS();
+ gp_Ax3 WPlaneToLCS( GEOM::GEOM_Object_var );
void ActivateLocalCS();
};
<source>ICO_DELETE</source>
<translation>delete.png</translation>
</message>
- <message>
+ <message>
<source>ICO_DISK</source>
<translation>disk.png</translation>
</message>
<source>ICO_DISPLAY_ONLY</source>
<translation>displayonly.png</translation>
</message>
+ <message>
+ <source>ICO_DRAFT</source>
+ <translation>draft.png</translation>
+ </message>
+ <message>
+ <source>ICO_DISPLAY_ONLY</source>
+ <translation>displayonly.png</translation>
+ </message>
<message>
<source>ICO_EDGE</source>
<translation>build_edge.png</translation>
<message>
<source>ICO_EXPLODE_BLOCKS</source>
<translation>subshape.png</translation>
+ </message>
+ <message>
+ <source>ICO_EXTRUDED_BOSS</source>
+ <translation>extruded_boss.png</translation>
+ </message>
+ <message>
+ <source>ICO_EXTRUDED_CUT</source>
+ <translation>extruded_cut.png</translation>
</message>
<message>
<source>ICO_EXTRUSION</source>
<source>GEOM_EXTRUSION</source>
<translation>Extrusion</translation>
</message>
+ <message>
+ <source>GEOM_EXTRUDED_CUT</source>
+ <translation>Extruded cut</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTRUDED_BOSS</source>
+ <translation>Extruded boss</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTRUSION</source>
+ <translation>Extrusion</translation>
+ </message>
+
<message>
<source>GEOM_EXTRUSION_BSV</source>
<translation>Base Shapes + Vector</translation>
<source>GEOM_HOLES</source>
<translation>Holes</translation>
</message>
+ <message>
+ <source>GEOM_INIT_SHAPE</source>
+ <translation>Initial shape</translation>
+ </message>
<message>
<source>GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE</source>
<translation>Identical names : select by mouse !</translation>
<source>GEOM_SHELL_TITLE</source>
<translation>Shell Construction</translation>
</message>
+ <message>
+ <source>GEOM_SKETCH</source>
+ <translation>Sketch</translation>
+ </message>
<message>
<source>GEOM_SKETCHER_ABS</source>
<translation>Absolute</translation>
<source>GEOM_SKETCHER_VXVY</source>
<translation>VX-VY</translation>
</message>
+ <message>
+ <source>GEOM_SKETCHER_WPLANE</source>
+ <translation>Select a planar face or a plane</translation>
+ </message>
<message>
<source>GEOM_SKETCHER_VY2</source>
<translation>VY :</translation>
<source>MEN_EXTRUSION</source>
<translation>Extrusion</translation>
</message>
+ <message>
+ <source>MEN_EXTRUDED_CUT</source>
+ <translation>Extruded cut</translation>
+ </message>
+ <message>
+ <source>MEN_EXTRUDED_BOSS</source>
+ <translation>Extruded boss</translation>
+ </message>
<message>
<source>MEN_FACE</source>
<translation>Face</translation>
<source>GEOM_SKETCHER_VXVY</source>
<translation>VX-VY</translation>
</message>
+ <message>
+ <source>GEOM_SKETCHER_WPLANE</source>
+ <translation>Sélectionnez une face plane ou un plan</translation>
+ </message>
<message>
<source>GEOM_SKETCHER_VY2</source>
<translation>VY :</translation>
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
+ case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS
+ case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
//createGeomAction( GEOMOp::OpClipping, "CLIPPING" );
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
+ createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" );
+ createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" );
createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" );
createMenu( GEOMOp::OpFillet2d, operId, -1 );
createMenu( GEOMOp::OpFillet3d, operId, -1 );
createMenu( GEOMOp::OpChamfer, operId, -1 );
+ createMenu( GEOMOp::OpExtrudedBoss, operId, -1 );
+ createMenu( GEOMOp::OpExtrudedCut, operId, -1 );
//createMenu( GEOMOp::OpClipping, operId, -1 );
int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
*/
// ---- create toolbars --------------------------
-
+
int basicTbId = createTool( tr( "TOOL_BASIC" ) );
- createTool( GEOMOp::OpPoint, basicTbId );
- createTool( GEOMOp::OpLine, basicTbId );
- createTool( GEOMOp::OpCircle, basicTbId );
- createTool( GEOMOp::OpEllipse, basicTbId );
- createTool( GEOMOp::OpArc, basicTbId );
- createTool( GEOMOp::OpCurve, basicTbId );
- createTool( GEOMOp::OpVector, basicTbId );
- createTool( GEOMOp::OpPlane, basicTbId );
- createTool( GEOMOp::OpLCS, basicTbId );
+ createTool( GEOMOp::OpPoint, basicTbId );
+ createTool( GEOMOp::OpLine, basicTbId );
+ createTool( GEOMOp::OpCircle, basicTbId );
+ createTool( GEOMOp::OpEllipse, basicTbId );
+ createTool( GEOMOp::OpArc, basicTbId );
+ createTool( GEOMOp::OpCurve, basicTbId );
+ createTool( GEOMOp::OpVector, basicTbId );
+ createTool( GEOMOp::Op2dSketcher, basicTbId ); //rnc
+ createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
+ createTool( GEOMOp::OpPlane, basicTbId );
+ createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
-
+
+// int sketchTbId = createTool( tr( "TOOL_SKETCH" ) );
+// createTool( GEOMOp::Op2dSketcher, sketchTbId );
+// createTool( GEOMOp::Op3dSketcher, sketchTbId );
+
int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
- createTool( GEOMOp::OpBox, primTbId );
- createTool( GEOMOp::OpCylinder, primTbId );
- createTool( GEOMOp::OpSphere, primTbId );
- createTool( GEOMOp::OpTorus, primTbId );
- createTool( GEOMOp::OpCone, primTbId );
- createTool( GEOMOp::OpRectangle, primTbId );
- createTool( GEOMOp::OpDisk, primTbId );
-
+ createTool( GEOMOp::OpBox, primTbId );
+ createTool( GEOMOp::OpCylinder, primTbId );
+ createTool( GEOMOp::OpSphere, primTbId );
+ createTool( GEOMOp::OpTorus, primTbId );
+ createTool( GEOMOp::OpCone, primTbId );
+ createTool( GEOMOp::OpRectangle, primTbId );
+ createTool( GEOMOp::OpDisk, primTbId );
+ createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc
+
+// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc
+// createTool( GEOMOp::OpPipeTShape, advancedTbId );
+
int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
- createTool( GEOMOp::OpFuse, boolTbId );
- createTool( GEOMOp::OpCommon, boolTbId );
- createTool( GEOMOp::OpCut, boolTbId );
- createTool( GEOMOp::OpSection, boolTbId );
-
- int genTbId = createTool( tr( "TOOL_GENERATION" ) );
+ createTool( GEOMOp::OpFuse, boolTbId );
+ createTool( GEOMOp::OpCommon, boolTbId );
+ createTool( GEOMOp::OpCut, boolTbId );
+ createTool( GEOMOp::OpSection, boolTbId );
+
+ int genTbId = createTool( tr( "TOOL_GENERATION" ) );
createTool( GEOMOp::OpPrism, genTbId );
createTool( GEOMOp::OpRevolution, genTbId );
createTool( GEOMOp::OpFilling, genTbId );
createTool( GEOMOp::OpPipe, genTbId );
-
+
int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) );
createTool( GEOMOp::OpTranslate, transTbId );
createTool( GEOMOp::OpRotate, transTbId );
createTool( separator(), transTbId );
createTool( GEOMOp::OpMultiTranslate, transTbId );
createTool( GEOMOp::OpMultiRotate, transTbId );
-
+
int operTbId = createTool( tr( "TOOL_OPERATIONS" ) );
- createTool( GEOMOp::Op2dSketcher, operTbId );
- createTool( GEOMOp::Op3dSketcher, operTbId );
- createTool( separator(), operTbId );
createTool( GEOMOp::OpExplode, operTbId );
- createTool( separator(), operTbId );
-#ifdef WITH_OPENCV
- createTool( GEOMOp::OpFeatureDetect, operTbId );
-#endif
- createTool( GEOMOp::OpPictureImport, operTbId );
- createTool( separator(), operTbId );
-
createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
- createTool( separator(), operTbId );
- createTool( GEOMOp::OpFillet1d, operTbId );
- createTool( GEOMOp::OpFillet2d, operTbId );
- createTool( GEOMOp::OpFillet3d, operTbId );
- createTool( GEOMOp::OpChamfer, operTbId );
-
+
+ int featTbId = createTool( tr( "TOOL_FEATURES" ) );
+ createTool( GEOMOp::OpFillet1d, featTbId );
+ createTool( GEOMOp::OpFillet2d, featTbId );
+ createTool( GEOMOp::OpFillet3d, featTbId );
+ createTool( GEOMOp::OpChamfer, featTbId );
+ createTool( GEOMOp::OpExtrudedBoss, featTbId );
+ createTool( GEOMOp::OpExtrudedCut, featTbId );
+
int buildTbId = createTool( tr( "TOOL_BUILD" ) );
createTool( GEOMOp::OpEdge, buildTbId );
createTool( GEOMOp::OpWire, buildTbId );
createTool( GEOMOp::OpCheckShape, measureTbId );
createTool( GEOMOp::OpCheckCompound, measureTbId );
createTool( GEOMOp::OpCheckSelfInters, measureTbId );
+
+ int picturesTbId = createTool( tr( "TOOL_PICTURES" ) );
+ createTool( GEOMOp::OpPictureImport, picturesTbId );
+ #ifdef WITH_OPENCV
+ createTool( GEOMOp::OpFeatureDetect, picturesTbId );
+ #endif
- int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
- createTool( GEOMOp::OpPipeTShape, advancedTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
OpFillet1d = 3706, // MENU OPERATION - FILLET 1D
OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
+ OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS
+ OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT
// RepairGUI -----------------//--------------------------------
OpSewing = 4000, // MENU REPAIR - SEWING
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES
return aPrism;
}
+//=============================================================================
+/*!
+ * MakeDraftPrism
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
+ (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse)
+{
+ SetErrorCode(KO);
+
+ if (theBase.IsNull() || theInitShape.IsNull()) return NULL;
+
+ Handle(GEOM_Object) aPrism = NULL;
+
+ if ( theFuse )
+ {
+ //Add a new Extruded Boss object
+ aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_BOSS);
+ }
+ else
+ {
+ //Add a new Extruded Cut object
+ aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_CUT);
+ }
+
+ //Add a new Prism function for the creation of a Draft Prism feature
+ Handle(GEOM_Function) aFunction =
+ aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), DRAFT_PRISM_FEATURE);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
+
+ GEOMImpl_IPrism aCI (aFunction);
+
+ Handle(GEOM_Function) aRefInit = theInitShape->GetLastFunction();
+ Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
+
+ if (aRefBase.IsNull() || aRefInit.IsNull()) return NULL;
+
+ // Set parameters
+ aCI.SetBase(aRefBase);
+ aCI.SetInitShape(aRefInit);
+ aCI.SetH(theHeight);
+ aCI.SetDraftAngle(theAngle);
+ if ( theFuse )
+ aCI.SetFuseFlag(1);
+ else
+ aCI.SetFuseFlag(0);
+
+ //Compute the Draft Prism Feature value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Extrusion can not be created, check input data");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ if(theFuse)
+ {
+ GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss("
+ << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ }
+ else
+ {
+ GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut("
+ << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ }
+
+ SetErrorCode(OK);
+ return aPrism;
+}
+
//=============================================================================
/*!
* MakePipe
Standard_EXPORT Handle(GEOM_Object) MakePrismDXDYDZ2Ways (Handle(GEOM_Object) theBase,
double theDX, double theDY, double theDZ);
-
+
+ Standard_EXPORT Handle(GEOM_Object) MakeDraftPrism (Handle(GEOM_Object) theInitShape, Handle(GEOM_Object) theBase,
+ double theHeight, double theAngle, bool theFuse);
+
Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePath);
//NOTE: This is an intreface to a function for the Prism creation.
#include "GEOM_Function.hxx"
+// #include <GEOMImpl_Mode.hxx> TEST
-#define PRISM_ARG_H 1
-#define PRISM_ARG_VEC 2
-#define PRISM_ARG_BASE 3
-#define PRISM_ARG_PNT_F 4
-#define PRISM_ARG_PNT_L 5
-#define PRISM_ARG_DX 6
-#define PRISM_ARG_DY 7
-#define PRISM_ARG_DZ 8
-#define PRISM_ARG_SCALE 9
+#define PRISM_ARG_H 1
+#define PRISM_ARG_VEC 2
+#define PRISM_ARG_BASE 3
+#define PRISM_ARG_PNT_F 4
+#define PRISM_ARG_PNT_L 5
+#define PRISM_ARG_DX 6
+#define PRISM_ARG_DY 7
+#define PRISM_ARG_DZ 8
+#define PRISM_ARG_SCALE 9
+#define PRISM_ARG_DRAFT 10
+#define PRISM_ARG_FUSE 11
+#define PRISM_ARG_INIT 12
+#define PRISM_ARG_MODE 13
class GEOMImpl_IPrism
{
GEOMImpl_IPrism(Handle(GEOM_Function) theFunction): _func(theFunction) {}
- void SetBase (Handle(GEOM_Function) theRefBase ) { _func->SetReference(PRISM_ARG_BASE, theRefBase); }
- void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(PRISM_ARG_VEC , theRefVector); }
- void SetFirstPoint(Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); }
- void SetLastPoint (Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); }
+ void SetBase (Handle(GEOM_Function) theRefBase ) { _func->SetReference(PRISM_ARG_BASE, theRefBase); }
+ void SetVector(Handle(GEOM_Function) theRefVector ) { _func->SetReference(PRISM_ARG_VEC , theRefVector); }
+ void SetFirstPoint(Handle(GEOM_Function) thePoint ) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); }
+ void SetLastPoint (Handle(GEOM_Function) thePoint ) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); }
+ void SetInitShape (Handle(GEOM_Function) theInitShape) { _func->SetReference(PRISM_ARG_INIT, theInitShape); }
Handle(GEOM_Function) GetBase () { return _func->GetReference(PRISM_ARG_BASE); }
Handle(GEOM_Function) GetVector() { return _func->GetReference(PRISM_ARG_VEC ); }
Handle(GEOM_Function) GetFirstPoint() { return _func->GetReference(PRISM_ARG_PNT_F ); }
Handle(GEOM_Function) GetLastPoint () { return _func->GetReference(PRISM_ARG_PNT_L ); }
+ Handle(GEOM_Function) GetInitShape () { return _func->GetReference(PRISM_ARG_INIT ); }
void SetDX(double theDX) { _func->SetReal(PRISM_ARG_DX, theDX); }
void SetDY(double theDY) { _func->SetReal(PRISM_ARG_DY, theDY); }
double GetDY() { return _func->GetReal(PRISM_ARG_DY); }
double GetDZ() { return _func->GetReal(PRISM_ARG_DZ); }
- void SetH(double theH) { _func->SetReal(PRISM_ARG_H, theH); }
-
- double GetH() { return _func->GetReal(PRISM_ARG_H); }
-
- void SetScale(double theH) { _func->SetReal(PRISM_ARG_SCALE, theH); }
+ void SetH (double theH ) { _func->SetReal(PRISM_ARG_H, theH); }
+ void SetScale (double theH ) { _func->SetReal(PRISM_ARG_SCALE, theH); }
+ void SetDraftAngle(double theAngle) { _func->SetReal(PRISM_ARG_DRAFT, theAngle); }
+ double GetH() { return _func->GetReal(PRISM_ARG_H); }
double GetScale() { return _func->GetReal(PRISM_ARG_SCALE); }
+ double GetDraftAngle() { return _func->GetReal(PRISM_ARG_DRAFT); }
+
+ void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); }
+// void SetMode(GEOMImpl_Mode theMode) { _func->SetInteger(PRISM_ARG_MODE, theMode); } //TEST
+
+ int GetFuseFlag() { return _func->GetInteger(PRISM_ARG_FUSE); }
+// GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST
private:
#include <GEOM_Function.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
+#include <BRepFeat_MakeDPrism.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepCheck_Shell.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <Standard_ConstructionError.hxx>
+#include "utilities.h"
+
//=======================================================================
//function : GetID
//purpose :
}
}
}
+
+ else if (aType == DRAFT_PRISM_FEATURE) {
+ Handle(GEOM_Function) aRefInit = aCI.GetInitShape();
+ Handle(GEOM_Function) aRefBase = aCI.GetBase();
+ TopoDS_Shape anInitShape = aRefInit->GetValue(); // Initial shape
+ TopoDS_Shape aSketch = aRefBase->GetValue();
+ Standard_Real aHeight = aCI.GetH(); // Height of the extrusion
+ Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle
+ Standard_Boolean isProtrusion = (aCI.GetFuseFlag()==1);
+ // Flag to know wether the feature is a protrusion (fuse) or a depression (cut)
+
+ if (anInitShape.ShapeType() == TopAbs_COMPOUND)
+ {
+ TopExp_Explorer anExp(anInitShape, TopAbs_SOLID);
+ int solidCount = 0;
+ for(;anExp.More();anExp.Next())
+ {
+ solidCount++;
+ }
+ if (solidCount == 0)
+ {
+ Standard_ConstructionError::Raise("The input shape is a compound without any solid");
+ }
+ else if (solidCount > 1)
+ {
+ Standard_ConstructionError::Raise("The input shape is a compound with more than one solid");
+ }
+ }
+
+ TopoDS_Wire aWire = TopoDS_Wire();
+
+ if (aSketch.ShapeType() == TopAbs_EDGE)
+ {
+ aWire = BRepBuilderAPI_MakeWire(TopoDS::Edge(aSketch));
+ }
+ else if (aSketch.ShapeType() == TopAbs_WIRE)
+ {
+ aWire = TopoDS::Wire(aSketch);
+ }
+ else
+ {
+ Standard_ConstructionError::Raise("The input sketch is neither a wire nor an edge");
+ }
+
+ if (!aWire.Closed())
+ Standard_ConstructionError::Raise("The wire has to be closed");
+
+ // history of the Base wire (RefBase)
+ Handle(GEOM_Object) aSuppObj;
+ TDF_LabelSequence aLabelSeq;
+ aRefBase->GetDependency(aLabelSeq);
+
+ // If the base wire has only one dependency we use it
+ // to determine the right normal of the face which
+ // must be oriented towards outside of the solid (like the support face)
+ if (aLabelSeq.Length()==1)
+ {
+ TDF_Label anArgumentRefLabel = aLabelSeq.Value(1);
+ aSuppObj = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
+ }
+
+ // Construction of the face if the wire hasn't any support face
+ TopoDS_Face aFaceBase = BRepBuilderAPI_MakeFace(aWire);
+
+ if(!aSuppObj.IsNull()) // If the wire has a support
+ {
+ TopoDS_Shape aSupport = aSuppObj->GetValue();
+ if (aSupport.ShapeType() == TopAbs_FACE)
+ {
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aSupport));
+ TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
+
+ if(aTempFace.Orientation() != TopoDS::Face(aSupport).Orientation())
+ {
+ aFaceBase=TopoDS::Face(aTempFace.Reversed());
+ }
+ else
+ aFaceBase=aTempFace;
+ }
+ }
+
+ // Invert height and angle if the operation is an extruded cut
+ bool invert = !isProtrusion;
+
+ // If the face has a reverse orientation invert for extruded boss operations
+ if(aFaceBase.Orientation() == TopAbs_REVERSED)
+ invert = isProtrusion;
+
+ if(invert)
+ {
+ anAngle = -anAngle; // Invert angle and height
+ aHeight = -aHeight;
+ }
+
+ BRepFeat_MakeDPrism thePrism(anInitShape, aFaceBase, TopoDS_Face(),
+ anAngle*PI180, isProtrusion, Standard_True);
+
+ thePrism.Perform(aHeight);
+
+ aShape = thePrism.Shape();
+ }
if (aShape.IsNull()) return 0;
-
- TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
- aFunction->SetValue(aRes);
+
+
+ if (aType == DRAFT_PRISM_FEATURE)
+ {
+ TopoDS_Shape aRes = aShape;
+
+ // If the result is a compound with only one solid,
+ // return the solid
+ if (aShape.ShapeType() == TopAbs_COMPOUND)
+ {
+ TopExp_Explorer anExp(aShape, TopAbs_SOLID);
+
+ int solidNb = 0;
+ TopoDS_Solid aSolid;
+
+ for(;anExp.More();anExp.Next())
+ {
+ aSolid = TopoDS::Solid(anExp.Current());
+ solidNb++;
+ }
+ if (solidNb == 1)
+ {
+ aRes = aSolid;
+ }
+ }
+
+ aFunction->SetValue(aRes);
+ }
+ else
+ {
+ TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ aFunction->SetValue(aRes);
+ }
+
log.SetTouched(Label());
#define GEOM_PROJECTION 45
+#define GEOM_EXTRUDED_CUT 46
+
+#define GEOM_EXTRUDED_BOSS 47
+
//GEOM_Function types
#define COPY_WITH_REF 1
#define PRISM_BASE_TWO_PNT_2WAYS 4
#define PRISM_BASE_DXDYDZ 5
#define PRISM_BASE_DXDYDZ_2WAYS 6
+#define DRAFT_PRISM_FEATURE 7
#define REVOLUTION_BASE_AXIS_ANGLE 1
#define REVOLUTION_BASE_AXIS_ANGLE_2WAYS 2
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeDraftPrism
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
+ (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
+ CORBA::Double theHeight,
+ CORBA::Double theAngle,
+ CORBA::Boolean theFuse)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aInit = GetObjectImpl(theInitShape);
+ Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+
+ if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
+
+ //Create the Prism
+ Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
+
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakePipe
CORBA::Double theDY,
CORBA::Double theDZ,
CORBA::Double theScaleFactor);
-
+
+ GEOM::GEOM_Object_ptr MakeDraftPrism (GEOM::GEOM_Object_ptr theInitShape,
+ GEOM::GEOM_Object_ptr theBase,
+ CORBA::Double theHeight,
+ CORBA::Double theAngle,
+ CORBA::Boolean theFuse);
+
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath);
## @defgroup l3_basic_op Basic Operations
## @defgroup l3_boolean Boolean Operations
## @defgroup l3_transform Transformation Operations
-## @defgroup l3_local Local Operations (Fillet and Chamfer)
+## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
## @defgroup l3_blocks_op Blocks Operations
## @defgroup l3_healing Repairing Operations
## @defgroup l3_restore_ss Restore presentation parameters and a tree of sub-shapes
else:
anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
return anObj
+
+ ## Remove material from a solid by extrusion of the base shape on the given distance.
+ # @param theInit Shape to remove material from. It must be a solid or
+ # a compound made of a single solid.
+ # @param theBase Closed edge or wire defining the base shape to be extruded.
+ # @param theH Prism dimension along the normal to theBase
+ # @param theAngle Draft angle in degrees.
+ # @return New GEOM.GEOM_Object, containing the initial shape with removed material
+ #
+ # @ref tui_creation_prism "Example"
+ def MakeExtrudedCut(self, theInit, theBase, theH, theAngle):
+ """
+ Add material to a solid by extrusion of the base shape on the given distance.
+
+ Parameters:
+ theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
+ theBase Closed edge or wire defining the base shape to be extruded.
+ theH Prism dimension along the normal to theBase
+ theAngle Draft angle in degrees.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the initial shape with removed material.
+ """
+ # Example: see GEOM_TestAll.py
+ #theH,Parameters = ParseParameters(theH)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
+ RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
+ #anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Add material to a solid by extrusion of the base shape on the given distance.
+ # @param theInit Shape to add material to. It must be a solid or
+ # a compound made of a single solid.
+ # @param theBase Closed edge or wire defining the base shape to be extruded.
+ # @param theH Prism dimension along the normal to theBase
+ # @param theAngle Draft angle in degrees.
+ # @return New GEOM.GEOM_Object, containing the initial shape with added material
+ #
+ # @ref tui_creation_prism "Example"
+ def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle):
+ """
+ Add material to a solid by extrusion of the base shape on the given distance.
+
+ Parameters:
+ theInit Shape to add material to. It must be a solid or a compound made of a single solid.
+ theBase Closed edge or wire defining the base shape to be extruded.
+ theH Prism dimension along the normal to theBase
+ theAngle Draft angle in degrees.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the initial shape with added material.
+ """
+ # Example: see GEOM_TestAll.py
+ #theH,Parameters = ParseParameters(theH)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
+ RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
+ #anObj.SetParameters(Parameters)
+ return anObj
# end of l3_local
## @}
OperationGUI_ChamferDlg.h \
OperationGUI_GetShapesOnShapeDlg.h \
OperationGUI_GetSharedShapesDlg.h \
+ OperationGUI_ExtrudedFeatureDlg.h \
OperationGUI_ClippingDlg.h
# Libraries targets
OperationGUI_FilletDlg.cxx \
OperationGUI_Fillet1d2dDlg.cxx \
OperationGUI_ChamferDlg.cxx \
+ OperationGUI_ExtrudedFeatureDlg.cxx \
OperationGUI_ClippingDlg.cxx
MOC_FILES = \
OperationGUI_FilletDlg_moc.cxx \
OperationGUI_Fillet1d2dDlg_moc.cxx \
OperationGUI_ChamferDlg_moc.cxx \
+ OperationGUI_ExtrudedFeatureDlg_moc.cxx \
OperationGUI_ClippingDlg_moc.cxx
nodist_libOperationGUI_la_SOURCES = \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMAlgo \
+ -I$(srcdir)/../GEOM \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_GetShapesOnShapeDlg.h"
#include "OperationGUI_GetSharedShapesDlg.h"
+#include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT
//=======================================================================
// function : OperationGUI()
case GEOMOp::OpClipping: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpShapesOnShape: (new OperationGUI_GetShapesOnShapeDlg(getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->show(); break;
+ case GEOMOp::OpExtrudedBoss: (new OperationGUI_ExtrudedFeatureDlg (BOSS, getGeometryGUI(), parent))->show(); break;
+ case GEOMOp::OpExtrudedCut: (new OperationGUI_ExtrudedFeatureDlg (CUT, getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break;
case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break;
default:
class OperationGUI : public GEOMGUI
{
public :
+ enum ExtrudedFeatOperation { CUT = 1, BOSS = 2 };
+
OperationGUI( GeometryGUI* );
~OperationGUI();
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : OperationGUI_ExtrudedFeatureDlg.cxx
+// Author : Renaud NEDELEC, Open CASCADE S.A.S.
+
+#include "OperationGUI.h"
+#include "OperationGUI_ExtrudedFeatureDlg.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <DlgRef.h>
+#include <GEOM_Object.hxx>
+
+// OCCT Includes
+// #include <TopoDS_Shape.hxx>
+// #include <TopoDS_Edge.hxx>
+// #include <TopoDS.hxx>
+// #include <TopExp.hxx>
+// #include <TColStd_IndexedMapOfInteger.hxx>
+// #include <TopTools_IndexedMapOfShape.hxx>
+// #include <Precision.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include <GEOMImpl_Types.hxx>
+
+//=================================================================================
+// class : OperationGUI_ExtrudedFeatureDlg()
+// purpose : Constructs a OperationGUI_ExtrudedCutDlg 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_ExtrudedFeatureDlg::OperationGUI_ExtrudedFeatureDlg(const int theOperation,
+ GeometryGUI* theGeometryGUI,
+ QWidget* parent,bool modal,
+ Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myOperation(theOperation)
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0;
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICO_DRAFT")));
+ QString aTitle;
+ switch (myOperation)
+ {
+ case OperationGUI::BOSS:
+ image0 = QPixmap(aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_BOSS")));
+ aTitle = tr("GEOM_EXTRUDED_BOSS");
+ break;
+ case OperationGUI::CUT:
+ image0 = QPixmap( aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_CUT")));
+ aTitle = tr("GEOM_EXTRUDED_CUT");
+ break;
+ }
+
+ setWindowTitle(aTitle);
+ mainFrame()->GroupConstructors->setTitle(aTitle);
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ mainFrame()->RadioButton1->setChecked(true);
+
+ myGroup = new DlgRef_2Sel2Spin1Push(centralWidget());
+ myGroup->PushButton1->setIcon(image1);
+ myGroup->PushButton2->setIcon(image1);
+ myGroup->PushButton3->setIcon(image2);
+ myGroup->LineEdit1->setReadOnly(true);
+ myGroup->LineEdit2->setReadOnly(true);
+ myGroup->TextLabel1->setText(tr("GEOM_INIT_SHAPE"));
+ myGroup->TextLabel2->setText(tr("GEOM_SKETCH"));
+ myGroup->TextLabel3->setText(tr("GEOM_HEIGHT"));
+
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0);
+ layout->setSpacing(6);
+ layout->addWidget(myGroup);
+
+ Init();
+
+}
+
+//=================================================================================
+// function : ~OperationGUI_ExtrudedFeatureDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+OperationGUI_ExtrudedFeatureDlg::~OperationGUI_ExtrudedFeatureDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::Init()
+{
+ // init variables
+ myEditCurrentArgument = myGroup->LineEdit1;
+
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ initSpinBox(myGroup->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox(myGroup->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
+
+ myGroup->LineEdit1->setText("");
+ myGroup->LineEdit2->setText("");
+ myGroup->SpinBox_DX->setValue(10.0);
+ myGroup->SpinBox_DY->setValue(10.0);
+ myGroup->SpinBox_DY->setEnabled(false);
+ myObject1.nullify();
+ myObject2.nullify();
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myGroup->PushButton3, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool)));
+ connect(myGroup->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(myGroup->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+
+
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ initName(mainFrame()->GroupConstructors->title());
+
+ mainFrame()->RadioButton1->setFocus();
+
+ globalSelection(GEOM_ALLSHAPES); //TODO à changer
+
+ myGroup->PushButton1->click();
+ SelectionIntoArgument();
+
+ resize(minimumSizeHint());
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::ClickOnOk()
+{
+ setIsApplyAndClose( true );
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool OperationGUI_ExtrudedFeatureDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+ // activate selection and connect selection manager
+ myGroup->PushButton1->click();
+ return true;
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myGroup->PushButton1) {
+ myEditCurrentArgument = myGroup->LineEdit1;
+
+ myGroup->PushButton2->setDown(false);
+ myGroup->LineEdit2->setEnabled(false);
+ }
+ else if (send == myGroup->PushButton2) {
+ myEditCurrentArgument = myGroup->LineEdit2;
+
+ myGroup->PushButton1->setDown(false);
+ myGroup->LineEdit1->setEnabled(false);
+ }
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+}
+
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection is changed or on dialog initialization or activation
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::SelectionIntoArgument()
+{
+ myEditCurrentArgument->setText("");
+
+ QList<TopAbs_ShapeEnum> types;
+ types<<TopAbs_SHAPE;
+
+ if (myEditCurrentArgument == myGroup->LineEdit1)
+ {
+ types.clear();
+ types<<TopAbs_COMPOUND<<TopAbs_SOLID;
+ }
+ if (myEditCurrentArgument == myGroup->LineEdit2)
+ {
+ types.clear();
+ types << TopAbs_EDGE << TopAbs_WIRE;
+ }
+
+ GEOM::GeomObjPtr aSelectedObject = getSelected( types );
+ TopoDS_Shape aShape;
+ if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+ QString aName = GEOMBase::GetName( aSelectedObject.get() );
+ myEditCurrentArgument->setText( aName );
+
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ if (myEditCurrentArgument == myGroup->LineEdit1) {
+ myObject1 = aSelectedObject;
+ if (!myObject2)
+ myGroup->PushButton2->click();
+ }
+ else if (myEditCurrentArgument == myGroup->LineEdit2) {
+ myObject2 = aSelectedObject;
+ if (!myObject1)
+ myGroup->PushButton1->click();
+ }
+
+ displayPreview(true);
+ }
+ else {
+ if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
+ else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( SelectionIntoArgument() ) );
+ processPreview();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose : when mouse enter onto the QWidget
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::ValueChangedInSpinBox()
+{
+ displayPreview(true);
+}
+
+//=================================================================================
+// function : ButtonClicked(bool checked)
+// purpose :
+//=================================================================================
+void OperationGUI_ExtrudedFeatureDlg::ButtonClicked(bool checked)
+{
+ myGroup->SpinBox_DY->setEnabled(checked);
+ displayPreview(true);
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr OperationGUI_ExtrudedFeatureDlg::createOperation()
+{
+ return getGeomEngine()->GetI3DPrimOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool OperationGUI_ExtrudedFeatureDlg::isValid (QString&)
+{
+ return myObject1 && myObject2;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects)
+{
+// GEOM::GEOM_Object_var anObj;
+
+ GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
+ double angle=0.0;
+ if (myGroup->PushButton3->isChecked())
+ angle=myGroup->SpinBox_DY->value();
+
+ bool isProtrusion = (myOperation == OperationGUI::BOSS);
+
+ GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),
+ myGroup->SpinBox_DX->value(),
+ angle,
+ isProtrusion);
+// switch (myOperation)
+// {
+// case OperationGUI::BOSS:
+// anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),myGroup->SpinBox_DX->value(),angle, true);
+// break;
+// case OperationGUI::CUT:
+// anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),myGroup->SpinBox_DX->value(),angle, false);
+// break;
+// }
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+
+ return true;
+}
+
+
+
+
+
+
+
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : OperationGUI_ExtrudedFeatureDlg.h
+// Author : Renaud NEDELEC, Open CASCADE S.A.S.
+
+#ifndef BASICGUI_EXTRUDEDFEATUREDLG_H
+#define BASICGUI_EXTRUDEDFEATUREDLG_H
+
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
+#include <QMap>
+
+// class DlgRef_2Sel1Spin;
+// class DlgRef_3Spin;
+// class DlgRef_2Sel;
+// class DlgRef_1Sel3Spin;
+// class DlgRef_1Sel2Spin;
+class DlgRef_2Sel2Spin1Push;
+
+// class QLineEdit;
+// class QGroupBox;
+// class QButtonGroup;
+// class QMenu;
+class QAction;
+
+//=================================================================================
+// class : OperationGUI_ExtrudedFeatureDlg
+// purpose :
+//=================================================================================
+class OperationGUI_ExtrudedFeatureDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ OperationGUI_ExtrudedFeatureDlg( const int, GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
+ ~OperationGUI_ExtrudedFeatureDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+
+private:
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+ int myOperation;
+
+ GEOM::GeomObjPtr myObject1;
+ GEOM::GeomObjPtr myObject2;
+
+ DlgRef_2Sel2Spin1Push* myGroup;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void ValueChangedInSpinBox();
+ void ButtonClicked(bool);
+
+};
+
+#endif // BASICGUI_EXTRUDEDFEATUREDLG_H
\ No newline at end of file